-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.fresh.yml
More file actions
118 lines (114 loc) · 3.37 KB
/
Copy pathdocker-compose.fresh.yml
File metadata and controls
118 lines (114 loc) · 3.37 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
109
110
111
112
113
114
115
116
117
118
# Milestone - Fresh Install (Self-Contained)
#
# Includes PostgreSQL, auto-creates databases and schema on first run.
# No external database required - everything runs in Docker.
#
# First run:
# cp .env.example .env # then edit .env with your settings
# docker compose -f docker-compose.fresh.yml up -d
#
# The app will:
# 1. Start PostgreSQL
# 2. Wait for PostgreSQL readiness
# 3. Auto-create databases and apply schema
# 4. Seed default admin user
# 5. Start the application
#
# Default admin credentials (multi-tenant admin panel):
# Email: admin@milestone.local
# Password: check container logs: docker logs milestone-fresh
#
# Port configuration (override via .env or environment):
# FRESH_DB_PORT - host port for PostgreSQL (default: 5433)
# FRESH_APP_PORT - host port for the app (default: 8486)
#
# Access: http://localhost:${FRESH_APP_PORT:-8486}/
services:
# PostgreSQL Database
db:
image: postgres:15-alpine
container_name: milestone-fresh-db
restart: unless-stopped
environment:
POSTGRES_USER: ${PG_ADMIN_USER:-postgres}
POSTGRES_PASSWORD: ${PG_ADMIN_PASSWORD:-milestone_secret}
POSTGRES_DB: postgres
PGDATA: /var/lib/postgresql/data/pgdata
volumes:
- fresh-pgdata:/var/lib/postgresql/data
ports:
- "${FRESH_DB_PORT:-5433}:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${PG_ADMIN_USER:-postgres}"]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
deploy:
resources:
limits:
memory: 512m
reservations:
memory: 128m
networks:
- milestone-fresh-net
# FastAPI Application
milestone:
build:
context: .
dockerfile: Dockerfile
container_name: milestone-fresh
restart: unless-stopped
ports:
- "${FRESH_APP_PORT:-8486}:8485"
environment:
- PORT=8485
- TZ=Europe/Zurich
# Database connection (points to the db service)
- DB_HOST=db
- DB_PORT=5432
- DB_NAME=${DB_NAME:-milestone}
- DB_USER=${DB_USER:-milestone}
- DB_PASSWORD=${DB_PASSWORD:-milestone_db_pass}
# Admin credentials for DB creation
- PG_ADMIN_USER=${PG_ADMIN_USER:-postgres}
- PG_ADMIN_PASSWORD=${PG_ADMIN_PASSWORD:-milestone_secret}
# Multi-tenant settings
- MULTI_TENANT=${MULTI_TENANT:-false}
- MASTER_DB_HOST=db
- MASTER_DB_PORT=5432
- MASTER_DB_NAME=${MASTER_DB_NAME:-milestone_admin}
- MASTER_DB_USER=${PG_ADMIN_USER:-postgres}
- MASTER_DB_PASSWORD=${PG_ADMIN_PASSWORD:-milestone_secret}
# Security
- SESSION_SECRET=${SESSION_SECRET:-change-me-in-production}
- TENANT_ENCRYPTION_KEY=${TENANT_ENCRYPTION_KEY:-}
# Auto-initialization
- AUTO_INIT_DB=true
- INIT_ADMIN_EMAIL=${INIT_ADMIN_EMAIL:-admin@milestone.local}
- INIT_ADMIN_PASSWORD=${INIT_ADMIN_PASSWORD:-}
volumes:
- fresh-uploads:/app/uploads
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8485/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
deploy:
resources:
limits:
memory: 1g
reservations:
memory: 256m
networks:
- milestone-fresh-net
volumes:
fresh-pgdata:
fresh-uploads:
networks:
milestone-fresh-net:
driver: bridge