{"id":11703,"date":"2026-11-25T11:36:19","date_gmt":"2026-11-25T09:36:19","guid":{"rendered":"https:\/\/upcloud.com\/global\/?post_type=tutorial&#038;p=11703"},"modified":"2026-11-25T11:21:31","modified_gmt":"2026-11-25T11:21:31","slug":"self-host-supabase-docker-vps","status":"publish","type":"tutorial","link":"https:\/\/upcloud.com\/global\/resources\/tutorials\/self-host-supabase-docker-vps\/","title":{"rendered":"Self-Host Supabase on a VPS with Docker: Production Setup"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\"><\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">Supabase&#8217;s <a href=\"https:\/\/supabase.com\/docs\/guides\/self-hosting\/docker\" target=\"_blank\" rel=\"noopener\">self-hosting guide<\/a> gets you a running stack in about ten minutes. Every container reports healthy, the dashboard loads, and the REST API answers requests, so the stack looks ready for production traffic.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, when you look closely, the shipped <code>.env<\/code> carries a JWT secret published in the documentation, a dashboard password that reads <code>this_password_is_insecure_and_should_be_updated<\/code>, an API gateway bound to port 8000 on every interface, an SMTP host pointing at a mail container the compose file no longer includes, no memory limits on any service, and a Postgres instance running on whatever the image defaults to. Each one becomes a real problem the first time the deployment faces the internet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This walkthrough starts from the official compose files and closes those items one at a time on a single <a href=\"https:\/\/upcloud.com\/global\/products\/cloud-servers\/\">UpCloud Cloud Server<\/a>. You will generate a full set of secrets and verify the API keys against a running instance, put the gateway behind Caddy with automatic certificates, lock Studio behind authentication and a firewall, wire up SMTP so signup confirmation actually sends, tune Postgres against the container&#8217;s memory ceiling, and set per-service limits so a runaway container cannot take the database down with it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The reference stack is one Premium Cloud Server running Ubuntu 26.04 LTS with 4 cores and 8 GB RAM (plan identifier <code>PREMIUM-4xCPU-8GB<\/code>, 100 GB of MaxIOPS storage), the Supabase Docker stack at release tag <code>self-hosted\/v0.8.2<\/code>, Caddy terminating TLS, and a domain with two hostnames pointing at the box.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You need:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A domain you can add DNS records for<\/li>\n\n\n\n<li>SMTP credentials from a transactional email provider, with a verified sender address<\/li>\n\n\n\n<li>Basic SSH usage, including <a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/use-ssh-keys-authentication\/\">generating an SSH key pair<\/a> and connecting to a remote host<\/li>\n\n\n\n<li>A private Git repository to hold your copy of the stack configuration<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Once you have these in place, follow along!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 1: Server sizing and preparation<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">RAM is the binding constraint. Supabase documents a 4 GB minimum with 8 GB recommended. Take the recommendation, because lower might struggle to absorb shared buffers, connection memory, image transformation spikes, and Realtime&#8217;s per-subscription cost. <code>PREMIUM-4xCPU-8GB<\/code> from the <a href=\"https:\/\/upcloud.com\/global\/docs\/products\/cloud-servers\/configurations\/\">Premium plan family<\/a> gives you 8 GB, 4 cores, and 100 GB of MaxIOPS storage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you haven&#8217;t already, <a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/deploy-server\/\">deploy a Cloud Server<\/a> using the recommended configuration. Once the server is provisioned, add swap on anything at or below 8 GB. Postgres and the BEAM services both allocate in bursts, and the OOM killer taking a container mid-query is worse than a few seconds of paging:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">fallocate -l 4G \/swapfile &amp;&amp; chmod 600 \/swapfile<br>mkswap \/swapfile &amp;&amp; swapon \/swapfile<br>echo '\/swapfile none swap sw 0 0' &gt;&gt; \/etc\/fstab<br>echo 'vm.swappiness=10' &gt;&gt; \/etc\/sysctl.conf &amp;&amp; sysctl -p<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Swappiness of 10 keeps the kernel from paging out shared buffers under normal pressure while leaving swap as an emergency reserve.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The firewall accepts SSH and the two web ports. Everything else reaches the outside world through the reverse proxy or an SSH tunnel:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ufw default deny incoming<br>ufw default allow outgoing<br>ufw allow 22\/tcp &amp;&amp; ufw allow 80\/tcp &amp;&amp; ufw allow 443\/tcp<br>ufw enable<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Port 8000 stays closed for the whole guide. Ports 5432 and 6543 also stay closed, which is what keeps the connection pooler off the public internet given that the compose file publishes both to the host.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Create a non-root user and add it to the <code>docker<\/code> group:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">adduser deploy<br>groupadd -f docker<br>usermod -aG sudo,docker deploy<br>rsync --archive --chown=deploy:deploy ~\/.ssh \/home\/deploy<br>sed -i 's\/^#*PasswordAuthentication.*\/PasswordAuthentication no\/' \/etc\/ssh\/sshd_config<br>sed -i 's\/^#*PermitRootLogin.*\/PermitRootLogin no\/' \/etc\/ssh\/sshd_config<br>systemctl restart ssh<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Membership in the <code>docker<\/code> group is equivalent to root on this machine, since any member can start a container that bind-mounts <code>\/<\/code> and writes to it as the host&#8217;s root user. <a href=\"https:\/\/docs.docker.com\/engine\/install\/linux-postinstall\/\" target=\"_blank\" rel=\"noopener\">Docker&#8217;s documentation<\/a> treats the group as a privileged boundary, so keep the membership list to people who already have sudo.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Install Docker from Docker&#8217;s own repository, because Ubuntu&#8217;s archive lags and the <code>deploy.resources<\/code> syntax in step 8 needs Compose v2:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -fsSL https:\/\/get.docker.com | sh<br>docker compose version<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Put the project under <code>\/opt\/supabase<\/code> and run everything from here as <code>deploy<\/code>. The upstream layout keeps persistent data inside the project directory, with Postgres writing to <code>volumes\/db\/data<\/code> and Storage writing to <code>volumes\/storage<\/code> as bind mounts, so configuration and data share a tree. Treat those two paths as the data set when you back one up and exclude the other.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 2: Clone the stack and pin your version<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Supabase ships a bootstrap script that sparse-clones the <code>docker<\/code> directory out of the monorepo into a project directory of its own. Run it against an explicit release tag:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">mkdir \/opt\/supabase &amp;&amp; cd \/opt\/supabase<br>curl -fsSL https:\/\/supabase.link\/setup.sh -o setup.sh<br>sh setup.sh --project-dir stack --skip-deps --ref self-hosted\/v0.8.2<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>--ref<\/code> flag is the important one. Without it the script resolves whatever <code>self-hosted\/v*<\/code> tag is latest at the moment you run it, so two people following the same instructions a month apart get different image sets. The script writes <code>.supabase-version<\/code> recording the ref you started from, and the <a href=\"https:\/\/supabase.com\/docs\/guides\/self-hosting\/updating\" target=\"_blank\" rel=\"noopener\">update procedure<\/a> three-way merges upstream changes against it so local edits survive. Losing that file leaves the next update with no base to merge from.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Commit your copy to a private repository before changing anything:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">cd \/opt\/supabase\/stack<br>git init &amp;&amp; git add -A<br>git commit -m \"Supabase self-hosted at self-hosted\/v0.8.2\"<br>git remote add origin <a href=\"mailto:git@github.com\">git@github.com<\/a>:yourorg\/supabase-stack.git<br>git push -u origin main<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The upstream <code>.gitignore<\/code> excludes <code>.env<\/code>, the data directories, <code>backups\/<\/code>, <code>.supabase-version<\/code>, and <code>docker-compose.override.yml<\/code>. Two of those work against you. Remove the <code>.supabase-version<\/code> and <code>docker-compose.override.yml<\/code> lines now, before either file exists. The override file doesn&#8217;t show up until step 5, but once it does it holds every local change you make from there onward, and it&#8217;s the one file the updater never touches. Leave <code>.env<\/code> excluded.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Pinning the version also pins exactly what runs. The compose file brings up eleven containers, and knowing what each one does is what lets you judge which ones your deployment actually needs, which is the next decision:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Service<\/th><th>Image<\/th><th>Responsibility<\/th><\/tr><\/thead><tbody><tr><td>db<\/td><td>supabase\/postgres:17.6.1.136<\/td><td>Postgres with the Supabase extensions, roles, and schemas<\/td><\/tr><tr><td>api-gw<\/td><td>envoyproxy\/envoy:v1.39.1<\/td><td>API gateway, routes public paths and validates API keys<\/td><\/tr><tr><td>auth<\/td><td>supabase\/gotrue:v2.196.0<\/td><td>Signup, login, JWT issuance, password recovery, OAuth<\/td><\/tr><tr><td>rest<\/td><td>postgrest\/postgrest:v14.17<\/td><td>REST API generated from the database schema<\/td><\/tr><tr><td>realtime<\/td><td>supabase\/realtime:v2.134.10<\/td><td>WebSocket subscriptions, broadcast, and presence<\/td><\/tr><tr><td>storage<\/td><td>supabase\/storage-api:v1.74.0<\/td><td>File upload and download with row level security on objects<\/td><\/tr><tr><td>imgproxy<\/td><td>darthsim\/imgproxy:v3.31.4<\/td><td>Image transformation for stored objects<\/td><\/tr><tr><td>meta<\/td><td>supabase\/postgres-meta:v0.99.0<\/td><td>Schema introspection API that Studio reads<\/td><\/tr><tr><td>studio<\/td><td>supabase\/studio:2026.09.07-sha-7996410<\/td><td>The dashboard<\/td><\/tr><tr><td>functions<\/td><td>supabase\/edge-runtime:v1.76.2<\/td><td>Deno runtime for edge functions<\/td><\/tr><tr><td>supavisor<\/td><td>supabase\/supavisor:2.9.12<\/td><td>Connection pooler, publishes host ports 5432 and 6543<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Envoy replaced Kong as the default gateway during 2026, and Kong remains available with <code>sh run.sh config add kong<\/code> for deployments carrying custom <code>kong.yml<\/code> routing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this list, four services are optional.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>You can drop <code>functions<\/code> if you have no Deno edge functions, which is common for teams running their own application server.<\/li>\n\n\n\n<li>You can drop <code>storage<\/code> and <code>imgproxy<\/code> together if the application never accepts uploads, since Storage is imgproxy&#8217;s only consumer.<\/li>\n\n\n\n<li>You can drop <code>realtime<\/code> if nothing subscribes to database changes, and confirm that first, because Realtime failures are silent from the client&#8217;s side.<\/li>\n\n\n\n<li>Also, you can treat <code>supavisor<\/code> as mandatory: the <code>db<\/code> service publishes no host ports at all, so the pooler is the only route to Postgres from outside the Docker network.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure to record what you deployed, so that when something breaks in four months the question &#8220;what changed&#8221; has an answer you can diff:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">docker compose config &#8211;images | sort &gt; deployed-images.txt<br>git add deployed-images.txt &amp;&amp; git commit -m &#8220;Record deployed image tags&#8221;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 3: Generate secrets and API keys<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every secret in the shipped <code>.env.example<\/code> is published in a public repository: <code>POSTGRES_PASSWORD<\/code>, <code>JWT_SECRET<\/code>, <code>ANON_KEY<\/code> and <code>SERVICE_ROLE_KEY<\/code> (both signed with that published secret), <code>DASHBOARD_PASSWORD<\/code>, <code>SECRET_KEY_BASE<\/code>, <code>VAULT_ENC_KEY<\/code>, <code>REALTIME_DB_ENC_KEY<\/code>, <code>PG_META_CRYPTO_KEY<\/code>, the two <code>S3_PROTOCOL_*<\/code> values, and both Logflare tokens. A deployment that starts with any of them intact is readable and writable by anyone who has opened the repository.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You can use two scripts in <code>utils\/<\/code> to replace all of them:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">cd \/opt\/supabase\/stack<br>cp .env.example .env<br>sh utils\/generate-keys.sh --update-env<br>sh utils\/add-new-auth-keys.sh --update-env<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first generates fifteen values with <code>openssl rand<\/code> and signs fresh <code>ANON_KEY<\/code> and <code>SERVICE_ROLE_KEY<\/code> tokens against the new <code>JWT_SECRET<\/code>. The second reads that secret back, generates an EC P-256 key pair, and writes <code>JWT_KEYS<\/code> and <code>JWT_JWKS<\/code> alongside opaque <code>SUPABASE_PUBLISHABLE_KEY<\/code> and <code>SUPABASE_SECRET_KEY<\/code> values. Asymmetric signing means the services that verify tokens hold only the public half, so a compromised PostgREST or Storage container cannot mint new ones.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Verify the keys against a running instance, since the generation step only tells you the script completed. The gateway&#8217;s own RBAC rules restrict the bare <code>\/rest\/v1\/<\/code> path to <code>service_role<\/code> and ignore <code>anon<\/code> there entirely, so check the schema with <code>service_role<\/code> and check <code>anon<\/code> against a sub-path instead:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sh run.sh start<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># source .env fails here: STUDIO_DEFAULT_ORGANIZATION and STUDIO_DEFAULT_PROJECT<br># are unquoted multi-word values, and the shell tries to run the second word as a command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">export $(grep -E '^(ANON_KEY|SERVICE_ROLE_KEY)=' .env)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># PostgREST verifies the signature, so a JSON schema description means it validates.<br># Only service_role is allowed on the bare \/rest\/v1\/ route at the gateway level.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s http:\/\/localhost:8000\/rest\/v1\/ -H \"apikey: ${SERVICE_ROLE_KEY}\" | head -c 120<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># A 401 means the anon key&#8217;s signature doesn&#8217;t match JWT_SECRET. A 403 means the<br># gateway rejected the key itself. Anything else, even a 404 for the missing function,<br># means both checks passed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s -o \/dev\/null -w '%{http_code}\\n' \\\nhttp:\/\/localhost:8000\/rest\/v1\/rpc\/ -H \"apikey: ${ANON_KEY}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Decoding the token payload locally shows you the claims and stops there, because the signature check happens inside PostgREST. Run the request.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>service_role<\/code> key bypasses <a href=\"https:\/\/supabase.com\/docs\/guides\/database\/postgres\/row-level-security\" target=\"_blank\" rel=\"noopener\">row level security<\/a> completely, which makes it equivalent to unrestricted database access over HTTP. It belongs in server-side environment variables on machines you control: a backend API, a cron worker, a migration runner. Keep it out of browser bundles, mobile binaries, client components, and any repository more people can read than can already reach the database. The <code>anon<\/code> key is the one that ships to clients, and it is only safe because RLS constrains it, which makes writing policies part of the setup work.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dashboard credentials deserve the same treatment as the database password, because Studio connects as the <code>postgres<\/code> role and exposes a SQL editor. Anyone who reaches the dashboard and logs in has arbitrary query access against your data.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rotating <code>JWT_SECRET<\/code> means re-running <code>generate-keys.sh<\/code> and recreating everything that issues or verifies tokens with <code>sh run.sh recreate --except db imgproxy<\/code>. Every access token issued under the old secret stops validating immediately. Clients holding a valid refresh token recover on their next refresh call, because refresh tokens are opaque rows in <code>auth.refresh_tokens<\/code> and survive the change, so the visible breakage lasts up to <code>JWT_EXPIRY<\/code> seconds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rotating <code>POSTGRES_PASSWORD<\/code> is different, because that value was written into the database at initialization and editing <code>.env<\/code> afterwards changes only what the clients present. Change the roles first:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ALTER ROLE postgres WITH PASSWORD 'new-password';<br>ALTER ROLE supabase_admin WITH PASSWORD 'new-password';<br>ALTER ROLE supabase_auth_admin WITH PASSWORD 'new-password';<br>ALTER ROLE supabase_storage_admin WITH PASSWORD 'new-password';<br>ALTER ROLE authenticator WITH PASSWORD 'new-password';<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Then update <code>.env<\/code> and recreate. Skipping these statements produces authentication failures across every service at once, which step 9 covers.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 4: Reverse proxy and certificates<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The compose file publishes <code>api-gw<\/code> on host port 8000 over plain HTTP. Supabase ships a Caddy override that removes that binding and puts <a href=\"https:\/\/caddyserver.com\/docs\/caddyfile\" target=\"_blank\" rel=\"noopener\">Caddy<\/a> in front on 80 and 443, requesting certificates from <a href=\"https:\/\/letsencrypt.org\/\" target=\"_blank\" rel=\"noopener\">Let&#8217;s Encrypt<\/a> automatically:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sh run.sh config add caddy<br>sh run.sh config<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The resolved list should read <code>docker-compose.yml:docker-compose.caddy.yml<\/code>. The override sets <code>ports: !reset []<\/code> on <code>api-gw<\/code>, so port 8000 disappears from the host entirely.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Point two A records at the server before starting Caddy, since certificate issuance fails against a hostname that does not resolve: <code>api.example.com<\/code> for the API and <code>studio.example.com<\/code> for the dashboard. <code>SITE_URL<\/code> below needs a third domain, but one that resolves to your frontend application rather than this server, so it carries no A record here. Then set the URLs in <code>.env<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">PROXY_DOMAIN=api.example.com<br>SUPABASE_PUBLIC_URL=https:\/\/api.example.com<br>API_EXTERNAL_URL=https:\/\/api.example.com\/auth\/v1<br>SITE_URL=https:\/\/app.example.com<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>SUPABASE_PUBLIC_URL<\/code> is what Studio and Storage use to build absolute URLs, and <code>API_EXTERNAL_URL<\/code> is what GoTrue writes into confirmation emails.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The shipped Caddyfile at <code>volumes\/proxy\/caddy\/Caddyfile<\/code> routes by path, sending a fixed list of API prefixes to the gateway and everything else to Studio behind HTTP basic authentication:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">{$PROXY_DOMAIN} {<br>@supabase_api path \/auth\/v1\/* \/rest\/v1\/* \/graphql\/v1 \/realtime\/v1\/* \/storage\/v1\/* \/functions\/v1\/* \/mcp \/sso\/* \/.well-known\/oauth-authorization-server<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">handle @supabase\\_api {  \n    reverse\\_proxy api-gw:8000  \n}\n\nhandle {  \n    basic\\_auth {  \n        {\\$PROXY\\_AUTH\\_USERNAME} {\\$PROXY\\_AUTH\\_PASSWORD}  \n    }  \n    reverse\\_proxy studio:3000  \n}\n\nheader \\-server  \n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That matcher list is the complete set of paths a Supabase client library needs. Three things stay off the public internet: Postgres on 5432, the transaction pooler on 6543, and Logflare on 4000, which the logs override leaves commented out.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WebSocket upgrades are the step most likely to look fine while Realtime silently fails. Caddy&#8217;s <code>reverse_proxy<\/code> handles the upgrade handshake without configuration. An Nginx deployment needs <code>proxy_set_header Upgrade<\/code> and <code>Connection \"upgrade\"<\/code> set explicitly on the <code>\/realtime\/v1\/<\/code> location, plus a <code>proxy_read_timeout<\/code> well above the 60 second default, since that default closes idle subscriptions and clients reconnect in a loop that reads as network flapping. Leaving the headers out produces an API that answers every REST call correctly while every <code>.subscribe()<\/code> hangs and times out with no server-side error to find.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Request body limits follow the same pattern. Caddy imposes no default limit, so uploads are bounded by Storage&#8217;s own <code>FILE_SIZE_LIMIT<\/code> of 52428800 bytes, or 50 MB. Nginx defaults <code>client_max_body_size<\/code> to 1 MB and returns a bare 413 before Storage sees the request, so set it to match.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Bring the proxy up and confirm the boundaries hold:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sh run.sh recreate<br>curl -sI https:\/\/api.example.com\/rest\/v1\/ -H \"apikey: ${ANON_KEY}\" | head -1<br>curl -s https:\/\/api.example.com\/auth\/v1\/health -H \"apikey: ${ANON_KEY}\"<br>curl -m 5 -sI http:\/\/api.example.com:8000\/ ; echo \"exit: $?\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The last command should time out or refuse. An HTTP response means the override did not apply.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 5: Lock down Studio<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Studio connects as <code>postgres<\/code>, ships a SQL editor, and exposes the user table, the storage browser, and every row in every table. Anyone who reaches it and authenticates has the same access as someone holding the <code>service_role<\/code> key, with a more convenient interface for using it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Rank the three approaches by what they actually protect against. An SSH tunnel is strongest, because it removes the dashboard from the public internet entirely, leaving no login form to brute force and gating access behind the same key that gates the server. An IP allowlist at the proxy is the middle option, working well for teams with static addresses or a VPN with a known egress range and degrading badly when someone needs access from a hotel. HTTP basic authentication is the weakest and the one the stack ships with, putting a single shared password in front of the dashboard with no second factor and no record of who logged in.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use the SSH tunnel. Publish Studio on loopback only. <code>run.sh config add<\/code> only accepts a file that already exists, and setting <code>COMPOSE_FILE<\/code> in <code>.env<\/code> turns off Compose&#8217;s automatic pickup of new override files, so write <code>docker-compose.override.yml<\/code> first and register it second:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">cat &gt; docker-compose.override.yml &lt;&lt;'EOF'<br>services:<br>studio:<br>ports:<br>- \"127.0.0.1:3000:3000\"<br>EOF<br>sh run.sh config add override<br>sh run.sh recreate studio<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Overrides apply left to right, so the resolved list should end with <code>docker-compose.override.yml<\/code>. Every local change from here onward lands in that same file. Registering the override only updates <code>COMPOSE_FILE<\/code> in <code>.env<\/code>, it doesn&#8217;t touch the running container, so without that <code>recreate<\/code> Studio keeps running on whatever ports it already had and nothing is listening on <code>127.0.0.1:3000<\/code> yet.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reach it with <code>ssh -L 3000:127.0.0.1:3000 deploy@api.example.com<\/code> and open <code>http:\/\/localhost:3000<\/code>, then remove the <code>handle<\/code> block from the Caddyfile so the dashboard has no public route at all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When a team genuinely needs browser access from changing locations, fall back to basic authentication on its own hostname so the access rules can differ from the API:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">api.example.com {<br>reverse_proxy api-gw:8000<br>header -server<br>}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">studio.example.com {<br>@allowed remote_ip 203.0.113.10 198.51.100.0\/24<br>handle @allowed {<br>basic_auth {<br>{$PROXY_AUTH_USERNAME} {$PROXY_AUTH_PASSWORD}<br>}<br>reverse_proxy studio:3000<br>}<br>respond 403<br>header -server<br>}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm the dashboard is unreachable from outside your office network before moving on. A 403 from <code>https:\/\/studio.example.com\/<\/code> and connection failures against ports 3000 and 8000 on the server IP is the result you want.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 6: Configure SMTP and auth settings<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The default <code>SMTP_HOST<\/code> is <code>supabase-mail<\/code>, a container the current compose file does not include. GoTrue starts cleanly, reports healthy, accepts signups, and fails every send against a hostname that does not resolve, with the failure appearing only in the auth container&#8217;s logs:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SMTP_HOST=smtp.yourprovider.com<br>SMTP_PORT=587<br>SMTP_USER=your-smtp-username<br>SMTP_PASS=your-smtp-password<br>SMTP_SENDER_NAME=Your Product<br>SMTP_ADMIN_EMAIL=<a href=\"mailto:noreply@example.com\">noreply@example.com<\/a><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Use 587 or 465. UpCloud blocks outbound port 25 by default on new accounts and documents those two as the open alternatives in its <a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/sending-email-smtp-best-practices\/\">SMTP guidance<\/a>, so a configuration pointing at 25 produces connection timeouts that look like a provider outage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two fields cause silent send failures. <code>SMTP_ADMIN_EMAIL<\/code> becomes the From address, and most transactional providers reject any message whose sender is not a verified identity on the account, returning a 550 that GoTrue logs and discards. <code>SMTP_SENDER_NAME<\/code> left empty produces a malformed From header that some providers accept and others reject. Make the admin address one you can receive mail at, because bounce notifications go there.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">GoTrue builds a confirmation link as <code>API_EXTERNAL_URL<\/code> plus <code>MAILER_URLPATHS_CONFIRMATION<\/code>, with the destination passed as a <code>redirect_to<\/code> parameter that must match <code>SITE_URL<\/code> or appear in <code>ADDITIONAL_REDIRECT_URLS<\/code>. Leaving <code>API_EXTERNAL_URL<\/code> at its default sends every user a link beginning <code>http:\/\/localhost:8000<\/code>, which resolves to the recipient&#8217;s own machine. A <code>redirect_to<\/code> value outside the allowlist produces a link that verifies the token correctly and then drops the user on the default page with no session:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">ADDITIONAL_REDIRECT_URLS=https:\/\/app.example.com\/auth\/callback,https:\/\/staging.example.com\/auth\/callback<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Close open signup where the application does not need it. Internal tools and anything where accounts are provisioned by an administrator should set <code>DISABLE_SIGNUP=true<\/code>, which turns off the public endpoint while leaving invites working. Keep <code>ENABLE_EMAIL_AUTOCONFIRM=false<\/code> in any deployment that sends mail, since setting it true marks addresses confirmed without verification.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Default GoTrue emails are plain text with a bare link, which reads as phishing to most recipients and lands in spam more often than a styled message. Point the mailer at your own templates in the override file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">services:<br>auth:<br>environment:<br>GOTRUE_MAILER_SUBJECTS_CONFIRMATION: \"Confirm your email\"<br>GOTRUE_MAILER_TEMPLATES_CONFIRMATION: https:\/\/app.example.com\/email\/confirm.html<br>GOTRUE_MAILER_TEMPLATES_RECOVERY: https:\/\/app.example.com\/email\/recovery.html<br>GOTRUE_MAILER_TEMPLATES_INVITE: https:\/\/app.example.com\/email\/invite.html<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">GoTrue fetches those URLs at send time, so they must be reachable from inside the container and stay reachable. Confirm with <code>docker exec supabase-auth wget -qO- &lt;url&gt;<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Test against a real inbox, since a clean container start and a healthy auth endpoint tell you GoTrue is running and delivery is a separate question:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s -X POST https:\/\/api.example.com\/auth\/v1\/signup \\<br>-H \"apikey: ${ANON_KEY}\" -H \"Content-Type: application\/json\" \\<br>-d '{\"email\":\"<a href=\"mailto:you@yourrealdomain.com\">you@yourrealdomain.com<\/a>\",\"password\":\"a-real-password-here\"}'<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s -X POST https:\/\/api.example.com\/auth\/v1\/recover \\<br>-H \"apikey: ${ANON_KEY}\" -H \"Content-Type: application\/json\" \\<br>-d '{\"email\":\"<a href=\"mailto:you@yourrealdomain.com\">you@yourrealdomain.com<\/a>\"}'<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Open both emails, click both links, and confirm each lands on a page in your application with a session attached. When nothing arrives, <code>sh run.sh logs auth<\/code> carries the provider&#8217;s rejection verbatim, and it is almost always an unverified sender or a rotated credential.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 7: Tune Postgres for the box<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>supabase\/postgres<\/code> image ships a configuration sized for a small container and has no idea how much memory you gave it. Tune against the limit you set in step 8, which is 3 GB for the database on an 8 GB host, leaving the rest for the other ten services and the page cache.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sizing against the host total is the common mistake: <code>shared_buffers<\/code> of 2 GB looks reasonable on an 8 GB box until the container ceiling is 3 GB, at which point Postgres commits two thirds of its budget to buffers before serving a connection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># \/etc\/postgresql-custom\/conf.d\/99-tuning.conf<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># 25% of the container limit. The OS page cache covers the rest.<br>shared_buffers = 768MB<br>effective_cache_size = 2GB<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Allocated per sort or hash node, so one query can use several.<br># 100 connections at 8MB is 800MB worst case, which fits the budget.<br>work_mem = 8MB<br>maintenance_work_mem = 256MB<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># Internal Supabase services hold roughly 40 of these.<br>max_connections = 100<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># MaxIOPS storage is NVMe-backed, so random reads cost close to sequential.<br>random_page_cost = 1.1<br>effective_io_concurrency = 200<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">checkpoint_completion_target = 0.9<br>max_wal_size = 4GB<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Placement is what keeps this file alive across image updates. The image&#8217;s <code>postgresql.conf<\/code> ends with <code>include_dir = '\/etc\/postgresql-custom\/conf.d'<\/code>, and the compose file mounts <code>\/etc\/postgresql-custom<\/code> from a named Docker volume called <code>db-config<\/code>. Anything written there survives container recreation and image tag changes, because the volume outlives both. Files written anywhere else in the image are discarded the moment you pull a new tag.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">docker exec supabase-db mkdir -p \/etc\/postgresql-custom\/conf.d<br>docker cp 99-tuning.conf supabase-db:\/etc\/postgresql-custom\/conf.d\/99-tuning.conf<br>sh run.sh restart db<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Keep a copy in your Git repository, because the volume survives updates and does not survive <code>reset.sh<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Confirm the settings took effect, since a syntax error in an included file makes Postgres fall back to defaults with only a log line to show for it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">SELECT name, setting, source, sourcefile<br>FROM pg_settings<br>WHERE name IN ('shared_buffers', 'work_mem', 'effective_cache_size',<br>'max_connections', 'maintenance_work_mem');<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>sourcefile<\/code> column should read <code>\/etc\/postgresql-custom\/conf.d\/99-tuning.conf<\/code> for every row. A <code>source<\/code> of <code>default<\/code> means the file was not read.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Supavisor publishes two ports that behave differently. Port 5432 forwards session-mode connections through to Postgres, holding one backend per client for the life of the connection. Port 6543 runs transaction mode, returning the backend at the end of each transaction so many clients share a small pool.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The threshold for moving to 6543 is arithmetic on worker count. Supabase&#8217;s internal services hold roughly 40 connections at idle across PostgREST, Storage, Auth, Realtime, Meta, and the pooler itself, leaving about 60 for application traffic. Four workers with a pool of 10 each is 40 connections and fits. Eight workers at 10 is 80 and does not. Transaction mode costs you prepared statements, <code>LISTEN<\/code>\/<code>NOTIFY<\/code>, session-level <code>SET<\/code>, and advisory locks held across statements, so most ORMs need a flag set before they work against it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 8: Resource limits and restart policy<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">None of the eleven services carry a memory limit by default, which means any one of them can consume the whole box. The limits go in the <code>docker-compose.override.yml<\/code> you registered in step 5:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">services:<br>db:<br>deploy:<br>resources:<br>limits:<br>memory: 3G<br>cpus: \"2.0\"<br>realtime:<br>deploy:<br>resources:<br>limits:<br>memory: 1G<br>cpus: \"1.0\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Starting values for the rest on an 8 GB host: 768M for <code>studio<\/code> and <code>supavisor<\/code>, 512M for <code>storage<\/code>, <code>imgproxy<\/code>, and <code>functions<\/code>, and 256M for <code>meta<\/code>, <code>auth<\/code>, <code>rest<\/code>, and <code>api-gw<\/code>. Those totals exceed 8 GB on purpose, because <a href=\"https:\/\/docs.docker.com\/reference\/compose-file\/deploy\/\" target=\"_blank\" rel=\"noopener\">Compose resource limits<\/a> cap what a container can take while reserving none of it up front. The work they do is bounding the blast radius, so a leaking Realtime container gets killed at 1 GB and restarts while Postgres keeps its 3 GB.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Editing the override file doesn&#8217;t touch any running container, so recreate the whole stack once every service has its limit written in:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sh run.sh recreate<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The container that made this concrete on the reference build was <code>analytics<\/code>. Logflare with the Postgres backend grows its working set as log volume grows, and with the logs override enabled and no limit it climbed past 2.5 GB over about a day of moderate traffic, at which point the host went to swap and query latency went with it. Postgres absorbed the damage from a container that has nothing to do with serving queries.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Restart policy needs one adjustment. Every long-running service uses <code>restart: unless-stopped<\/code>, which is correct. Avoid <code>always<\/code>, because it restarts containers when the Docker daemon starts even when you stopped them deliberately, so a reboot silently undoes a service you took out of rotation. One-shot containers need no policy at all, and giving one to the <code>minio-createbucket<\/code> container in the S3 override puts it in a loop.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Docker&#8217;s JSON logging driver has no size limit by default, and a chatty container fills a disk over weeks with nothing in the monitoring until writes start failing. Cap it in <code>\/etc\/docker\/daemon.json<\/code>, then restart the daemon and recreate the stack, since the setting applies to containers created afterwards:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">{<br>\"log-driver\": \"json-file\",<br>\"log-opts\": { \"max-size\": \"50m\", \"max-file\": \"3\" }<br>}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Healthcheck dependencies form a chain worth understanding before you debug the wrong container. <code>api-gw<\/code> declares <code>depends_on: studio: condition: service_healthy<\/code>, so the gateway waits on the dashboard. With the logs override enabled, <code>studio<\/code> declares the same dependency on <code>analytics<\/code>. A Logflare container in a crash loop therefore keeps Studio from becoming healthy, which keeps the gateway from starting, which takes down REST, auth, storage, and realtime for reasons that have nothing to do with any of them. The symptom is a total API outage with every dependent service reporting healthy in <code>docker compose ps<\/code>. Give <code>analytics<\/code> a hard memory limit so it restarts before the host reaches swap, and if you do not read logs through Studio, leave the logs override off entirely.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Step 9: Bring it up and verify<\/strong><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">sh run.sh start<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That runs <code>docker compose up -d --wait<\/code>, which blocks until every healthcheck passes. Four containers legitimately take time on a cold start. <code>db<\/code> runs its initialization scripts on first boot and can take 60 seconds before <code>pg_isready<\/code> succeeds. <code>supavisor<\/code> has a 30 second start period and runs Ecto migrations against the <code>_supabase<\/code> database before it answers. <code>realtime<\/code> needs about 10 seconds plus its own tenant migration, and <code>studio<\/code> has a 20 second start period while Next.js warms up. Two to three minutes is normal, and anything past five means something is failing, so go read the logs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Three failures accounted for most of the trouble on the reference build:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Authentication errors across several services at once, with <code>supabase-auth<\/code>, <code>supabase-storage<\/code>, and <code>supabase-pooler<\/code> all logging <code>password authentication failed for user<\/code>, mean <code>POSTGRES_PASSWORD<\/code> changed in <code>.env<\/code> after the data directory already existed. Fix with the <code>ALTER ROLE<\/code> statements from step 3, or delete <code>volumes\/db\/data<\/code> and start over if there is no data worth keeping.<\/li>\n\n\n\n<li><code>supabase-pooler<\/code> restarting in a loop with an error about the <code>_supabase<\/code> database means it started against a data directory created before <code>volumes\/db\/_supabase.sql<\/code> was mounted. <code>sh run.sh recreate db<\/code> re-runs the mounted migrations.<\/li>\n\n\n\n<li><code>supabase-envoy<\/code> never starting while everything else looks fine points at Studio, because the dependency runs in that direction. Check <code>sh run.sh logs studio<\/code> before touching the gateway.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Work through the checklist once the stack is healthy. For the row level security items, create a table with RLS enabled and one row in it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">CREATE TABLE notes (id serial PRIMARY KEY, body text);<br>ALTER TABLE notes ENABLE ROW LEVEL SECURITY;<br>INSERT INTO notes (body) VALUES ('rls test row');<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># grep, not source .env: STUDIO_DEFAULT_ORGANIZATION and STUDIO_DEFAULT_PROJECT<br># are unquoted multi-word values that break a plain source<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">export $(grep -E '^(ANON_KEY|SERVICE_ROLE_KEY)=' .env)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># 1. HTTPS API responds with a valid certificate<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -sI https:\/\/api.example.com\/rest\/v1\/ -H \"apikey: ${ANON_KEY}\" | head -1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># 2. Auth healthy through the proxy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s https:\/\/api.example.com\/auth\/v1\/health -H \"apikey: ${ANON_KEY}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># 3. anon key respects RLS: expect an empty array<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s \"https:\/\/api.example.com\/rest\/v1\/notes?select=*\" \\\n-H \"apikey: ${ANON_KEY}\" -H \"Authorization: Bearer ${ANON_KEY}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># 4. service_role key bypasses RLS: expect the row<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s \"https:\/\/api.example.com\/rest\/v1\/notes?select=*\" \\\n-H \"apikey: ${SERVICE_ROLE_KEY}\" -H \"Authorization: Bearer ${SERVICE_ROLE_KEY}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"># 5. Auth email delivered: run the signup from step 6 and open the inbox<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"># 6. Storage upload and retrieval<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">curl -s -X POST https:\/\/api.example.com\/storage\/v1\/bucket \\\n-H \"Authorization: Bearer ${SERVICE_ROLE_KEY}\" -H \"Content-Type: application\/json\" \\\n-d '{\"id\":\"testbucket\",\"name\":\"testbucket\",\"public\":false}'\necho \"upload test\" &gt; \/tmp\/test.txt\ncurl -s -X POST https:\/\/api.example.com\/storage\/v1\/object\/testbucket\/test.txt \\\n-H \"Authorization: Bearer ${SERVICE_ROLE_KEY}\" --data-binary @\/tmp\/test.txt\ncurl -s https:\/\/api.example.com\/storage\/v1\/object\/testbucket\/test.txt \\\n-H \"Authorization: Bearer ${SERVICE_ROLE_KEY}\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">An empty array from item 3 and the row from item 4 confirms both your policies and your key derivation. The same row from both means RLS is disabled on the table and every anon request can read everything. Item 6 should print <code>upload test<\/code>, and a 413 means the proxy body limit from step 4 needs raising.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Realtime is the last item and needs a real client, because a curl against the WebSocket endpoint only confirms the port is open:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">\/\/ npm install @supabase\/supabase-js &amp;&amp; node verify-realtime.mjs<br>import { createClient } from '@supabase\/supabase-js'<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">const supabase = createClient('https:\/\/api.example.com', process.env.ANON_KEY)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">supabase.channel('verify')<br>.on('postgres_changes',<br>{ event: 'INSERT', schema: 'public', table: 'notes' },<br>(payload) =&gt; { console.log('received:', payload.new); process.exit(0) })<br>.subscribe((status) =&gt; console.log('channel status:', status))<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">setTimeout(() =&gt; {<br>console.error('no event in 30s: check the WebSocket upgrade path')<br>process.exit(1)<br>}, 30000)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Run it, then insert a row into <code>notes<\/code>. A <code>SUBSCRIBED<\/code> status followed by the payload means the upgrade path, the publication, and the token all work. <code>SUBSCRIBED<\/code> with no payload means the table is missing from the publication, which you fix with <code>ALTER PUBLICATION supabase_realtime ADD TABLE notes;<\/code>. A status that never reaches <code>SUBSCRIBED<\/code> points at the proxy&#8217;s WebSocket handling.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Passing all seven items is the point at which the install is real. Up to here you have a stack that starts, and starting is a much lower bar than working.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion: What comes next<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">You now own a database server. That is the accurate description of what the last nine steps produced, and it carries obligations that arrive on their own schedule:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>OS patching, including kernel and Docker updates, with a reboot cadence for the fixes that cannot be applied live<\/li>\n\n\n\n<li>Disk and memory watched by something that alerts, because the failure modes in step 8 are gradual and invisible until they are total<\/li>\n\n\n\n<li>Certificate renewals, which Caddy handles automatically and which fail silently when DNS changes or a firewall rule blocks the ACME challenge. Alert on expiry, since a successful renewal is the thing you never need to hear about<\/li>\n\n\n\n<li>Postgres backups, which nothing in this stack does for you. Run <code>pg_dump<\/code> on a schedule to storage in a different account, and perform at least one restore before you need it<\/li>\n\n\n\n<li>Upstream releases, which is the obligation people underestimate<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">That last one is monthly work. Supabase publishes image updates to the self-hosting compose file roughly every month, and those updates carry the security fixes for GoTrue, PostgREST, Storage, Postgres, and Envoy. The hosted platform applies them for you. Here, somebody runs <code>sh update.sh --dry-run<\/code>, reads the breaking-change gate, takes a snapshot, runs <code>sh update.sh<\/code> followed by <code>sh run.sh pull &amp;&amp; sh run.sh recreate<\/code>, and re-runs the step 9 checklist afterwards. The update script backs up configuration to <code>backups\/pre-update-*.tgz<\/code> and explicitly does not back up Postgres or Storage data, so the snapshot is on you.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Against the hosted product, the trade is specific enough to state plainly. Supabase <a href=\"https:\/\/supabase.com\/pricing\" target=\"_blank\" rel=\"noopener\">Pro<\/a> is $25\/month including $10 of compute credit, covering a Micro instance with 8 GB of database storage and 250 GB of egress. A <code>PREMIUM-4xCPU-8GB<\/code> Cloud Server gives you four cores, 8 GB of RAM, and 100 GB of MaxIOPS storage, with zero-cost egress. On raw resources per euro the self-hosted box wins comfortably. What you gave up is branching, managed point-in-time recovery, the platform management API, advanced metrics, and a team at Supabase who notices when the database is unhealthy at three in the morning. What you gained is a machine you control and a database whose size is bounded by a disk you can resize.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Two situations make self-hosting clearly correct. The first is a data residency or regulatory requirement dictating which jurisdiction and which infrastructure your data sits on, where the hosted product&#8217;s region list either satisfies it or does not. The second is running at a scale where hosted compute pricing has stopped making sense, which is a real threshold given that Supabase compute runs from $10\/month for Micro to $3,730\/month for a 16XL instance. Everyone outside those two is choosing self-hosting for other reasons, usually cost at small scale, where the saving is real and smaller than the time it costs to maintain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That is the point to end on. This install is a machine somebody has to look after, and the difference between a self-hosted Supabase stack that runs for two years and one that dies in four months is whether that somebody has a name, time allocated, and a calendar reminder for the monthly update. Decide who that is before the first user signs up.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If your application eventually outgrows a single VPS or requires higher availability, you can also <a href=\"https:\/\/upcloud.com\/global\/docs\/guides\/deploy-supabase-managed-kubernetes\/\">deploy Supabase on Kubernetes<\/a> using UpCloud&#8217;s Managed Kubernetes and Managed Object Storage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"author":82,"featured_media":0,"comment_status":"open","ping_status":"closed","template":"","community-category":[226,241,223,253],"class_list":["post-11703","tutorial","type-tutorial","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/11703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/types\/tutorial"}],"author":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/users\/82"}],"replies":[{"embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/comments?post=11703"}],"version-history":[{"count":3,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/11703\/revisions"}],"predecessor-version":[{"id":11708,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/tutorial\/11703\/revisions\/11708"}],"wp:attachment":[{"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/media?parent=11703"}],"wp:term":[{"taxonomy":"community-category","embeddable":true,"href":"https:\/\/upcloud.com\/global\/wp-json\/wp\/v2\/community-category?post=11703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}