# documentation: https://nitropage.com
# slogan: Nitropage is an extensible visual website builder, offering a growing collection of versatile building blocks, focal-point image cropping and sovereign font management.
# tags: nitropage, builder, editor, wysiwyg, cms, content, management
# logo: svgs/nitropage.svg
# port: 3000

services:
  nitropage:
    image: codeberg.org/nitropage/nitropage
    environment:
      - SERVICE_FQDN_NITROPAGE_3000
      - NP_AUTH_SALT=${SERVICE_BASE64_SALT}
      - NP_AUTH_PASSWORD=${SERVICE_PASSWORD_64_SESSION}
      - DATABASE_URL=postgresql://${SERVICE_USER_POSTGRESQL}:${SERVICE_PASSWORD_POSTGRESQL}@postgresql:5432/${POSTGRESQL_DATABASE:-nitropage}
    volumes:
      - nitropage-data:/app/.data
    depends_on:
      postgresql:
        condition: service_healthy
    healthcheck:
      test: ["CMD", "curl", "-f", "http://127.0.0.1:3000/admin"]
      interval: 2s
      timeout: 10s
      retries: 15
  postgresql:
    image: postgres:16-alpine
    volumes:
      - nitropage-postgresql-data:/var/lib/postgresql/data
    environment:
      - POSTGRES_USER=${SERVICE_USER_POSTGRESQL}
      - POSTGRES_PASSWORD=${SERVICE_PASSWORD_POSTGRESQL}
      - POSTGRES_DB=${POSTGRESQL_DATABASE:-nitropage}
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
      interval: 5s
      timeout: 20s
      retries: 10
