Compare commits

...

3 Commits

Author SHA1 Message Date
d86301919d refactor: hardcode ports in docker-compose.yml for server deployment
- Remove env variable substitution from docker-compose.yml ports
- Hardcode custom ports directly in compose file: 7080, 7081, 7082, 7700, 6432
- Remove PORT variables from .env.example (now configured in docker-compose.yml)
- Add documentation on how to change ports (edit docker-compose.yml directly)
- Simplifies server deployment - no need to export env variables before docker-compose up

Note: To change ports, edit infra/docker-compose.yml directly
2026-03-06 21:24:45 +01:00
47e53a19b9 fix: correct healthchecks and env variable handling for custom ports
- Fix healthchecks to use internal ports (8080, 8081, 8082, 7700) instead of external ports
- Remove variable expansion from healthcheck URLs (not supported in compose)
- Update .env.example to clarify internal vs external ports
- Ensure DATABASE_URL always uses internal PostgreSQL port (5432)
- Services now correctly start with custom external port mappings
2026-03-06 21:23:20 +01:00
d0a29196dd perf: add sccache to Docker builds for faster compilation
- Install sccache in builder stage of both api and indexer Dockerfiles
- Configure RUSTC_WRAPPER to use sccache
- Use Docker cache mount (--mount=type=cache,target=/sccache) to persist cache
- Reduces build time significantly on subsequent builds by caching compiled artifacts
- Requires Docker BuildKit (enabled by default in Docker 23.0+)

Note: First build will still be slow (installs sccache + populates cache)
Subsequent builds will be much faster as dependencies are cached
2026-03-06 21:04:40 +01:00
4 changed files with 42 additions and 35 deletions

View File

@@ -3,8 +3,7 @@
# HOW TO USE: # HOW TO USE:
# 1. Copy this file to .env: cp .env.example .env # 1. Copy this file to .env: cp .env.example .env
# 2. Change the REQUIRED values below # 2. Change the REQUIRED values below
# 3. Optionally change ports if you have conflicts # 3. Run: docker-compose up --build
# 4. Run: docker-compose up --build
# ============================================================================= # =============================================================================
# REQUIRED - Change these values in production! # REQUIRED - Change these values in production!
@@ -18,38 +17,22 @@ MEILI_MASTER_KEY=change-me-in-production
API_BOOTSTRAP_TOKEN=change-me-in-production API_BOOTSTRAP_TOKEN=change-me-in-production
# ============================================================================= # =============================================================================
# Port Configuration (change only if you have port conflicts) # Service Configuration
# =============================================================================
# Main application ports
API_PORT=8080
INDEXER_PORT=8081
BACKOFFICE_PORT=8082
# Infrastructure ports
MEILI_PORT=7700
POSTGRES_PORT=5432
# =============================================================================
# Service URLs (auto-generated from ports above - don't change unless you know what you're doing)
# ============================================================================= # =============================================================================
# API Service # API Service
API_LISTEN_ADDR=0.0.0.0:${API_PORT} API_LISTEN_ADDR=0.0.0.0:8080
API_BASE_URL=http://api:${API_PORT} API_BASE_URL=http://api:8080
# Indexer Service # Indexer Service
INDEXER_LISTEN_ADDR=0.0.0.0:${INDEXER_PORT} INDEXER_LISTEN_ADDR=0.0.0.0:8081
INDEXER_SCAN_INTERVAL_SECONDS=5 INDEXER_SCAN_INTERVAL_SECONDS=5
# Backoffice Web UI
# Uses BACKOFFICE_PORT from above
# Meilisearch Search Engine # Meilisearch Search Engine
MEILI_URL=http://meilisearch:${MEILI_PORT} MEILI_URL=http://meilisearch:7700
# PostgreSQL Database # PostgreSQL Database
DATABASE_URL=postgres://stripstream:stripstream@postgres:${POSTGRES_PORT}/stripstream DATABASE_URL=postgres://stripstream:stripstream@postgres:5432/stripstream
# ============================================================================= # =============================================================================
# Storage Configuration # Storage Configuration
@@ -64,3 +47,13 @@ LIBRARIES_ROOT_PATH=/libraries
# Default: ../libraries (relative to infra/docker-compose.yml) # Default: ../libraries (relative to infra/docker-compose.yml)
# You can change this to an absolute path on your machine # You can change this to an absolute path on your machine
LIBRARIES_HOST_PATH=../libraries LIBRARIES_HOST_PATH=../libraries
# =============================================================================
# Port Configuration
# =============================================================================
# To change ports, edit docker-compose.yml directly:
# - API: change "7080:8080" to "YOUR_PORT:8080"
# - Indexer: change "7081:8081" to "YOUR_PORT:8081"
# - Backoffice: change "7082:8082" to "YOUR_PORT:8082"
# - Meilisearch: change "7700:7700" to "YOUR_PORT:7700"
# - PostgreSQL: change "6432:5432" to "YOUR_PORT:5432"

View File

@@ -1,6 +1,11 @@
FROM rust:1-bookworm AS builder FROM rust:1-bookworm AS builder
WORKDIR /app WORKDIR /app
# Install sccache for faster builds
RUN cargo install sccache --locked
ENV RUSTC_WRAPPER=sccache
ENV SCCACHE_DIR=/sccache
COPY Cargo.toml ./ COPY Cargo.toml ./
COPY apps/api/Cargo.toml apps/api/Cargo.toml COPY apps/api/Cargo.toml apps/api/Cargo.toml
COPY apps/indexer/Cargo.toml apps/indexer/Cargo.toml COPY apps/indexer/Cargo.toml apps/indexer/Cargo.toml
@@ -11,7 +16,9 @@ COPY apps/indexer/src apps/indexer/src
COPY crates/core/src crates/core/src COPY crates/core/src crates/core/src
COPY crates/parsers/src crates/parsers/src COPY crates/parsers/src crates/parsers/src
RUN cargo build --release -p api # Build with sccache (cache persisted between builds via Docker cache mount)
RUN --mount=type=cache,target=/sccache \
cargo build --release -p api
FROM debian:bookworm-slim FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget unrar-free poppler-utils && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget unrar-free poppler-utils && rm -rf /var/lib/apt/lists/*

View File

@@ -1,6 +1,11 @@
FROM rust:1-bookworm AS builder FROM rust:1-bookworm AS builder
WORKDIR /app WORKDIR /app
# Install sccache for faster builds
RUN cargo install sccache --locked
ENV RUSTC_WRAPPER=sccache
ENV SCCACHE_DIR=/sccache
COPY Cargo.toml ./ COPY Cargo.toml ./
COPY apps/api/Cargo.toml apps/api/Cargo.toml COPY apps/api/Cargo.toml apps/api/Cargo.toml
COPY apps/indexer/Cargo.toml apps/indexer/Cargo.toml COPY apps/indexer/Cargo.toml apps/indexer/Cargo.toml
@@ -11,7 +16,9 @@ COPY apps/indexer/src apps/indexer/src
COPY crates/core/src crates/core/src COPY crates/core/src crates/core/src
COPY crates/parsers/src crates/parsers/src COPY crates/parsers/src crates/parsers/src
RUN cargo build --release -p indexer # Build with sccache (cache persisted between builds via Docker cache mount)
RUN --mount=type=cache,target=/sccache \
cargo build --release -p indexer
FROM debian:bookworm-slim FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget unrar-free && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates wget unrar-free && rm -rf /var/lib/apt/lists/*

View File

@@ -6,7 +6,7 @@ services:
POSTGRES_USER: stripstream POSTGRES_USER: stripstream
POSTGRES_PASSWORD: stripstream POSTGRES_PASSWORD: stripstream
ports: ports:
- "${POSTGRES_PORT:-5432}:5432" - "6432:5432"
volumes: volumes:
- postgres_data:/var/lib/postgresql/data - postgres_data:/var/lib/postgresql/data
healthcheck: healthcheck:
@@ -20,11 +20,11 @@ services:
env_file: env_file:
- ../.env - ../.env
ports: ports:
- "${MEILI_PORT:-7700}:7700" - "7700:7700"
volumes: volumes:
- meili_data:/meili_data - meili_data:/meili_data
healthcheck: healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:${MEILI_PORT:-7700}/health"] test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:7700/health"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@@ -54,7 +54,7 @@ services:
env_file: env_file:
- ../.env - ../.env
ports: ports:
- "${API_PORT:-8080}:8080" - "7080:8080"
volumes: volumes:
- ${LIBRARIES_HOST_PATH:-../libraries}:/libraries - ${LIBRARIES_HOST_PATH:-../libraries}:/libraries
depends_on: depends_on:
@@ -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:${API_PORT:-8080}/health"] test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:8080/health"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@@ -77,7 +77,7 @@ services:
env_file: env_file:
- ../.env - ../.env
ports: ports:
- "${INDEXER_PORT:-8081}:8081" - "7081:8081"
volumes: volumes:
- ${LIBRARIES_HOST_PATH:-../libraries}:/libraries - ${LIBRARIES_HOST_PATH:-../libraries}:/libraries
depends_on: depends_on:
@@ -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:${INDEXER_PORT:-8081}/health"] test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:8081/health"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5
@@ -103,12 +103,12 @@ services:
- PORT=8082 - PORT=8082
- HOST=0.0.0.0 - HOST=0.0.0.0
ports: ports:
- "${BACKOFFICE_PORT:-8082}:8082" - "7082:8082"
depends_on: depends_on:
api: api:
condition: service_healthy condition: service_healthy
healthcheck: healthcheck:
test: ["CMD", "wget", "-q", "-O", "-", "http://host.docker.internal:${BACKOFFICE_PORT:-8082}/health"] test: ["CMD", "wget", "-q", "-O", "-", "http://127.0.0.1:8082/health"]
interval: 10s interval: 10s
timeout: 5s timeout: 5s
retries: 5 retries: 5