diff --git a/README.md b/README.md index 75d761b..43b6b82 100644 --- a/README.md +++ b/README.md @@ -4,22 +4,29 @@ https://roleypoly.com Tame your Discord roles. -### Need Help with Roleypoly? +## Need Help with Roleypoly? ๐Ÿ’โ€โ™€๏ธ ๐Ÿ“š [Please read through our community documentation.](https://github.com/roleypoly/community-docs) + ๐Ÿ˜• [Still confused? Talk to us on Discord!](https://discord.gg/PWQUVsd) ## Developing -Roleypoly is a distributed system built with Go, React, Terraform, and Bazel. +Roleypoly is a distributed system built with TypeScript, React, Terraform, and Go. -This repo is currently being re-architected into a monorepo, so most processes might not be documented. +This app is heavily edge computing-based with the backend being deployed via Cloudflare Workers, UI server on Google Cloud Run with 6 regions, and the mention responder in Google Compute Engine. + +### Extra Docs + +- ๐Ÿ‘ทโ€โ™€๏ธ [Getting Started](docs/getting-started.md) +- ๐Ÿญ [Infrastructure](docs/infrastructure.md) +- ๐Ÿงพ [User Stories](docs/user-stories.md) ### Quickstart This repo can be quickly setup with [VSCode Dev Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) or [GitHub Codespaces](https://github.com/codespaces). This will setup a fully featured Docker container for developing VSCode, including extensions. -If you'd like to not use either of those, it can be imported into your Docker host with `bazel run //src/dev-container`, or pulled from either `roleypoly/dev-container:main` or `docker.pkg.github.com/roleypoly/roleypoly/dev-container:main`. This use case is not actively investigated, but with tinkering, will work. Feel free to document this process and open a PR :) +If you'd like to not use either of those, a dev toolkit image can be pulled from `ghcr.io/roleypoly/dev-container:main`. This use case is not actively investigated, but with tinkering, will work. Feel free to document this process and open a PR :) ### Developing Design System Components @@ -29,19 +36,22 @@ Run: - `yarn` to install deps - `yarn storybook` to open storybook -- `bazel test //src/design-system/....` to test +- `yarn test` to test + +### Developing App UI + +For working with the Next.js frontend components... + +Run: + +- `yarn` to install deps +- `yarn ui` to run Next.js dev server +- `yarn test` to test ### Developing Backend Components -This process is currently rough and in-flux. Please bear with us as we figure it out. +For working with Backend systems, you need Wrangler, and a setup script to help wtih config stuff :) -- `bazel run //src/` to run the service - - note this commonly needs configuration from environment. -- `bazel test //src/` to test - -### Things to Know - -Bazel can make some tasks far harder normal. Ideally, these are automated over. - -- **Updating `go.mod`?** - - Run `go generate ./...`. +- `yarn setup-wrangler` to setup wrangler.toml +- `wrangler dev -e dev` to start a local preview deployment +- `yarn test` to test diff --git a/docs/infrastructure.md b/docs/infrastructure.md new file mode 100644 index 0000000..4b222c1 --- /dev/null +++ b/docs/infrastructure.md @@ -0,0 +1,86 @@ +# Roleypoly Infrastructure + +## Ring 0 + +Any of these missing is a service outage. + +### Backend + +Backend is a Cloudflare Worker deployment. Edge computing, fuck yeah! + +Hosts: + +- `api.${env}.roleypoly.com/*` + - ex. for stage: `api.stage.roleypoly.com/*` +- `api.roleypoly.com/*` (only in prod) + +It uses 3 KV namespaces per environment: + +- Sessions + + - Store of data and tokens mapped to sessions + - All data subject to 6 hour TTL + +- GuildData + + - Store of guild data, e.g. categories, etc + - All data is permanent (maybe doubly persisted to Firestore) + +- Guilds + - Cache of Discord guild data + - All data subject to a 5 minute TTL + +### App UI + +The Next.js server is a docker container hosted on Google Cloud Run in multiple regions with a load balancer. Region focuses knowing traffic: US (x3), EU (x2), AP (x3). There is a running maximum of 10 containers per region, and a minimum of 0. + +Regions: + +- `us-east4` (South Carolina) +- `us-central1` (Iowa) +- `us-west1` (Oregon) +- `europe-west2` (London) +- `europe-west3` (Frankfurt) +- `australia-southeast1` (Sydney) +- `asia-northeast1` (Tokyo) +- `asia-southeast1` (Singapore) + +Staging is only deployed to `us-east4`. + +Hosts: + +- `web.${env}.roleypoly.com` + - ex. for stage: `web.stage.roleypoly.com` +- `roleypoly.com` (only in prod, after release) +- `next.roleypoly.com` (only in prod, pre-release) +- `beta.roleypoly.com` (only in stage) + +## Ring 1 + +Ephemeral services that can be tolerably lost, and would not be considered an outage, only degraded. + +### v1 Migration Service + +Hosted on v1 infrastructure, e.g. DigitalOcean. It is a connector and JSON API to the old v1 PgSQL data. + +Host: `migration.v1.roleypoly.com` (Locked down to specific authorization tokens) + +Sunset: Roleypoly Next + 3 months + +### Bot (Mention Responder) + +Bot doesn't do much, it's on a modestly sized Compute Engine VM using container hosting. It has no access to anything related to the real deployment of Roleypoly :) + +Region: `us-east4` (South Carolina) + +## Ring 2 + +Not end user applications. These will never be considered an "outage" if they are lost. + +### Design System Storybook + +Design system is a Vercel deployment + +Host: + +- `ui.roleypoly.com`