180 lines
5.1 KiB
YAML
180 lines
5.1 KiB
YAML
networks:
|
|
storycove-network:
|
|
driver: bridge
|
|
|
|
services:
|
|
nginx:
|
|
image: nginx:alpine
|
|
ports:
|
|
- "6925:80"
|
|
volumes:
|
|
- images_data:/app/images:ro
|
|
configs:
|
|
- source: nginx_config
|
|
target: /etc/nginx/nginx.conf
|
|
depends_on:
|
|
- frontend
|
|
- backend
|
|
networks:
|
|
- storycove-network
|
|
|
|
frontend:
|
|
build: ./frontend
|
|
environment:
|
|
- NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL:-/api}
|
|
depends_on:
|
|
- backend
|
|
networks:
|
|
- storycove-network
|
|
|
|
backend:
|
|
build: ./backend
|
|
environment:
|
|
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgres:5432/storycove
|
|
- SPRING_DATASOURCE_USERNAME=storycove
|
|
- SPRING_DATASOURCE_PASSWORD=${DB_PASSWORD}
|
|
- JWT_SECRET=${JWT_SECRET}
|
|
- SOLR_HOST=solr
|
|
- SOLR_PORT=8983
|
|
- SOLR_SCHEME=http
|
|
- SEARCH_ENGINE=${SEARCH_ENGINE:-solr}
|
|
- IMAGE_STORAGE_PATH=/app/images
|
|
- APP_PASSWORD=${APP_PASSWORD}
|
|
- STORYCOVE_CORS_ALLOWED_ORIGINS=${STORYCOVE_CORS_ALLOWED_ORIGINS:-http://localhost:3000,http://localhost:6925}
|
|
volumes:
|
|
- images_data:/app/images
|
|
- library_config:/app/config
|
|
depends_on:
|
|
postgres:
|
|
condition: service_started
|
|
solr:
|
|
condition: service_started
|
|
networks:
|
|
- storycove-network
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
# No port mapping - only accessible within the Docker network
|
|
#ports:
|
|
# - "5432:5432"
|
|
environment:
|
|
- POSTGRES_DB=storycove
|
|
- POSTGRES_USER=storycove
|
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
networks:
|
|
- storycove-network
|
|
|
|
migrations:
|
|
image: postgres:15-alpine
|
|
depends_on:
|
|
- postgres
|
|
volumes:
|
|
- ./backend/create_backup_jobs_table.sql:/migrations/create_backup_jobs_table.sql:ro
|
|
networks:
|
|
- storycove-network
|
|
entrypoint: /bin/sh
|
|
command: >
|
|
-c "
|
|
echo 'Waiting for postgres to be ready...';
|
|
sleep 5;
|
|
echo 'Applying migrations to all databases...';
|
|
for DB in storycove storycove_afterdark storycove_clas storycove_secret; do
|
|
echo \"Checking if database \$$DB exists...\";
|
|
if PGPASSWORD=${DB_PASSWORD} psql -h postgres -U storycove -lqt | cut -d \\| -f 1 | grep -qw \$$DB; then
|
|
echo \"Applying migration to \$$DB...\";
|
|
PGPASSWORD=${DB_PASSWORD} psql -h postgres -U storycove -d \$$DB -f /migrations/create_backup_jobs_table.sql;
|
|
echo \"✓ Migration applied to \$$DB\";
|
|
else
|
|
echo \"⚠ Database \$$DB does not exist, skipping...\";
|
|
fi;
|
|
done;
|
|
echo 'All migrations complete!';
|
|
"
|
|
restart: "no"
|
|
|
|
|
|
solr:
|
|
build:
|
|
context: .
|
|
dockerfile: solr.Dockerfile
|
|
ports:
|
|
- "8983:8983" # Expose Solr Admin UI for development
|
|
environment:
|
|
- SOLR_HEAP=512m
|
|
- SOLR_JAVA_MEM=-Xms256m -Xmx512m
|
|
volumes:
|
|
- solr_data:/var/solr
|
|
deploy:
|
|
resources:
|
|
limits:
|
|
memory: 1G
|
|
reservations:
|
|
memory: 512M
|
|
stop_grace_period: 30s
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "curl -f http://localhost:8983/solr/admin/ping || exit 1"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 60s
|
|
networks:
|
|
- storycove-network
|
|
restart: unless-stopped
|
|
|
|
|
|
volumes:
|
|
postgres_data:
|
|
solr_data:
|
|
images_data:
|
|
library_config:
|
|
|
|
configs:
|
|
nginx_config:
|
|
content: |
|
|
events {
|
|
worker_connections 1024;
|
|
}
|
|
http {
|
|
upstream frontend {
|
|
server frontend:3000;
|
|
}
|
|
upstream backend {
|
|
server backend:8080;
|
|
}
|
|
server {
|
|
listen 80;
|
|
client_max_body_size 600M;
|
|
location / {
|
|
proxy_pass http://frontend;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $$http_upgrade;
|
|
proxy_set_header Connection upgrade;
|
|
proxy_set_header Host $$host;
|
|
proxy_set_header X-Real-IP $$remote_addr;
|
|
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $$scheme;
|
|
proxy_cache_bypass $$http_upgrade;
|
|
}
|
|
location /api/ {
|
|
proxy_pass http://backend/api/;
|
|
proxy_set_header Host $$host;
|
|
proxy_set_header X-Real-IP $$remote_addr;
|
|
proxy_set_header X-Forwarded-For $$proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $$scheme;
|
|
proxy_connect_timeout 900s;
|
|
proxy_send_timeout 900s;
|
|
proxy_read_timeout 900s;
|
|
# Large upload settings
|
|
client_max_body_size 600M;
|
|
proxy_request_buffering off;
|
|
proxy_max_temp_file_size 0;
|
|
}
|
|
location /images/ {
|
|
alias /app/images/;
|
|
expires 1y;
|
|
add_header Cache-Control public;
|
|
}
|
|
}
|
|
} |