Skip to content

Commit 1557f57

Browse files
committed
Add version controller script and update Docker configurations
- Introduced a version controller script to manage local versioning. - Updated VERSION file to 1.1.1-beta. - Refactored docker-compose.yml to improve service configurations and networking. - Modified Dockerfile to set a static build date. - Changed permissions for init-db.py and validate-dockerfile.py scripts. - Added a setup script for simplified development environment setup.
1 parent e9b7f47 commit 1557f57

File tree

8 files changed

+331
-224
lines changed

8 files changed

+331
-224
lines changed

.pre-commit-config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
repos:
2+
- repo: local
3+
hooks:
4+
- id: version-controller
5+
name: Version Controller
6+
entry: ./scripts/versionController.sh
7+
language: system
8+
stages: [commit]
9+
pass_filenames: false
10+
always_run: true
11+
verbose: true

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.0
1+
1.1.1-beta

docker-compose.yml

Lines changed: 50 additions & 222 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,14 @@
1-
# version: '3.8' # Version is obsolete in Docker Compose v2+
2-
31
services:
4-
# Interactive Setup Wizard (run once for initial configuration)
5-
setup:
6-
build:
7-
context: .
8-
dockerfile: docker/setup/Dockerfile
9-
container_name: rendiff_setup
10-
volumes:
11-
- .:/host # Mount the entire project directory
12-
- ./config:/app/config:ro # Mount config templates
13-
environment:
14-
- TERM=xterm-256color # Better terminal support
15-
profiles:
16-
- setup
17-
stdin_open: true
18-
tty: true
19-
networks:
20-
- rendiff
21-
22-
# Traefik Reverse Proxy with HTTPS (runs by default)
2+
# Traefik Reverse Proxy
233
traefik:
244
image: traefik:v3.0
25-
container_name: rendiff_traefik
5+
container_name: ffmpeg_traefik
266
command:
277
- --configFile=/etc/traefik/traefik.yml
288
ports:
299
- "80:80"
3010
- "443:443"
31-
- "8081:8080" # Dashboard on 8081 to avoid conflict
11+
- "8081:8080"
3212
volumes:
3313
- /var/run/docker.sock:/var/run/docker.sock:ro
3414
- ./traefik/traefik.yml:/etc/traefik/traefik.yml:ro
@@ -37,114 +17,84 @@ services:
3717
depends_on:
3818
- api
3919
networks:
40-
- rendiff
20+
- ffmpeg-net
4121
restart: unless-stopped
4222
labels:
4323
- "traefik.enable=true"
4424
- "traefik.http.routers.traefik-dashboard.rule=Host(`traefik.localhost`)"
4525
- "traefik.http.routers.traefik-dashboard.entrypoints=websecure"
4626
- "traefik.http.routers.traefik-dashboard.tls=true"
4727
- "traefik.http.routers.traefik-dashboard.service=api@internal"
48-
49-
# API Gateway (now behind Traefik)
50-
krakend:
51-
image: devopsfaith/krakend:2.6
52-
container_name: rendiff_gateway
53-
volumes:
54-
- ./config/krakend.json:/etc/krakend/krakend.json:ro
55-
# No port exposure - accessed through Traefik
56-
depends_on:
57-
- api
58-
networks:
59-
- rendiff
60-
restart: unless-stopped
61-
labels:
62-
- "traefik.enable=true"
63-
- "traefik.http.routers.krakend.rule=Host(`localhost`) && PathPrefix(`/`)"
64-
- "traefik.http.routers.krakend.entrypoints=websecure"
65-
- "traefik.http.routers.krakend.tls=true"
66-
- "traefik.http.services.krakend.loadbalancer.server.port=8080"
67-
6828
# Database Service
6929
postgres:
7030
image: postgres:15-alpine
71-
container_name: rendiff_postgres
31+
container_name: ffmpeg_postgres
7232
environment:
7333
- POSTGRES_DB=ffmpeg_api
7434
- POSTGRES_USER=ffmpeg_user
75-
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
76-
- POSTGRES_INITDB_ARGS=--encoding=UTF-8 --lc-collate=C --lc-ctype=C
35+
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-defaultpassword}
7736
volumes:
7837
- postgres-data:/var/lib/postgresql/data
79-
- ./docker/postgres/init:/docker-entrypoint-initdb.d:ro
80-
# ports:
81-
# - "5432:5432" # Remove port exposure for security
38+
ports:
39+
- "5432:5432"
8240
networks:
83-
- rendiff
41+
- ffmpeg-net
8442
restart: unless-stopped
8543
healthcheck:
8644
test: ["CMD-SHELL", "pg_isready -U ffmpeg_user -d ffmpeg_api"]
8745
interval: 10s
8846
timeout: 5s
8947
retries: 5
90-
command: >
91-
postgres
92-
-c max_connections=200
93-
-c shared_buffers=256MB
94-
-c effective_cache_size=1GB
95-
-c maintenance_work_mem=64MB
96-
-c checkpoint_completion_target=0.9
97-
-c wal_buffers=16MB
98-
-c default_statistics_target=100
99-
-c random_page_cost=1.1
100-
-c effective_io_concurrency=200
10148

