From ad358afdc3edb5fc8881d82e83bfcc7d85cb2e2b Mon Sep 17 00:00:00 2001 From: Alexander Liu Date: Tue, 14 May 2024 14:35:03 -0700 Subject: [PATCH] =?UTF-8?q?docs:=20=F0=9F=93=9A=EF=B8=8F=20wip=20database?= =?UTF-8?q?=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/guidebook/_meta.json | 3 ++ pages/guidebook/infrastructure/_meta.json | 4 +++ .../infrastructure/guides/_meta.json | 4 +++ .../guides/provisioning-dev-database.mdx | 3 ++ .../guides/provisioning-pg-database.mdx | 36 +++++++++++++++++++ .../infrastructure/reference/_meta.json | 3 ++ .../infrastructure/reference/rds-postgres.md | 29 +++++++++++++++ 7 files changed, 82 insertions(+) create mode 100644 pages/guidebook/infrastructure/_meta.json create mode 100644 pages/guidebook/infrastructure/guides/_meta.json create mode 100644 pages/guidebook/infrastructure/guides/provisioning-dev-database.mdx create mode 100644 pages/guidebook/infrastructure/guides/provisioning-pg-database.mdx create mode 100644 pages/guidebook/infrastructure/reference/_meta.json create mode 100644 pages/guidebook/infrastructure/reference/rds-postgres.md diff --git a/pages/guidebook/_meta.json b/pages/guidebook/_meta.json index 080301f..c994111 100644 --- a/pages/guidebook/_meta.json +++ b/pages/guidebook/_meta.json @@ -5,6 +5,9 @@ "getting-started": { "title": "Getting Started" }, + "infrastructure": { + "title": "Infrastructure" + }, "processes": { "title": "Processes" }, diff --git a/pages/guidebook/infrastructure/_meta.json b/pages/guidebook/infrastructure/_meta.json new file mode 100644 index 0000000..eb126f8 --- /dev/null +++ b/pages/guidebook/infrastructure/_meta.json @@ -0,0 +1,4 @@ +{ + "guides": "Guides", + "reference": "Reference" +} diff --git a/pages/guidebook/infrastructure/guides/_meta.json b/pages/guidebook/infrastructure/guides/_meta.json new file mode 100644 index 0000000..aa535ba --- /dev/null +++ b/pages/guidebook/infrastructure/guides/_meta.json @@ -0,0 +1,4 @@ +{ + "provisioning-pg-database": "How to Provision a Postgres Database", + "provisioning-dev-database": "How to Provision a Development Database" +} diff --git a/pages/guidebook/infrastructure/guides/provisioning-dev-database.mdx b/pages/guidebook/infrastructure/guides/provisioning-dev-database.mdx new file mode 100644 index 0000000..a245ef2 --- /dev/null +++ b/pages/guidebook/infrastructure/guides/provisioning-dev-database.mdx @@ -0,0 +1,3 @@ +import { Steps, Callout } from "nextra/components"; + +# How to Provision a Development Database diff --git a/pages/guidebook/infrastructure/guides/provisioning-pg-database.mdx b/pages/guidebook/infrastructure/guides/provisioning-pg-database.mdx new file mode 100644 index 0000000..e0aa33f --- /dev/null +++ b/pages/guidebook/infrastructure/guides/provisioning-pg-database.mdx @@ -0,0 +1,36 @@ +import { Steps, Callout } from "nextra/components"; + +# How to Provision a Postgres Database + +This guide shows you how to provision a new Postgres database within our [RDS database server](/guidebook/infrastructure/reference/rds-postgres). + +{/* This guide is written with the assumption that user is familiar with SQL and / or a management tool like pgAdmin. */} + +## Steps: + + +### Create Database + + + The root postgres user credentials can be accessed by Project Chairs via the password manager. + + +Create a Postgres database within our RDS database server, with the owner being the `postgres` user. + +### Creating Roles and Users + +The `_dev` group is the parent group of devs and should be created with READ, WRITE, and EXECUTE permissions on the dev / public schema. + +#### `_lead` Group + +**This group should exist for all databases.** + +This is the parent group that project leads' database users inherit their permission from. + +#### `_prod` User + +**This group should exist for all databases.** + +This is the databse user used to connect from the production deployment. + + diff --git a/pages/guidebook/infrastructure/reference/_meta.json b/pages/guidebook/infrastructure/reference/_meta.json new file mode 100644 index 0000000..5d3e8f6 --- /dev/null +++ b/pages/guidebook/infrastructure/reference/_meta.json @@ -0,0 +1,3 @@ +{ + "rds-postgres": "RDS Postgres" +} diff --git a/pages/guidebook/infrastructure/reference/rds-postgres.md b/pages/guidebook/infrastructure/reference/rds-postgres.md new file mode 100644 index 0000000..78b8583 --- /dev/null +++ b/pages/guidebook/infrastructure/reference/rds-postgres.md @@ -0,0 +1,29 @@ +# RDS Postgres + +ICSSC projects use a single [AWS RDS](https://aws.amazon.com/rds/) Postgres server that contains many of our databases. Currently, [API](/ppapi), [ZotMeet](/zotmeet), [ZotNFound](/zotnfound), [Corporate Dashboard](/special-projects/corporate-dashboard), & Fellowship Rewrite use this database server. + +## Reasoning + +Refer to the Postgres Glossary to learn the difference between a Postgres server and database. Using a single Postgres server allows us to reduce cost and increate performance at our scale. This allows all our projects that require a relational / SQL database to share and pool their resources, compared to having seperate instances per project. + +## Databases + +### Roles / Permissioning + +#### `_dev` Group + +**This group should exist for all databases.** + +This is the parent group that individual members' database users inherit their permission from. + +#### `_lead` Group + +**This group should exist for all databases.** + +This is the parent group that project leads' database users inherit their permission from. + +#### `_prod` User + +**This group should exist for all databases.** + +This is the databse user used to connect from the production deployment.