This is a minimal Docker Compose setup for self-hosting Supabase. Follow the steps here to get started.
- Run
./backup.sh [DATABASE_URL]to generate dumps.
Example:./backup.sh postgresql://postgres:PASSWORD@HOST:5432/postgres - The script writes three timestamped files under
dump/: roles, schema and data. - Alternatively, run
docker compose run --rm backupto execute the same script inside thesupabase-backupservice. The generated files are still written to thedump/directory on the host.
- Copy each dump into the
supabase-dbcontainer:sudo docker cp path/to/schema.sql supabase-db:/schema.sqlsudo docker cp path/to/roles.sql supabase-db:/roles.sqlsudo docker cp path/to/data.sql supabase-db:/data.sql
- Execute the SQL files (schema → roles → data):
sudo docker exec -it supabase-db psql -U postgres -W postgres -f /schema.sqlsudo docker exec -it supabase-db psql -U postgres -W postgres -f /roles.sqlsudo docker exec -it supabase-db psql -U postgres -W postgres -f /data.sql