From dda2151b5c552cdfbdde03c83c90e61072fded19 Mon Sep 17 00:00:00 2001 From: Verum Date: Wed, 18 Mar 2026 14:43:20 +0700 Subject: [PATCH] 0.3 --- docker-compose.yml | 42 ++++++++++++++++++++++++++++++++++++------ index.html | 2 +- server.js | 2 +- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 1c72c4e..5b20be0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,23 +1,53 @@ services: - postgres: + db: image: postgres:16 + container_name: app_postgres + restart: unless-stopped + environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: testdb + ports: - "5432:5432" - volumes: - - pg_data:/var/lib/postgresql/data - app: + volumes: + - postgres_data:/var/lib/postgresql/data + + networks: + - app_network + + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 5s + timeout: 5s + retries: 5 + + + backend: build: . + container_name: app_backend + restart: unless-stopped + ports: - "3000:3000" + env_file: - .env + depends_on: - - postgres + db: + condition: service_healthy + + networks: + - app_network + volumes: - pg_data: + postgres_data: + + +networks: + app_network: + driver: bridge diff --git a/index.html b/index.html index b9a831c..1e16765 100644 --- a/index.html +++ b/index.html @@ -1149,4 +1149,4 @@ SELECT * FROM users LIMIT 10;"> } - \ No newline at end of file + diff --git a/server.js b/server.js index 535a74d..10be390 100644 --- a/server.js +++ b/server.js @@ -363,4 +363,4 @@ app.listen(PORT, () => { console.log(` Password: ${process.env.ADMIN_PASSWORD || 'admin'}`); console.log(''); console.log('📝 Make sure to configure your database in .env file'); -}); \ No newline at end of file +});