mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
update docs, add infra notes
This commit is contained in:
parent
d93592f1a2
commit
344c6e1c52
2 changed files with 112 additions and 16 deletions
42
README.md
42
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/<service>` to run the service
|
||||
- note this commonly needs configuration from environment.
|
||||
- `bazel test //src/<service>` 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
|
||||
|
|
86
docs/infrastructure.md
Normal file
86
docs/infrastructure.md
Normal file
|
@ -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`
|
Loading…
Add table
Reference in a new issue