-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
108 lines (98 loc) · 3.05 KB
/
Copy pathdocker-compose.yml
File metadata and controls
108 lines (98 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
version: "3.8"
services:
postgres:
build:
context: database
dockerfile: Dockerfile
container_name: geocoding_db
restart: unless-stopped
environment:
POSTGRES_DB: ${DB_NAME:-geocoding_db}
POSTGRES_USER: ${DB_USER:-geocoding_user}
POSTGRES_PASSWORD: ${DB_PASSWORD:-secure_password_change_me}
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
command:
- "postgres"
- "-c"
- "max_wal_size=4GB"
- "-c"
- "checkpoint_completion_target=0.9"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./georef-united-states-of-america-zc-point.csv:/docker-entrypoint-initdb.d/georef-united-states-of-america-zc-point.csv:ro
# NOTE: Postgres port exposed for local development
ports:
- "${DB_EXTERNAL_PORT:-8954}:5432"
healthcheck:
test:
[
"CMD-SHELL",
"pg_isready -U ${DB_USER:-geocoding_user} -d ${DB_NAME:-geocoding_db}",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
- geocode
geocoding-api:
build:
context: .
dockerfile: Dockerfile
container_name: geocoding_api
restart: unless-stopped
environment:
# Database Configuration
DB_HOST: postgres
DB_PORT: 5432
DB_USER: ${DB_USER:-geocoding_user}
DB_PASSWORD: ${DB_PASSWORD:-secure_password_change_me}
DB_NAME: ${DB_NAME:-geocoding_db}
DB_SSLMODE: ${DB_SSLMODE:-disable}
DATABASE_URL: postgres://${DB_USER}:${DB_PASSWORD}@postgres:5432/${DB_NAME}?sslmode=${DB_SSLMODE}
# Application Configuration
PORT: ${API_PORT:-8080}
GO_ENV: ${GO_ENV:-production}
# CORS Configuration (Optional)
CORS_ORIGINS: ${CORS_ORIGINS}
# Security (set these in your Coolify environment)
JWT_SECRET: ${JWT_SECRET:-change_this_in_production}
API_SECRET_KEY: ${API_SECRET_KEY:-change_this_in_production}
# Admin Configuration
ADMIN_EMAILS: ${ADMIN_EMAILS:-john.k.fay@gmail.com}
# Migration Configuration
# Set to 'true' to run migrations in background and start server immediately
# Useful for long-running migrations (e.g., updating millions of records)
RUN_MIGRATIONS_ASYNC: ${RUN_MIGRATIONS_ASYNC:-false}
# Optional: External API configurations
RATE_LIMIT_PER_MINUTE: ${RATE_LIMIT_PER_MINUTE:-60}
MAX_CONNECTIONS: ${MAX_CONNECTIONS:-100}
ports:
- "${API_EXTERNAL_PORT:-8080}:${API_PORT:-8080}"
depends_on:
postgres:
condition: service_healthy
# NOTE: Uploaded files are processed and deleted immediately
# No persistent storage needed for uploads
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:${API_PORT:-8080}/health",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
networks:
- geocode
volumes:
postgres_data:
driver: local
networks:
geocode:
driver: bridge