Skip to content

Docker Compose testing

This document provides a testing plan for the SQLite-only docker-compose.yml configuration.

Terminal window
# Validate docker-compose.yml syntax
docker compose config
# List services
docker compose config --services
# Expected output: mjrwtf
  • Create the persistent data directory: mkdir -p data

  • Configure auth (at least one of):

    • AUTH_TOKENS (preferred; comma-separated)
    • AUTH_TOKEN (legacy; used only if AUTH_TOKENS is unset)

Note: the container runs ./migrate up automatically on startup (see docker-entrypoint.sh) and will create/apply the SQLite schema in /app/data/database.db.

  • Start service: make docker-compose-up
  • Verify service is running: make docker-compose-ps
  • Verify no errors in logs: make docker-compose-logs
  • Manual health check: curl http://localhost:8080/health (expect HTTP 200)
  • Readiness check: curl http://localhost:8080/ready (expect HTTP 200)
  • Create a short URL (note the returned short_code):
    Terminal window
    TOKEN=your-token-here
    curl -X POST http://localhost:8080/api/urls \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"original_url": "https://example.com"}'
  • Stop service: make docker-compose-down
  • Start service again: make docker-compose-up
  • Verify redirect still works: curl -L http://localhost:8080/<short_code_from_response>
  • Verify the DB file exists: ls -l ./data/database.db
  • Stop service: make docker-compose-down
  • Remove local data (DESTROYS DATA): rm -rf ./data