From 9d86ea70f1445a691cd22a72220a022222a6fced Mon Sep 17 00:00:00 2001 From: Tue Nguyen <58532267+TueeNguyen@users.noreply.github.com> Date: Thu, 31 Mar 2022 09:17:46 -0400 Subject: [PATCH] Modify docker-compose for Supabase in dev/prod (#3368) --- config/env.development | 2 +- config/env.production | 2 +- config/env.staging | 2 +- docker/supabase/docker-compose.yml | 21 ++------------------- docker/supabase/supabase-development.yml | 19 +++++++++++++++++++ docker/supabase/supabase-production.yml | 10 ++++++++++ 6 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 docker/supabase/supabase-development.yml create mode 100644 docker/supabase/supabase-production.yml diff --git a/config/env.development b/config/env.development index e654a443f2..a433025b3e 100644 --- a/config/env.development +++ b/config/env.development @@ -15,7 +15,7 @@ DOCKER_BUILDKIT=1 # so it will work on Windows and Unix, see # https://docs.docker.com/compose/reference/envvars/#compose_file COMPOSE_PATH_SEPARATOR=; -COMPOSE_FILE=docker/docker-compose.yml;docker/development.yml;docker/supabase/docker-compose.yml +COMPOSE_FILE=docker/docker-compose.yml;docker/development.yml;docker/supabase/docker-compose.yml;docker/supabase/supabase-development.yml # The host where the Telescope 1.0 front-end and back-end are run. diff --git a/config/env.production b/config/env.production index be89d85bac..1e576d2b59 100644 --- a/config/env.production +++ b/config/env.production @@ -15,7 +15,7 @@ DOCKER_BUILDKIT=1 # so it will work on Windows and Unix, see # https://docs.docker.com/compose/reference/envvars/#compose_file COMPOSE_PATH_SEPARATOR=; -COMPOSE_FILE=docker/docker-compose.yml;docker/production.yml +COMPOSE_FILE=docker/docker-compose.yml;docker/production.yml;docker/supabase/docker-compose.yml;docker/supabase/supabase-production.yml # The host where the Telescope 1.0 front-end and back-end are run. diff --git a/config/env.staging b/config/env.staging index ccb4e07885..3b7789d52f 100644 --- a/config/env.staging +++ b/config/env.staging @@ -15,7 +15,7 @@ DOCKER_BUILDKIT=1 # so it will work on Windows and Unix, see # https://docs.docker.com/compose/reference/envvars/#compose_file COMPOSE_PATH_SEPARATOR=; -COMPOSE_FILE=docker/docker-compose.yml;docker/production.yml +COMPOSE_FILE=docker/docker-compose.yml;docker/production.yml;docker/supabase/docker-compose.yml;docker/supabase/supabase-production.yml # The host where the Telescope 1.0 front-end and back-end are run. diff --git a/docker/supabase/docker-compose.yml b/docker/supabase/docker-compose.yml index f0275854a8..75e387feae 100644 --- a/docker/supabase/docker-compose.yml +++ b/docker/supabase/docker-compose.yml @@ -1,18 +1,11 @@ -# Usage -# Start: docker-compose up -# With helpers: docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml up -# Stop: docker-compose down -# Destroy: docker-compose -f docker-compose.yml -f ./dev/docker-compose.dev.yml down -v --remove-orphans - -version: '3.8' +# This is the main Supabase container definition, and is meant to +# be run with one of supabase-development.yml or supabase-production.yml. services: studio: container_name: supabase-studio image: supabase/studio:latest restart: unless-stopped - ports: - - ${STUDIO_PORT}:3000/tcp environment: SUPABASE_URL: http://kong:8000 STUDIO_PG_META_URL: http://meta:8080 @@ -140,8 +133,6 @@ services: # TODO: https://github.com/supabase/storage-api/issues/55 REGION: stub GLOBAL_S3_BUCKET: stub - volumes: - - ./supabase/volumes/storage:/var/lib/storage meta: container_name: supabase-meta @@ -159,13 +150,5 @@ services: image: supabase/postgres:14.1.0 command: postgres -c config_file=/etc/postgresql/postgresql.conf restart: unless-stopped - ports: - # XXX: we need access to the postgres port on localhost for our e2e tests in dev, - # since they need to wait on the postgres db to become ready before starting. - # See src/api/sso/jest.config.e2e.js - - '5432:5432' environment: POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - volumes: - # - ./supbase/volumes/db/data:/var/lib/postgresql/data - - ./supabase/volumes/db/init:/docker-entrypoint-initdb.d diff --git a/docker/supabase/supabase-development.yml b/docker/supabase/supabase-development.yml new file mode 100644 index 0000000000..bd18faf655 --- /dev/null +++ b/docker/supabase/supabase-development.yml @@ -0,0 +1,19 @@ +# This is meant to be used with ./docker-compose.yml in development +services: + studio: + ports: + - ${STUDIO_PORT}:3000/tcp + + storage: + volumes: + - ./supabase/volumes/storage:/var/lib/storage + + db: + ports: + # XXX: we need access to the postgres port on localhost for our e2e tests in dev, + # since they need to wait on the postgres db to become ready before starting. + # See src/api/sso/jest.config.e2e.js + - '5432:5432' + volumes: + - ./supabase/volumes/db/data:/var/lib/postgresql/data + - ./supabase/volumes/db/init:/docker-entrypoint-initdb.d diff --git a/docker/supabase/supabase-production.yml b/docker/supabase/supabase-production.yml new file mode 100644 index 0000000000..a9c7bab103 --- /dev/null +++ b/docker/supabase/supabase-production.yml @@ -0,0 +1,10 @@ +# This is meant to be used with ./docker-compose.yml in production +services: + storage: + volumes: + - ../../../supabase/volumes/storage:/var/lib/storage + + db: + volumes: + - ../../../supabase/volumes/db/data:/var/lib/postgresql/data + - ./supabase/volumes/db/init:/docker-entrypoint-initdb.d