Conversation
Improve the local setup to make it straightforward to run the server: ``` mise run db-start mix setup mise run dev ``` - Introduce mise to manage tool versions, tasks, and envs - Removed .tool-versions and Makefile in favor of mise.toml - Introduce `Realtime.Env` to use in runtime.exs with tests and more validations to make it more resilient to avoid hard to debug errors in the server booting process - Group all envs together in `runtime.exs` to have better discoverability, especially for docs (self-hosting) and config - Break readme into dedicated docs to reduce noise in the main readme (easier to scan) - Add Code of Conduct and Contributing guides based on https://github.com/supabase/.github and https://github.com/supabase/supabase - Added env vars into ENVS.md: API_TOKEN_BLOCKLIST, CLUSTER_STRATEGIES, DB_MASTER_REGION, DB_HOST_REPLICA_FRA, DB_HOST_REPLICA_IAD, DB_HOST_REPLICA_SIN, DB_HOST_REPLICA_SJC, REGION, LOGS_ENGINE, LOGFLARE_LOGGER_BACKEND_URL, LOGFLARE_API_KEY, LOGFLARE_SOURCE_ID, JWT_CLAIM_VALIDATORS, METRICS_JWT_SECRET, METRICS_TOKEN_BLOCKLIST, MAX_GEN_RPC_CALL_CLIENTS, PROM_POLL_RATE, AWS_EXECUTION_ENV, JANITOR_MAX_CHILDREN, JANITOR_CHILDREN_TIMEOUT, LOG_THROTTLE_JANITOR_INTERVAL_IN_MS, MEASURE_TRAFFIC_INTERVAL_IN_MS, NO_CHANNEL_TIMEOUT_IN_MS, RPC_TIMEOUT - Removed stale env vars from ENVS.md: DISCONNECT_SOCKET_ON_NO_CHANNELS_INTERVAL_IN_MS, JANITOR_CLEANUP_MAX_CHILDREN, JANITOR_CLEANUP_CHILDREN_TIMEOUT wip
| seed: ## Seed the database | ||
| DB_ENC_KEY="1234567890123456" FLY_ALLOC_ID=123e4567-e89b-12d3-a456-426614174000 mix run priv/repo/dev_seeds.exs | ||
|
|
||
| prod: ## Start a server with a MIX_ENV=prod |
There was a problem hiding this comment.
I'm assuming this is (was?) used to run a prod-like env but it seems outdated. I did not migrate to mise.toml because I'm not sure if it's still needed.
| <a href="https://supabase.com/docs/guides/realtime#examples">Examples</a> | ||
| · | ||
| <a href="https://github.com/supabase/realtime/issues/new?assignees=&labels=enhancement&template=2.Feature_request.md">Request Feature</a> | ||
| <a href="https://github.com/orgs/supabase/discussions/new?category=feature-requests">Request Features</a> |
There was a problem hiding this comment.
Linking to https://github.com/orgs/supabase/discussions/new?category=feature-requests instead of a local PR becase 1) we don't have a Feature Request template and 2) it seems to be the place where requests are currently made but I'm not sure.
There was a problem hiding this comment.
A lot of changes here but mostly:
- renaming vars to match the env name, for eg
pool_size->db_pool_sizenamed afterDB_POOL_SIZEwhich I find easier to maintain and also more explicit (same is true for other envs). - moving all env loading together to make it easier to scan and maintain
Another big change is introducing Realtime.Env, I can revert it if that's not the pattern we're looking for but I added it to avoid those usual hard to debug issues with env vars when booting the server, for eg with the previous code typos could cause unexpected behavior:
System.put_env("SERVICE_A_ENABLED", "falsee")
Env.get_boolean("SERVICE_A_ENABLED", false)
#=> :falsee
if Env.get_boolean("SERVICE_A_ENABLED", false) do
"Service A ENABLED"
else
"Service A DISABLED"
end
#=> "Service A ENABLED""Among other potential issues so I think it's worth the having that modules and also having tests.
I tried to make less changes as possible given the criticality of this file so please 👀
There was a problem hiding this comment.
Nothing changed, just copied from README
There was a problem hiding this comment.
Nothing changed, just copied from README
0dd44ba to
1c0da7b
Compare
1c0da7b to
bf88cc6
Compare
| docker image save ${{ env.POSTGRES_IMAGE }} | zstd -T0 -o /tmp/docker-images/postgres.tar.zst | ||
| docker image save ${{ env.DENO_IMAGE }} | zstd -T0 -o /tmp/docker-images/deno.tar.zst | ||
| - name: Run integration test | ||
| run: docker compose -f docker-compose.tests.yml up --abort-on-container-exit --exit-code-from test-runner |
There was a problem hiding this comment.
compose{-*}.yml is shorter and more popular nowadays :)
|
Hey @aantti I'm onboarding and noticed some potential fixes and improvements during the initial local setup and would be interesting to have your feedback since it's touching the contributing guides and I believe we need to update https://supabase.com/docs/guides/self-hosting/realtime/config as well. In short the main changes that impact contributors and potentially external projects:
|
| - Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) when you can. | ||
| - Tests are passing. | ||
| - You have reviwed the code. | ||
|
|
There was a problem hiding this comment.
should we reference that we should have fix: or feat: ?
There was a problem hiding this comment.
Yep good idea, I've improved the PR section to recommend good practices but not enforce because at the end of the day it's our responsibility to squash good commit messages into main. Also included some examples of good/bad commit messages using fix: and feat:
Improve the local setup to make it straightforward to run the server:
Realtime.Envto use in runtime.exs with tests and more validations to make it more resilient to avoid hard to debug errors in the server booting processruntime.exsto have better discoverability, especially for docs (self-hosting) and config