Skip to content

Commit

Permalink
fix: docker compose
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Jan 16, 2024
1 parent 3d502df commit 4834b70
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .env.template
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
APP_PORT=3001
APP_ENV=development

DB_URL=postgres://root:root@localhost:5432/johnjud_db

SERVICE_AUTH=localhost:3002
SERVICE_BACKEND=localhost:3003
SERVICE_FILE=localhost:3004
119 changes: 119 additions & 0 deletions docker-compose-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
version: "3.9"

services:
gateway:
container_name: johnjud-gateway
restart: unless-stopped
build: .
ports:
- 3001:3001
environment:
- APP_PORT=3001
- APP_ENV=development
- SERVICE_AUTH=auth:3002
- SERVICE_BACKEND=backend:3003
- SERVICE_FILE=file:3004
networks:
- johnjud
local-auth:
image: ghcr.io/isd-sgcu/johnjud-auth
container_name: auth
depends_on:
- local-db
- local-cache
restart: unless-stopped
environment:
- APP_PORT=3004
- APP_ENV=production
- APP_SECRET=secret
- DB_URL=postgres://root:root@johnjud-local-db:5432/johnjud_db
- JWT_SECRET=secret
- JWT_EXPIRES_IN=3600
- JWT_REFRESH_TOKEN_TTL=604800
- JWT_ISSUER=issuer
- JWT_RESET_TOKEN_TTL=900
- REDIS_HOST=localhost
- REDIS_PORT=6379
- REDIS_PASSWORD=
- AUTH_CLIENT_URL=http://localhost:3000
- SENDGRID_API_KEY=api_key
- SENDGRID_NAME=johnjud
- SENDGRID_ADDRESS=johnjud@gmail.com
networks:
- johnjud-local
- database
ports:
- "3002:3002"

local-backend:
image: ghcr.io/isd-sgcu/johnjud-backend
container_name: backend
depends_on:
- local-db
- local-cache
restart: unless-stopped
environment:
- APP_PORT=3003
- APP_ENV=production
- DB_URL=postgres://root:root@johnjud-local-db:5432/johnjud_db
- SERVICE_FILE=file:3004
networks:
- johnjud-local
- database
ports:
- "3003:3003"

local-file:
image: ghcr.io/isd-sgcu/johnjud-file
container_name: file
depends_on:
- local-db
- local-cache
restart: unless-stopped
environment:
- APP_PORT=3004
- APP_ENV=production
- DB_URL=postgres://root:root@johnjud-local-db:5432/johnjud_db
- BUCKET_ENDPOINT=BUCKET_ENDPOINT
- BUCKET_ACCESS_KEY=BUCKET_ACCESS_KEY
- BUCKET_SECRET_KEY=BUCKET_SECRET_KEY
- BUCKET_NAME=johnjud-pet-images
- BUCKET_USE_SSL=false
networks:
- johnjud-local
- database
ports:
- "3004:3004"

local-db:
image: postgres:15.1-alpine3.17
container_name: local-db
restart: unless-stopped
environment:
POSTGRES_USER: root
POSTGRES_PASSWORD: root
POSTGRES_DB: johnjud_db
networks:
- database
volumes:
- ./volumes/postgres:/var/lib/postgresql/data
ports:
- "5432:5432"

local-cache:
image: redis:7.2.3-alpine
container_name: local-cache
restart: unless-stopped
environment:
REDIS_HOST: localhost
ALLOW_EMPTY_PASSWORD: "yes"
networks:
- database
ports:
- "6379:6379"

networks:
johnjud-local:
name: johnjud-local
database:
name: database
37 changes: 31 additions & 6 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,26 @@ services:
- local-db
- local-cache
restart: unless-stopped
environment:
- APP_PORT=3004
- APP_ENV=development
- APP_SECRET=secret
- DB_URL=postgres://root:root@johnjud-local-db:5432/johnjud_db
- JWT_SECRET=secret
- JWT_EXPIRES_IN=3600
- JWT_REFRESH_TOKEN_TTL=604800
- JWT_ISSUER=issuer
- JWT_RESET_TOKEN_TTL=900
- REDIS_HOST=localhost
- REDIS_PORT=6379
- REDIS_PASSWORD=
- AUTH_CLIENT_URL=http://localhost:3000
- SENDGRID_API_KEY=api_key
- SENDGRID_NAME=johnjud
- SENDGRID_ADDRESS=johnjud@gmail.com
networks:
- johnjud-local
- database
volumes:
- ./config/auth:/app/config
ports:
- "3002:3002"

Expand All @@ -23,11 +38,14 @@ services:
- local-db
- local-cache
restart: unless-stopped
environment:
- APP_PORT=3003
- APP_ENV=development
- DB_URL=postgres://root:root@johnjud-local-db:5432/johnjud_db
- SERVICE_FILE=file:3004
networks:
- johnjud-local
- database
volumes:
- ./config/backend:/app/config
ports:
- "3003:3003"

Expand All @@ -38,11 +56,18 @@ services:
- local-db
- local-cache
restart: unless-stopped
environment:
- APP_PORT=3004
- APP_ENV=production
- DB_URL=postgres://root:root@johnjud-local-db:5432/johnjud_db
- BUCKET_ENDPOINT=BUCKET_ENDPOINT
- BUCKET_ACCESS_KEY=BUCKET_ACCESS_KEY
- BUCKET_SECRET_KEY=BUCKET_SECRET_KEY
- BUCKET_NAME=johnjud-pet-images
- BUCKET_USE_SSL=false
networks:
- johnjud-local
- database
volumes:
- ./config/file:/app/config
ports:
- "3004:3004"

Expand Down

0 comments on commit 4834b70

Please sign in to comment.