Skip to content

Commit

Permalink
fix(self-hosted): self hosted docker compose (#30674)
Browse files Browse the repository at this point in the history
* fix(self-host): ensure migrations connect back to postgres database

* fix(self-host): use supabase_admin user for supavisor pooler

* fix(self-host): services healthchecks

* fix(self-host): vector config path

* feat(ci): add smoke test for self-hosted stack

---------

Co-authored-by: Shawal Mbalire <mbalireshawal@gmail.com>
Co-authored-by: Robson Martins <robson@controle.digital>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent 49608fd commit 419eba9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/self-host-tests-smoke.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Self-Host Tests Smoke

on:
pull_request:
branches: ['master']
paths:
- 'docker/**/*'

# Cancel old builds on new commit for same workflow + branch/PR
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
sparse-checkout: |
docker/
- name: Run docker-compose up
# Ensure all services can be started and healthy with default config
run: cd docker && cp .env.example .env && docker compose up --wait
10 changes: 5 additions & 5 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ services:
"CMD",
"node",
"-e",
"require('http').get('http://localhost:3000/api/profile', (r) => {if (r.statusCode !== 200) throw new Error(r.statusCode)})"
"fetch('http://studio:3000/api/profile').then((r) => {if (r.status !== 200) throw new Error(r.status)})"
]
timeout: 5s
timeout: 10s
interval: 5s
retries: 3
depends_on:
Expand Down Expand Up @@ -246,7 +246,7 @@ services:
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:5000/status"
"http://storage:5000/status"
]
timeout: 5s
interval: 5s
Expand Down Expand Up @@ -438,7 +438,7 @@ services:
- ${DOCKER_SOCKET_LOCATION}:/var/run/docker.sock:ro
environment:
LOGFLARE_API_KEY: ${LOGFLARE_API_KEY}
command: [ "--config", "etc/vector/vector.yml" ]
command: [ "--config", "/etc/vector/vector.yml" ]

# Update the DATABASE_URL if you are using an external Postgres database
supavisor:
Expand Down Expand Up @@ -467,7 +467,7 @@ services:
- POSTGRES_PORT=${POSTGRES_PORT}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- DATABASE_URL=ecto://postgres:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/_supabase
- DATABASE_URL=ecto://supabase_admin:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/_supabase
- CLUSTER_POSTGRES=true
- SECRET_KEY_BASE=UpNVntn3cDxHJpq99YMc1T1AQgQpc8kfYTuRgBiYa15BLrx8etQoXz3gZv1/u2oq
- VAULT_ENC_KEY=your-encryption-key-32-chars-min
Expand Down
1 change: 1 addition & 0 deletions docker/volumes/db/logs.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
\c _supabase
create schema if not exists _analytics;
alter schema _analytics owner to :pguser;
\c postgres
1 change: 1 addition & 0 deletions docker/volumes/db/pooler.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
\c _supabase
create schema if not exists _supavisor;
alter schema _supavisor owner to :pguser;
\c postgres

2 comments on commit 419eba9

@Illusionist0
Copy link

Choose a reason for hiding this comment

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

So, the correct user for supavisor pooler is supabase_admin,right?

@riccardolardi
Copy link

Choose a reason for hiding this comment

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

So, the correct user for supavisor pooler is supabase_admin,right?

Yes, fixes ab13a1e#commitcomment-149483539

Please sign in to comment.