services:
  app_proxy:
    environment:
      APP_HOST: solidtime_app_1
      APP_PORT: 8000
      PROXY_AUTH_ADD: "false"

  app:
    image: solidtime/solidtime:0.12.1@sha256:e6c67c722b7237193b77eba7d9808f2b6bc65bcb232caaa6ecd1306a2daecfd3
    user: "1000:1000"
    restart: on-failure
    volumes:
      - "${APP_DATA_DIR}/data/app:/var/www/html/storage"
    environment:
      CONTAINER_MODE: "http"
      AUTO_DB_MIGRATE: "true"
      APP_NAME: "solidtime"
      VITE_APP_NAME: "solidtime"
      APP_ENV: "production"
      APP_DEBUG: "false"
      APP_URL: "http://${DEVICE_DOMAIN_NAME}:8770"
      APP_FORCE_HTTPS: "false"
      TRUSTED_PROXIES: "0.0.0.0/0,2000:0:0:0:0:0:0:0/3"

      # Аутентификация
      SUPER_ADMINS: "dfwebos@dfwebos.local"

      # Ведение журнала
      LOG_CHANNEL: "stderr_daily"
      LOG_LEVEL: "debug"

      # База данных
      DB_CONNECTION: "pgsql"
      DB_HOST: "solidtime_db_1"
      DB_PORT: "5432"
      DB_SSLMODE: "require"
      DB_DATABASE: "solidtime"
      DB_USERNAME: "solidtime"
      DB_PASSWORD: "solidtime"

      # Почта
      MAIL_MAILER: "smtp"
      MAIL_HOST: ""
      MAIL_PORT: ""
      MAIL_ENCRYPTION: "tls"
      MAIL_FROM_ADDRESS: "no-reply@your-domain.com"
      MAIL_FROM_NAME: "solidtime"
      MAIL_USERNAME: ""
      MAIL_PASSWORD: ""

      # Очередь
      QUEUE_CONNECTION: "database"

      # Хранение файлов
      FILESYSTEM_DISK: "local"
      PUBLIC_FILESYSTEM_DISK: "public"

      # Услуги
      GOTENBERG_URL: "http://solidtime_gotenberg_1:3000"
    env_file:
      - ${APP_DATA_DIR}/keys.env
    healthcheck:
      test: [ "CMD-SHELL", "curl --fail http://localhost:8000/health-check/up || exit 1" ]
    depends_on:
      db:
        condition: service_healthy

  scheduler:
    image: solidtime/solidtime:0.12.1@sha256:e6c67c722b7237193b77eba7d9808f2b6bc65bcb232caaa6ecd1306a2daecfd3
    user: "1000:1000"
    restart: on-failure
    volumes:
      - "${APP_DATA_DIR}/data/app:/var/www/html/storage"
    environment:
      CONTAINER_MODE: scheduler
      APP_NAME: "solidtime"
      VITE_APP_NAME: "solidtime"
      APP_ENV: "production"
      APP_DEBUG: "false"
      APP_URL: "http://${DEVICE_DOMAIN_NAME}:8770"
      APP_FORCE_HTTPS: "false"
      TRUSTED_PROXIES: "0.0.0.0/0,2000:0:0:0:0:0:0:0/3"

      # Аутентификация
      SUPER_ADMINS: "dfwebos@dfwebos.local"

      # Ведение журнала
      LOG_CHANNEL: "stderr_daily"
      LOG_LEVEL: "debug"

      # База данных
      DB_CONNECTION: "pgsql"
      DB_HOST: "solidtime_db_1"
      DB_PORT: "5432"
      DB_SSLMODE: "require"
      DB_DATABASE: "solidtime"
      DB_USERNAME: "solidtime"
      DB_PASSWORD: "solidtime"

      # Почта
      MAIL_MAILER: "smtp"
      MAIL_HOST: ""
      MAIL_PORT: ""
      MAIL_ENCRYPTION: "tls"
      MAIL_FROM_ADDRESS: "no-reply@your-domain.com"
      MAIL_FROM_NAME: "solidtime"
      MAIL_USERNAME: ""
      MAIL_PASSWORD: ""

      # Очередь
      QUEUE_CONNECTION: "database"

      # Хранение файлов
      FILESYSTEM_DISK: "local"
      PUBLIC_FILESYSTEM_DISK: "public"

      # Услуги
      GOTENBERG_URL: "http://solidtime_gotenberg_1:3000"
    env_file:
      - ${APP_DATA_DIR}/keys.env
    healthcheck:
      test: [ "CMD", "healthcheck" ]
    depends_on:
      db:
        condition: service_healthy

  queue:
    image: solidtime/solidtime:0.12.1@sha256:e6c67c722b7237193b77eba7d9808f2b6bc65bcb232caaa6ecd1306a2daecfd3
    user: "1000:1000"
    restart: on-failure
    volumes:
      - "${APP_DATA_DIR}/data/app:/var/www/html/storage"
    environment:
      CONTAINER_MODE: worker
      WORKER_COMMAND: "php /var/www/html/artisan queue:work"
      APP_NAME: "solidtime"
      VITE_APP_NAME: "solidtime"
      APP_ENV: "production"
      APP_DEBUG: "false"
      APP_URL: "http://${DEVICE_DOMAIN_NAME}:8770"
      APP_FORCE_HTTPS: "false"
      TRUSTED_PROXIES: "0.0.0.0/0,2000:0:0:0:0:0:0:0/3"

      # Аутентификация
      SUPER_ADMINS: "dfwebos@dfwebos.local"

      # Ведение журнала
      LOG_CHANNEL: "stderr_daily"
      LOG_LEVEL: "debug"

      # База данных
      DB_CONNECTION: "pgsql"
      DB_HOST: "solidtime_db_1"
      DB_PORT: "5432"
      DB_SSLMODE: "require"
      DB_DATABASE: "solidtime"
      DB_USERNAME: "solidtime"
      DB_PASSWORD: "solidtime"

      # Почта
      MAIL_MAILER: "smtp"
      MAIL_HOST: ""
      MAIL_PORT: ""
      MAIL_ENCRYPTION: "tls"
      MAIL_FROM_ADDRESS: "no-reply@your-domain.com"
      MAIL_FROM_NAME: "solidtime"
      MAIL_USERNAME: ""
      MAIL_PASSWORD: ""

      # Очередь
      QUEUE_CONNECTION: "database"

      # Хранение файлов
      FILESYSTEM_DISK: "local"
      PUBLIC_FILESYSTEM_DISK: "public"

      # Услуги
      GOTENBERG_URL: "http://solidtime_gotenberg_1:3000"
    env_file:
      - ${APP_DATA_DIR}/keys.env
    healthcheck:
      test: [ "CMD", "healthcheck" ]
    depends_on:
      db:
        condition: service_healthy

  db:
    image: 'postgres:17.3@sha256:0321e2252ebfeecb8bc1a899755084d29bce872953e1a5a3e25ec0860b739098'
    user: "1000:1000"
    restart: on-failure
    environment:
      PGPASSWORD: 'soldtime'
      POSTGRES_DB: 'solidtime'
      POSTGRES_USER: 'solidtime'
      POSTGRES_PASSWORD: 'solidtime'
    volumes:
      - '${APP_DATA_DIR}/data/db:/var/lib/postgresql/data'
    healthcheck:
      test:
        - CMD
        - pg_isready
        - '-q'
        - '-d'
        - 'solidtime'
        - '-U'
        - 'solidtime'
      retries: 3
      timeout: 5s

  gotenberg:
    image: gotenberg/gotenberg:8.17.1@sha256:46e7b68adeadda1794a9ab194f1e2939f5b09ff21aadef6000e84102c9af6dd5
    user: "1000:1000"
    restart: on-failure
    healthcheck:
      test: [ "CMD", "curl", "--silent", "--fail", "http://localhost:3000/health" ]