102-
# Database Migration Service (runs once to initialize schema)
49+
# Queue Service (Redis)
50+
redis:
51+
image: redis:7-alpine
52+
container_name: ffmpeg_redis
53+
command: redis-server --appendonly yes
54+
volumes:
55+
- redis-data:/data
56+
ports:
57+
- "6379:6379"
58+
networks:
59+
- ffmpeg-net
60+
restart: unless-stopped
61+
healthcheck:
62+
test: ["CMD", "redis-cli", "ping"]
63+
interval: 10s
64+
timeout: 5s
65+
retries: 5
66+
67+
# Database Migration Service
10368
db-migrate:
10469
build:
10570
context: .
10671
dockerfile: docker/api/Dockerfile
10772
command: ["/app/scripts/docker-entrypoint.sh", "migrate"]
10873
environment:
109-
- DATABASE_URL=${DATABASE_URL}
74+
- DATABASE_URL=${DATABASE_URL:-postgresql://ffmpeg_user:defaultpassword@postgres:5432/ffmpeg_api}
11075
- PYTHONUNBUFFERED=1
111-
- POSTGRES_HOST=postgres
112-
- POSTGRES_PORT=5432
113-
- POSTGRES_USER=ffmpeg_user
114-
- POSTGRES_DB=ffmpeg_api
11576
depends_on:
11677
postgres:
11778
condition: service_healthy
11879
networks:
119-
- rendiff
80+
- ffmpeg-net
12081
restart: "no"
121-
volumes:
122-
- ./alembic:/app/alembic:ro
123-
- ./alembic.ini:/app/alembic.ini:ro
12482

12583
# API Service
12684
api:
12785
build:
12886
context: .
12987
dockerfile: docker/api/Dockerfile
88+
container_name: ffmpeg_api
13089
environment:
131-
- DATABASE_URL=${DATABASE_URL}
90+
- DATABASE_URL=${DATABASE_URL:-postgresql://ffmpeg_user:defaultpassword@postgres:5432/ffmpeg_api}
13291
- REDIS_URL=redis://redis:6379/0
133-
- STORAGE_CONFIG=/app/config/storage.yml
13492
- LOG_LEVEL=info
13593
- PYTHONUNBUFFERED=1
13694
- API_HOST=0.0.0.0
13795
- API_PORT=8000
138-
- API_WORKERS=4
139-
- POSTGRES_HOST=postgres
140-
- POSTGRES_PORT=5432
141-
- POSTGRES_USER=ffmpeg_user
142-
- POSTGRES_DB=ffmpeg_api
143-
- REDIS_HOST=redis
144-
- REDIS_PORT=6379
14596
volumes:
146-
- ./config:/app/config:ro
147-
- storage:/storage
97+
- ./storage:/storage
14898
depends_on:
14999
postgres:
150100
condition: service_healthy
@@ -153,176 +103,54 @@ services:
153103
db-migrate:
154104
condition: service_completed_successfully
155105
networks:
156-
- rendiff
106+
- ffmpeg-net
157107
restart: unless-stopped
158108
healthcheck:
159-
test: ["CMD", "/app/scripts/health-check.sh", "api"]
109+
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
160110
interval: 30s
161111
timeout: 10s
162-
start_period: 120s
112+
start_period: 60s
163113
retries: 3
164-
deploy:
165-
replicas: 2
166-
resources:
167-
limits:
168-
cpus: '2'
169-
memory: 4G
114+
labels:
115+
- "traefik.enable=true"
116+
- "traefik.http.routers.api.rule=Host(`localhost`) && PathPrefix(`/api`)"
117+
- "traefik.http.routers.api.entrypoints=web"
118+
- "traefik.http.services.api.loadbalancer.server.port=8000"
170119

171-
# Worker Service - CPU
172-
worker-cpu:
120+
# Worker Service - CPU Only
121+
worker:
173122
build:
174123
context: .
175124
dockerfile: docker/worker/Dockerfile
125+
args:
126+
- WORKER_TYPE=cpu
127+
container_name: ffmpeg_worker
176128
environment:
177-
- DATABASE_URL=${DATABASE_URL}
129+
- DATABASE_URL=${DATABASE_URL:-postgresql://ffmpeg_user:defaultpassword@postgres:5432/ffmpeg_api}
178130
- REDIS_URL=redis://redis:6379/0
179-
- STORAGE_CONFIG=/app/config/storage.yml
180131
- WORKER_TYPE=cpu
181132
- WORKER_CONCURRENCY=4
182133
- LOG_LEVEL=info
183134
- PYTHONUNBUFFERED=1
184135
volumes:
185-
- ./config:/app/config:ro
186-
- storage:/storage
136+
- ./storage:/storage
187137
depends_on:
188138
postgres:
189139
condition: service_healthy
190140
redis:
191141
condition: service_healthy
192142
networks:
193-
- rendiff
143+
- ffmpeg-net
194144
restart: unless-stopped
195-
deploy:
196-
replicas: 2
197-
resources:
198-
limits:
199-
cpus: '4'
200-
memory: 8G
201-
202-
# Worker Service - GPU (optional)
203-
worker-gpu:
204-
build:
205-
context: .
206-
dockerfile: docker/worker/Dockerfile
207-
environment:
208-
- DATABASE_URL=${DATABASE_URL}
209-
- REDIS_URL=redis://redis:6379/0
210-
- STORAGE_CONFIG=/app/config/storage.yml
211-
- WORKER_TYPE=gpu
212-
- WORKER_CONCURRENCY=2
213-
- LOG_LEVEL=info
214-
- PYTHONUNBUFFERED=1
215-
- NVIDIA_VISIBLE_DEVICES=all
216-
volumes:
217-
- ./config:/app/config:ro
218-
- storage:/storage
219-
depends_on:
220-
postgres:
221-
condition: service_healthy
222-
redis:
223-
condition: service_healthy
224-
networks:
225-
- rendiff
226-
restart: unless-stopped
227-
deploy:
228-
replicas: 1
229-
resources:
230-
limits:
231-
cpus: '4'
232-
memory: 8G
233-
reservations:
234-
devices:
235-
- driver: nvidia
236-
count: 1
237-
capabilities: [gpu]
238-
profiles:
239-
- gpu
240-
241-
# Queue Service (Redis)
242-
redis:
243-
image: redis:7-alpine
244-
container_name: rendiff_redis
245-
command: >
246-
redis-server
247-
--appendonly yes
248-
--appendfsync everysec
249-
--maxmemory 2gb
250-
--maxmemory-policy allkeys-lru
251-
--timeout 300
252-
--tcp-keepalive 300
253-
--maxclients 1000
254-
volumes:
255-
- redis-data:/data
256-
- ./docker/redis/redis.conf:/usr/local/etc/redis/redis.conf:ro
257-
# ports:
258-
# - "6379:6379" # Remove port exposure for security
259-
networks:
260-
- rendiff
261-
restart: unless-stopped
262-
healthcheck:
263-
test: ["CMD", "redis-cli", "ping"]
264-
interval: 10s
265-
timeout: 5s
266-
retries: 5
267-
268-
269-
# Monitoring - Prometheus
270-
prometheus:
271-
image: prom/prometheus:v2.48.0
272-
command:
273-
- '--config.file=/etc/prometheus/prometheus.yml'
274-
- '--storage.tsdb.path=/prometheus'
275-
- '--web.console.libraries=/usr/share/prometheus/console_libraries'
276-
- '--web.console.templates=/usr/share/prometheus/consoles'
277-
volumes:
278-
- ./config/prometheus.yml:/etc/prometheus/prometheus.yml:ro
279-
- prometheus-data:/prometheus
280-
ports:
281-
- "9090:9090"
282-
networks:
283-
- rendiff
284-
restart: unless-stopped
285-
profiles:
286-
- monitoring
287-
288-
# Monitoring - Grafana
289-
grafana:
290-
image: grafana/grafana:10.2.0
291-
environment:
292-
- GF_SECURITY_ADMIN_USER=admin
293-
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
294-
- GF_USERS_ALLOW_SIGN_UP=false
295-
volumes:
296-
- grafana-data:/var/lib/grafana
297-
- ./monitoring/dashboards:/etc/grafana/provisioning/dashboards:ro
298-
- ./monitoring/datasources:/etc/grafana/provisioning/datasources:ro
299-
ports:
300-
- "3000:3000"
301-
networks:
302-
- rendiff
303-
restart: unless-stopped
304-
depends_on:
305-
- prometheus
306-
profiles:
307-
- monitoring
308-
309145

310146
networks:
311-
rendiff:
147+
ffmpeg-net:
312148
driver: bridge
313149

314150
volumes:
315151
storage:
316152
driver: local
317-
driver_opts:
318-
type: none
319-
o: bind
320-
device: ${STORAGE_PATH:-./storage}
321153
postgres-data:
322154
driver: local
323155
redis-data:
324-
driver: local
325-
prometheus-data:
326-
driver: local
327-
grafana-data:
328156
driver: local

0 commit comments

Comments
 (0)