forked from mtusi2026/mtusi2026lab3
feat: add initial project structure and files for Go API with PostgreSQL and HAProxy
Co-authored-by: aider (ollama/qwen2.5-coder:7b) <aider@aider.chat>
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
environment:
|
||||
POSTGRES_DB: lab3
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
networks:
|
||||
- lab3net
|
||||
|
||||
api1:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
APP_INSTANCE_ID: api1
|
||||
APP_PORT: 8080
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/lab3
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- lab3net
|
||||
stop_grace_period: 15s
|
||||
|
||||
api2:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
APP_INSTANCE_ID: api2
|
||||
APP_PORT: 8080
|
||||
DATABASE_URL: postgresql://postgres:postgres@postgres:5432/lab3
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
networks:
|
||||
- lab3net
|
||||
stop_grace_period: 15s
|
||||
|
||||
networks:
|
||||
lab3net:
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
Reference in New Issue
Block a user