diff --git a/docker-compose-example.yml b/docker-compose-example.yml new file mode 100644 index 0000000..9631187 --- /dev/null +++ b/docker-compose-example.yml @@ -0,0 +1,41 @@ +# Use with an appropriate .env file + +services: + app: + image: git.kolkman.org/olaf/link-log:development # or :latest or a version-tag + container_name: ${APP_CONTAINER_NAME:-linklog-app} + ports: + - "${APP_PORT:-8000}:8000" + volumes: + - ./linklog_data:/app/backend/data + environment: + APP_ENV: ${APP_ENV:-production} + LINKLOG_APP_NAME: ${LINKLOG_APP_NAME:-LinkLog} + LINKLOG_DATABASE_PATH: ${LINKLOG_DATABASE_PATH:-/app/backend/data/linklog.db} + LINKLOG_SECRET_KEY: ${LINKLOG_SECRET_KEY:?Set LINKLOG_SECRET_KEY in .env} + LINKLOG_TOKEN_EXPIRY_DAYS: ${LINKLOG_TOKEN_EXPIRY_DAYS:-30} + LINKLOG_TRACKING_PARAMS: ${LINKLOG_TRACKING_PARAMS:-} + restart: ${APP_RESTART_POLICY:-unless-stopped} + healthcheck: + test: ["CMD", "python", "-c", "from urllib.request import urlopen; urlopen('http://127.0.0.1:8000/health', timeout=3)"] + interval: ${APP_HEALTHCHECK_INTERVAL:-30s} + timeout: ${APP_HEALTHCHECK_TIMEOUT:-5s} + start_period: ${APP_HEALTHCHECK_START_PERIOD:-10s} + retries: ${APP_HEALTHCHECK_RETRIES:-3} + labels: + traefik.enable: true + traefik.http.middlewares.web-https-redirect.redirectscheme.scheme: https + traefik.http.services.linklog.loadbalancer.server.port: 8000 + traefik.docker.network: linklog_traefik # network to be shared with traefik + + + traefik.http.routers.linklog.entrypoints: web + traefik.http.routers.linklog.rule: Host(`linklog.example.com`) # Make sure to change + traefik.http.routers.linklog.middlewares: web-https-redirect,servicests # these middlewares must exist + traefik.http.routers.linklog-secure.entrypoints: websecure + traefik.http.routers.linklog-secure.rule: Host(`linklog.example.com`) #Make sure to change + traefik.http.routers.linklog-secure.tls: true + traefik.http.routers.linklog-secure.middlewares: servicests + + traefik.http.routers.linklog-secure.tls.certresolver: myresolver # or your resovler, e.g certbot + traefik.http.routers.linklog-secure.service: linklog \ No newline at end of file