service: bemeal
image: daily_meal/bemeal-api
deploy_timeout: 120

x-hosts: &hosts
  - <%= ENV.fetch("SSH_HOST", "89.167.35.217") %>

x-web-networks: &web-networks
  network:
    - bemeal_public
    - bemeal_internal

x-worker-networks: &worker-networks
  network:
    - bemeal_internal

servers:
  web:
    hosts: *hosts
    options: *web-networks
  horizon:
    hosts: *hosts
    cmd: php artisan horizon
    options: *worker-networks
  scheduler:
    hosts: *hosts
    cmd: php artisan schedule:work
    options: *worker-networks

proxy:
  host: bemeal.leonmorival.com
  ssl: false
  app_port: 80
  run:
    http_port: 8081
    https_port: 8443
  healthcheck:
    path: /api/health

registry:
  server: gitea.leonmorival.com
  username: leon.morival@gmail.com
  password:
    - GITEA_TOKEN

ssh:
  user: <%= ENV.fetch("SSH_USER", "root") %>
  keys_only: true
  key_data:
    - SSH_PRIVATE_KEY
  config: false

builder:
  arch: amd64

env:
  clear:
    APP_LOCALE: fr
    APP_ENV: production
    APP_DEBUG: "false"
    APP_NAME: "Bowly"
    APP_URL: https://bemeal.leonmorival.com
    APP_MOBILE_SCHEME: bowly
    SERVER_NAME: ":80"
    APP_RUNTIME: "Laravel\\FrankenPHP\\Runtime"
    FILESYSTEM_DISK: s3
    AWS_DEFAULT_REGION: eu-north-1
    AWS_BUCKET: bowli
    AWS_USE_PATH_STYLE_ENDPOINT: "false"
    DB_CONNECTION: pgsql
    DB_HOST: bemeal-pgsql
    DB_PORT: "5432"
    REDIS_HOST: bemeal-redis
    REDIS_CLIENT: predis
    QUEUE_CONNECTION: redis
    SCOUT_DRIVER: meilisearch
    MEILISEARCH_HOST: http://bemeal-meilisearch:7700
    MAIL_MAILER: resend
    MAIL_FROM_ADDRESS: onboarding@resend.dev
    MAIL_FROM_NAME: Bowli
    CASHIER_CURRENCY: eur
  secret:
    - APP_KEY
    - DB_DATABASE
    - DB_USERNAME
    - DB_PASSWORD
    - MEILISEARCH_KEY
    - GEMINI_API_KEY
    - STRIPE_KEY
    - STRIPE_SECRET
    - STRIPE_WEBHOOK_SECRET
    - STRAVA_CLIENT_ID
    - STRAVA_CLIENT_SECRET
    - RESEND_API_KEY
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY

volumes:
  - bemeal_storage_data:/var/www/html/storage/app
  - bemeal_storage_public_data:/var/www/html/storage/app/public

aliases:
  artisan: app exec --reuse "php artisan"
  shell: app exec --interactive --reuse "sh"
