x-db-credentials: &db-credentials # Use the default POSTGRES_ credentials if they're available or simply default to "listmonk" POSTGRES_USER: &db-user listmonk # for database user, password, and database name POSTGRES_PASSWORD: &db-password listmonk POSTGRES_DB: &db-name listmonk services: # listmonk app app: image: listmonk/listmonk:v4.1.0 container_name: listmonk_app restart: unless-stopped labels: kompose.controller.type: statefulset kompose.volume.type: persistentVolumeClaim kompose.volume.storage-class-name: local-tgz1 kompose.volume.size: 1Gi kompose.service.expose: listmonk.frytea.com kompose.service.expose.ingress-class-name: nginx kompose.service.expose.tls-secret: listmonk-frytea-com ports: - "127.0.0.1:9000:9000" # To change the externally exposed port, change to: $custom_port:9000 networks: - listmonk hostname: listmonk.frytea.com # Recommend using FQDN for hostname depends_on: - db command: [sh, -c, "./listmonk --install --idempotent --yes --config '' && ./listmonk --upgrade --yes --config '' && ./listmonk --config ''"] # --config (file) param is set to empty so that listmonk only uses the env vars (below) for config. # --install --idempotent ensures that DB installation happens only once on an empty DB, on the first ever start. # --upgrade automatically runs any DB migrations when a new image is pulled. environment: # The same params as in config.toml are passed as env vars here. LISTMONK_app__address: 0.0.0.0:9000 LISTMONK_db__user: *db-user LISTMONK_db__password: *db-password LISTMONK_db__database: *db-name LISTMONK_db__host: listmonk_db LISTMONK_db__port: 5432 LISTMONK_db__ssl_mode: disable LISTMONK_db__max_open: 25 LISTMONK_db__max_idle: 25 LISTMONK_db__max_lifetime: 300s TZ: Etc/UTC LISTMONK_ADMIN_USER: ${LISTMONK_ADMIN_USER:-songtianlun} # If these (optional) are set during the first `docker compose up`, then the Super Admin user is automatically created. LISTMONK_ADMIN_PASSWORD: ${LISTMONK_ADMIN_PASSWORD:-sotilu,LM2024} # Otherwise, the user can be setup on the web app after the first visit to http://localhost:9000 volumes: - ./data/uploads:/listmonk/uploads:rw # Mount an uploads directory on the host to /listmonk/uploads inside the container. # To use this, change directory path in Admin -> Settings -> Media to /listmonk/uploads # Postgres database db: image: postgres:17-alpine container_name: listmonk_db labels: kompose.controller.type: statefulset kompose.volume.type: persistentVolumeClaim kompose.volume.size: 5Gi kompose.volume.storage-class-name: local-tgz1 restart: unless-stopped ports: - "127.0.0.1:5433:5432" networks: - listmonk environment: <<: *db-credentials healthcheck: test: ["CMD-SHELL", "pg_isready -U listmonk"] interval: 10s timeout: 5s retries: 6 volumes: - ./data/db:/var/lib/postgresql/data networks: listmonk: