Allcrux : Rails app - one server with dev/staging/prod and a local PG accessory

Submitted by @koenhandekyn

Kamal deploy.yml

service: allcrux-corpware
image: xxx/allcrux

servers:
  web:
    - appserver.allcrux.com

registry:
  server: ghcr.io
  username: xxx
  password:
    - KAMAL_REGISTRY_PASSWORD

builder:
  arch: x86_64
  cache:
    type: gha

env:
  clear:
    CLOUD_PROVIDER: 'hetzner'
    ADMIN_SAML_SERVICE_URL: 'xxx'
    ALLCRUX_PREVIEW_REPORTS_BUCKET: 'xxx'
    ALLCRUX_REPORTS_BUCKET: 'xxx'
    AWS_REGION: 'xxx'
    DEFAULT_FROM_ADDRESS: xxx
    EXTERNAL_PROTOCOL: 'https'
    MAILGUN_API_HOST: 'xxx'
    MAILGUN_DOMAIN: 'xxx'
    OPENAI_MODEL: 'xxx'
    RAILS_ENV: 'production'
    RAILS_LOG_TO_STDOUT: 1
    SESSION_MINUTES: 525600
  secret:
    - RAILS_MASTER_KEY
    - ADMIN_OPENID_CLIENT_ID
    - ADMIN_OPENID_SECRET
    - ADMIN_OPENID_TENANT_ID
    - SECRET_KEY_BASE
    - MAILGUN_API_KEY
    - OPENAI_API_KEY
    - TWO_FACTOR_SECRET_KEY
    - ROLLBAR_ACCESS_TOKEN
    - AWS_ACCESS_KEY_ID
    - AWS_SECRET_ACCESS_KEY
    - DATABASE_URL
    - SIGNREQUEST_TOKEN
    - GIT_COMMIT_HASH

aliases:
  console: app exec --interactive --reuse "bin/rails console"
  shell: app exec --interactive --reuse "bash"
  logs: app logs -f
  dbc: app exec --interactive --reuse "bin/rails dbconsole"
  dblogs: accessory logs db -f

readiness_delay: 5
deploy_timeout: 120
# require_destination: true
retain_containers: 2

accessories:
  db:
    image: postgres:16
    port: 5432:5432
    host: appserver.allcrux.com
    env:
      secret:
        - POSTGRES_USER
        - POSTGRES_PASSWORD

    directories:
      - data:/var/lib/postgresql/data

Explanation

i can't add here but it goes together with other files, so some details here.

\n

(also the servers section is mandatory in the above but that's not really true if you want different servers for different destinations, so i think your validation is to strict for real use case)

\n

*deploy.development.yml*

\n

```
proxy:
ssl: true
hosts:
- development.somewhere-eu.allcrux.com
- development.somewhere-us.allcrux.com

env:
clear:
S3_BUCKET: 'allcrux-development'
ALLCRUX_WATERMARK: 'development'
```

\n

and similar for the other environments