From 885f5deebebbf6cd0f2352ed58d03b3cfac594cd Mon Sep 17 00:00:00 2001 From: pablohashescobar <118773738+pablohashescobar@users.noreply.github.com> Date: Fri, 16 Jun 2023 18:58:08 +0530 Subject: [PATCH] chore: update docker setup to mount env file (#1270) --- .env.example | 6 ++++++ docker-compose-hub.yml | 27 ++++++++++++++++++++++----- docker-compose.yml | 22 +++++++++++++++++++++- 3 files changed, 49 insertions(+), 6 deletions(-) diff --git a/.env.example b/.env.example index 578aa0fa4..f8c15a1cb 100644 --- a/.env.example +++ b/.env.example @@ -27,6 +27,12 @@ PGUSER="plane" PGPASSWORD="plane" PGHOST="plane-db" PGDATABASE="plane" +DATABASE_URL=postgresql://${PGUSER}:${PGPASSWORD}@${PGHOST}/${PGDATABASE} + +# Redis Settings +REDIS_HOST="plane-redis" +REDIS_PORT="6379" +REDIS_URL="redis://${REDIS_HOST}:6379/" # Email Settings EMAIL_HOST="" diff --git a/docker-compose-hub.yml b/docker-compose-hub.yml index f259f6391..bc476a6b1 100644 --- a/docker-compose-hub.yml +++ b/docker-compose-hub.yml @@ -6,6 +6,8 @@ services: image: makeplane/plane-frontend:latest restart: always command: /usr/local/bin/start.sh + env_file: + - .env environment: NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL} NEXT_PUBLIC_GOOGLE_CLIENTID: 0 @@ -14,12 +16,17 @@ services: NEXT_PUBLIC_SENTRY_DSN: 0 NEXT_PUBLIC_ENABLE_OAUTH: 0 NEXT_PUBLIC_ENABLE_SENTRY: 0 + depends_on: + - plane-api + - plane-worker plane-api: container_name: planebackend image: makeplane/plane-backend:latest restart: always command: ./bin/takeoff + env_file: + - .env environment: DJANGO_SETTINGS_MODULE: plane.settings.production DATABASE_URL: postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:5432/${PGDATABASE} @@ -54,6 +61,8 @@ services: image: makeplane/plane-worker:latest restart: always command: ./bin/worker + env_file: + - .env environment: DJANGO_SETTINGS_MODULE: plane.settings.production DATABASE_URL: postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:5432/${PGDATABASE} @@ -89,6 +98,8 @@ services: image: postgres:15.2-alpine restart: always command: postgres -c 'max_connections=1000' + env_file: + - .env environment: POSTGRES_USER: ${PGUSER} POSTGRES_DB: ${PGDATABASE} @@ -108,15 +119,15 @@ services: image: minio/minio volumes: - uploads:/export + command: server /export --console-address ":9090" + env_file: + - .env environment: MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID} MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY} - command: server /export --console-address ":9090" createbuckets: image: minio/mc - depends_on: - - plane-minio entrypoint: > /bin/sh -c " /usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY; @@ -124,6 +135,10 @@ services: /usr/bin/mc anonymous set download plane-minio/\$AWS_S3_BUCKET_NAME; exit 0; " + env_file: + - .env + depends_on: + - plane-minio # Comment this if you already have a reverse proxy running plane-proxy: @@ -131,12 +146,14 @@ services: image: makeplane/plane-proxy:latest ports: - ${NGINX_PORT}:80 + env_file: + - .env environment: FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880} BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads} depends_on: - - plane-web - - plane-api + - plane-web + - plane-api volumes: diff --git a/docker-compose.yml b/docker-compose.yml index da275a1fb..df8c239e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,6 +10,8 @@ services: NEXT_PUBLIC_API_BASE_URL: http://localhost:8000 restart: always command: [ "/usr/local/bin/start.sh" ] + env_file: + - .env environment: NEXT_PUBLIC_API_BASE_URL: ${NEXT_PUBLIC_API_BASE_URL} NEXT_PUBLIC_GOOGLE_CLIENTID: "0" @@ -20,6 +22,10 @@ services: NEXT_PUBLIC_ENABLE_SENTRY: "0" NEXT_PUBLIC_ENABLE_SESSION_RECORDER: "0" NEXT_PUBLIC_TRACK_EVENTS: "0" + depends_on: + - plane-api + - plane-worker + plane-api: container_name: planebackend @@ -28,6 +34,8 @@ services: dockerfile: Dockerfile.api restart: always command: ./bin/takeoff + env_file: + - .env environment: DJANGO_SETTINGS_MODULE: plane.settings.production DATABASE_URL: postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:5432/${PGDATABASE} @@ -67,6 +75,8 @@ services: dockerfile: Dockerfile.api restart: always command: ./bin/worker + env_file: + - .env environment: DJANGO_SETTINGS_MODULE: plane.settings.production DATABASE_URL: postgres://${PGUSER}:${PGPASSWORD}@${PGHOST}:5432/${PGDATABASE} @@ -107,6 +117,8 @@ services: command: postgres -c 'max_connections=1000' volumes: - pgdata:/var/lib/postgresql/data + env_file: + - .env environment: POSTGRES_USER: ${PGUSER} POSTGRES_DB: ${PGDATABASE} @@ -127,6 +139,8 @@ services: command: server /export --console-address ":9090" volumes: - uploads:/export + env_file: + - .env environment: MINIO_ROOT_USER: ${AWS_ACCESS_KEY_ID} MINIO_ROOT_PASSWORD: ${AWS_SECRET_ACCESS_KEY} @@ -134,7 +148,11 @@ services: createbuckets: image: minio/mc entrypoint: > - /bin/sh -c " /usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY; /usr/bin/mc mb plane-minio/\$AWS_S3_BUCKET_NAME; /usr/bin/mc anonymous set download plane-minio/\$AWS_S3_BUCKET_NAME; exit 0; " + /bin/sh -c " /usr/bin/mc config host add plane-minio http://plane-minio:9000 \$AWS_ACCESS_KEY_ID \$AWS_SECRET_ACCESS_KEY; + /usr/bin/mc mb plane-minio/\$AWS_S3_BUCKET_NAME; + /usr/bin/mc anonymous set download plane-minio/\$AWS_S3_BUCKET_NAME; exit 0; " + env_file: + - .env depends_on: - plane-minio @@ -146,6 +164,8 @@ services: restart: always ports: - ${NGINX_PORT}:80 + env_file: + - .env environment: FILE_SIZE_LIMIT: ${FILE_SIZE_LIMIT:-5242880} BUCKET_NAME: ${AWS_S3_BUCKET_NAME:-uploads}