Skip to content

Commit

Permalink
fix: restore dev compose
Browse files Browse the repository at this point in the history
  • Loading branch information
ManasC478 committed Oct 1, 2024
1 parent 17f1f1a commit 13eb745
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 54 deletions.
5 changes: 2 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_HOST=postgres
POSTGRES_HOST=acm_website
POSTGRES_DB=acm_website

PORT=5001
PORT=5001
57 changes: 6 additions & 51 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,82 +1,37 @@
services:
nginx:
image: nginx:latest
ports:
- 8080:8080
configs:
- source: nginx_config
target: /etc/nginx/nginx.conf
networks:
- public
depends_on:
server:
condition: service_healthy
restart: true

server:
build:
context: ./server
dockerfile: Dockerfile.dev
# ports:
# - 5001:5001
ports:
- "5001:5001"
volumes:
- ./server:/app
- /app/node_modules
environment:
- NODE_ENV=development
env_file:
- .env
networks:
- private
- public
depends_on:
db:
condition: service_healthy
restart: true
healthcheck:
test: ["CMD", "curl", "-f", "http://server:5001"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s

db:
image: postgres:latest
# ports:
# - "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_DB: acm_website
POSTGRES_PASSWORD_FILE: /run/secrets/pg_password
ports:
- "5432:5432"
env_file:
- .env
volumes:
- acm_website_db_data:/var/lib/postgresql/data
- ./db-scripts:/docker-entrypoint-initdb.d/
secrets:
- pg_password
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 5s
timeout: 5s
retries: 5
start_period: 15s
networks:
- private

volumes:
acm_website_db_data:

networks:
public:
private:
ipam:
config:
- subnet: "192.0.0.0/24"
gateway: "192.0.0.1"

configs:
nginx_config:
file: ./nginx.conf

secrets:
pg_password:
file: ./pg_password.txt
80 changes: 80 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
services:
nginx:
image: nginx:latest
ports:
- 8080:8080
configs:
- source: nginx_config
target: /etc/nginx/nginx.conf
networks:
- public
depends_on:
server:
condition: service_healthy
restart: true

server:
build:
context: ./server
dockerfile: Dockerfile.dev
volumes:
- ./server:/app
- /app/node_modules
environment:
- NODE_ENV=development
env_file:
- .env
networks:
- private
- public
depends_on:
db:
condition: service_healthy
restart: true
healthcheck:
test: ["CMD", "curl", "-f", "http://server:5001"]
interval: 5s
retries: 5
start_period: 5s
timeout: 5s

db:
image: postgres:latest
# ports:
# - "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_DB: acm_website
POSTGRES_PASSWORD_FILE: /run/secrets/pg_password
volumes:
- acm_website_db_data:/var/lib/postgresql/data
- ./db-scripts:/docker-entrypoint-initdb.d/
secrets:
- pg_password
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
interval: 5s
timeout: 5s
retries: 5
start_period: 15s
networks:
- private

volumes:
acm_website_db_data:

networks:
public:
private:
ipam:
config:
- subnet: "192.0.0.0/24"
gateway: "192.0.0.1"

configs:
nginx_config:
file: ./nginx.conf

secrets:
pg_password:
file: ./pg_password.txt

0 comments on commit 13eb745

Please sign in to comment.