refactor: simplify env configuration with single port definitions
- Update docker-compose.yml healthchecks to use env variables instead of hardcoded ports
- Restructure .env.example to define each port only once
- Auto-generate service URLs from port variables using ${PORT} syntax
- Document the configuration structure with clear sections
- Makes it easier to change ports without updating multiple variables
This commit is contained in:
45
.env.example
45
.env.example
@@ -1,4 +1,10 @@
|
|||||||
# Stripstream Librarian - Environment Configuration
|
# Stripstream Librarian - Environment Configuration
|
||||||
|
#
|
||||||
|
# HOW TO USE:
|
||||||
|
# 1. Copy this file to .env: cp .env.example .env
|
||||||
|
# 2. Change the REQUIRED values below
|
||||||
|
# 3. Optionally change ports if you have conflicts
|
||||||
|
# 4. Run: docker-compose up --build
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# REQUIRED - Change these values in production!
|
# REQUIRED - Change these values in production!
|
||||||
@@ -12,41 +18,38 @@ MEILI_MASTER_KEY=change-me-in-production
|
|||||||
API_BOOTSTRAP_TOKEN=change-me-in-production
|
API_BOOTSTRAP_TOKEN=change-me-in-production
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Services Configuration
|
# Port Configuration (change only if you have port conflicts)
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# API Service
|
# Main application ports
|
||||||
API_LISTEN_ADDR=0.0.0.0:8080
|
|
||||||
API_BASE_URL=http://api:8080
|
|
||||||
API_PORT=8080
|
API_PORT=8080
|
||||||
|
|
||||||
# Indexer Service
|
|
||||||
INDEXER_LISTEN_ADDR=0.0.0.0:8081
|
|
||||||
INDEXER_SCAN_INTERVAL_SECONDS=5
|
|
||||||
INDEXER_PORT=8081
|
INDEXER_PORT=8081
|
||||||
|
|
||||||
# Backoffice Web UI
|
|
||||||
BACKOFFICE_PORT=8082
|
BACKOFFICE_PORT=8082
|
||||||
|
|
||||||
# Meilisearch Search Engine
|
# Infrastructure ports
|
||||||
MEILI_PORT=7700
|
MEILI_PORT=7700
|
||||||
|
|
||||||
# PostgreSQL Database
|
|
||||||
POSTGRES_PORT=5432
|
POSTGRES_PORT=5432
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Database Configuration
|
# Service URLs (auto-generated from ports above - don't change unless you know what you're doing)
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
# PostgreSQL connection string
|
# API Service
|
||||||
DATABASE_URL=postgres://stripstream:stripstream@postgres:5432/stripstream
|
API_LISTEN_ADDR=0.0.0.0:${API_PORT}
|
||||||
|
API_BASE_URL=http://api:${API_PORT}
|
||||||
|
|
||||||
# =============================================================================
|
# Indexer Service
|
||||||
# Search Configuration
|
INDEXER_LISTEN_ADDR=0.0.0.0:${INDEXER_PORT}
|
||||||
# =============================================================================
|
INDEXER_SCAN_INTERVAL_SECONDS=5
|
||||||
|
|
||||||
# Meilisearch connection URL
|
# Backoffice Web UI
|
||||||
MEILI_URL=http://meilisearch:7700
|
# Uses BACKOFFICE_PORT from above
|
||||||
|
|
||||||
|
# Meilisearch Search Engine
|
||||||
|
MEILI_URL=http://meilisearch:${MEILI_PORT}
|
||||||
|
|
||||||
|
# PostgreSQL Database
|
||||||
|
DATABASE_URL=postgres://stripstream:stripstream@postgres:${POSTGRES_PORT}/stripstream
|
||||||
|
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Storage Configuration
|
# Storage Configuration
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- meili_data:/meili_data
|
- meili_data:/meili_data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:7700/health"]
|
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:${MEILI_PORT:-7700}/health"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -65,7 +65,7 @@ services:
|
|||||||
meilisearch:
|
meilisearch:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:8080/health"]
|
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:${API_PORT:-8080}/health"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -88,7 +88,7 @@ services:
|
|||||||
meilisearch:
|
meilisearch:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:8081/health"]
|
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:${INDEXER_PORT:-8081}/health"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -108,7 +108,7 @@ services:
|
|||||||
api:
|
api:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "wget", "-q", "-O", "-", "http://host.docker.internal:8082/health"]
|
test: ["CMD", "wget", "-q", "-O", "-", "http://host.docker.internal:${BACKOFFICE_PORT:-8082}/health"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
|
|||||||
Reference in New Issue
Block a user