Skip to content

chore: local dev setup#1823

Merged
leandrocp merged 8 commits intomainfrom
fix/repo-setup
Apr 21, 2026
Merged

chore: local dev setup#1823
leandrocp merged 8 commits intomainfrom
fix/repo-setup

Conversation

@leandrocp
Copy link
Copy Markdown
Contributor

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

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
Comment thread Makefile
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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread README.md
<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>
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread config/runtime.exs
Copy link
Copy Markdown
Contributor Author

@leandrocp leandrocp Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of changes here but mostly:

  1. renaming vars to match the env name, for eg pool_size-> db_pool_size named after DB_POOL_SIZE which I find easier to maintain and also more explicit (same is true for other envs).
  2. 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 👀

Comment thread OBSERVABILITY_METRICS.md
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing changed, just copied from README

Comment thread ERROR_CODES.md
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing changed, just copied from README

@coveralls
Copy link
Copy Markdown

coveralls commented Apr 20, 2026

Coverage Status

Coverage is 91.948%fix/repo-setup into main. No base build found for main.

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
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

compose{-*}.yml is shorter and more popular nowadays :)

@leandrocp
Copy link
Copy Markdown
Contributor Author

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:

  • Adopting mise
  • Renaming compose files
  • Introducing CONTRIBUTING.md, DEVELOPERS.md and COC

Comment thread CONTRIBUTING.md
- Follow [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) when you can.
- Tests are passing.
- You have reviwed the code.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we reference that we should have fix: or feat: ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

@leandrocp leandrocp changed the title feat: local dev setup chore: local dev setup Apr 21, 2026
@leandrocp leandrocp merged commit 476f16b into main Apr 21, 2026
8 checks passed
@leandrocp leandrocp deleted the fix/repo-setup branch April 21, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants