Docker - jegr78/ctc-manager GitHub Wiki

Docker

CTC Manager provides Docker Compose configurations for both local development and production deployment.

Local Development

File: docker-compose.yml

Runs the full stack locally: application + MariaDB database.

docker compose up --build -d    # Build and start
docker compose down              # Stop and remove
docker compose build             # Build image only

Services

Service Image Port (host:container) Description
app Built from Dockerfile 8080:8080 CTC Manager application
db mariadb:11 3307:3306 MariaDB database

Configuration

The app service uses the docker Spring profile (SPRING_PROFILES_ACTIVE=docker), which connects to the MariaDB container via the Docker network hostname db.

Database credentials (local only):

Variable Value
MARIADB_DATABASE ctcdb
MARIADB_USER ctc
MARIADB_PASSWORD ctc
MARIADB_ROOT_PASSWORD root

Health Checks

Both services have health checks configured:

  • MariaDB: Uses healthcheck.sh --connect --innodb_initialized (10s interval, 30s start period)
  • App: Polls http://localhost:8080/actuator/health (15s interval, 60s start period)

The app depends on db with condition: service_healthy, ensuring MariaDB is fully initialized before the application starts.

Production Deployment

File: docker-compose.prod.yml

Uses a pre-built image and connects to an external database via environment variables.

docker compose -f docker-compose.prod.yml up -d

Services

Service Image Port Description
app ctc-manager:latest 8080:8080 CTC Manager application

No database service -- production uses an external database.

Environment Variables

Configure via a .env file or shell environment:

Variable Description Example
DATABASE_URL JDBC connection URL jdbc:mariadb://db-host:3306/ctcdb
DATABASE_USERNAME Database user ctc
DATABASE_PASSWORD Database password secret

Profile

The production profile (SPRING_PROFILES_ACTIVE=prod) reads database connection details from the environment variables above.

Volumes

Volume Mount Point Purpose
ctc-db-data /var/lib/mysql MariaDB data persistence (local only)
ctc-data /app/data uploads/ (car/track images, attachments, custom graphic templates), site/ (generated static site), backup-staging/, import-backups/ (pre-import recovery archives)
ctc-logs /app/logs Log files

All volumes are Docker named volumes, persisted across container restarts and recreation. The docker and prod profiles point app.upload-dir, ctc.site.output-dir, app.backup.staging-dir and app.backup.import-backups-dir below /app/data. The uploads directory is deliberately not a mount root: a backup import replaces it by renaming it next to the recovery archive.

Upgrading from the earlier layout (ctc-uploads, ctc-site-output) needs a one-time copy of the uploads. The commands are in the README section "Docker".