hilingin/deployments/docker-compose.yml
2026-03-21 11:18:44 +02:00

135 lines
3.4 KiB
YAML

version: '3.8'
services:
# PostgreSQL Database
postgres:
image: postgres:15-alpine
container_name: hiling_postgres
environment:
POSTGRES_USER: ${DB_USERNAME:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME:-hiling}
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "${DB_PORT:-5432}:5432"
networks:
- hiling_network
restart: unless-stopped
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USERNAME:-postgres}"]
interval: 10s
timeout: 5s
retries: 5
# Meilisearch
meilisearch:
image: getmeili/meilisearch:v1.7
container_name: hiling_meilisearch
environment:
MEILI_MASTER_KEY: ${MEILI_MASTER_KEY}
MEILI_NO_ANALYTICS: "true"
MEILI_ENV: production
MEILI_HTTP_ADDR: 0.0.0.0:7700
volumes:
- meilisearch_data:/meili_data
ports:
- "${MEILI_PORT:-7700}:7700"
networks:
- hiling_network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:7700/health"]
interval: 10s
timeout: 5s
retries: 5
# Backend API (Go)
backend:
build:
context: ..
dockerfile: deployments/Dockerfile.backend
container_name: hiling_backend
environment:
DB_TYPE: postgres
DB_USERNAME: ${DB_USERNAME:-postgres}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME:-hiling}
DB_HOST: postgres
DB_PORT: 5432
DB_SOURCE: postgresql://${DB_USERNAME:-postgres}:${DB_PASSWORD}@postgres:5432/${DB_NAME:-hiling}?sslmode=disable
SERVER_ADDRESS: 0.0.0.0:8888
TOKEN_SYMMETRIC_KEY: ${TOKEN_SYMMETRIC_KEY}
TOKEN_DURATION: ${TOKEN_DURATION:-1024h}
COOKIE_DURATION: ${COOKIE_DURATION:-86400}
REFRESH_TOKEN_DURATION: ${REFRESH_TOKEN_DURATION:-1024h}
ports:
- "${BACKEND_PORT:-8888}:8888"
depends_on:
postgres:
condition: service_healthy
meilisearch:
condition: service_healthy
networks:
- hiling_network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:8888/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# OpenGraph Service (Deno)
opengraph:
build:
context: ..
dockerfile: deployments/Dockerfile.opengraph
container_name: hiling_opengraph
environment:
APP_PORT: 1234
DB_TYPE: postgres
DB_USERNAME: ${DB_USERNAME:-postgres}
DB_PASSWORD: ${DB_PASSWORD}
DB_NAME: ${DB_NAME:-hiling}
DB_HOST: postgres
DB_PORT: 5432
ports:
- "${OPENGRAPH_PORT:-1234}:1234"
depends_on:
postgres:
condition: service_healthy
networks:
- hiling_network
restart: unless-stopped
# Frontend (Nginx serving static files)
frontend:
build:
context: ..
dockerfile: deployments/Dockerfile.frontend
container_name: hiling_frontend
ports:
- "${FRONTEND_PORT:-80}:80"
depends_on:
- backend
- opengraph
networks:
- hiling_network
restart: unless-stopped
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--spider", "http://localhost:80"]
interval: 30s
timeout: 10s
retries: 3
volumes:
postgres_data:
driver: local
meilisearch_data:
driver: local
networks:
hiling_network:
driver: bridge