# Name of your application. Used to uniquely configure containers.
service: dip_front

# Name of the container image (use your-user/app-name on external registries).
image: dip_front

# Deploy to these servers.
servers:
  web:
    - 153.127.48.108
  # job:
  #   hosts:
  #     - 153.127.48.108
  #   cmd: bin/jobs

# nginx がSSL終端を行うため、Kamal Proxy の SSL は無効化
proxy:
  ssl: false
  host: diplo.kontei.net
  app_port: 80

# Where you keep your container images.
# Using a local registry on the VPS server.
registry:
  server: localhost:5555
  username: kamal
  password:
    - KAMAL_REGISTRY_PASSWORD

# Inject ENV variables into containers (secrets come from .kamal/secrets).
env:
  secret:
    - RAILS_MASTER_KEY
  clear:
    # Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
    # When you start using multiple servers, you should split out job processing to a dedicated machine.
    SOLID_QUEUE_IN_PUMA: true

    # Set number of processes dedicated to Solid Queue (default: 1)
    # JOB_CONCURRENCY: 3

    # Set number of cores available to the application on each server (default: 1).
    # WEB_CONCURRENCY: 2

    # Diplomacy API URL (dip_api container accessible via Docker host network)
    DIPLOMACY_API_URL: http://172.17.0.1:8000

    # Log everything from Rails
    # RAILS_LOG_LEVEL: debug

# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
# "bin/kamal logs -r job" will tail logs from the first server in the job section.
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 --include-password"

# Use a persistent storage volume for sqlite database files and local Active Storage files.
# Recommended to change this to a mounted volume path that is backed up off server.
volumes:
  - "dip_front_storage:/rails/storage"

# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
# hitting 404 on in-flight requests. Combines all files from new and old
# version inside the asset_path.
asset_path: /rails/public/assets

# Configure the image builder.
# Build on the remote VPS server to avoid insecure registry issues.
builder:
  arch: amd64
  remote: ssh://kontei@153.127.48.108

# Use a non-root ssh user
ssh:
  user: kontei

# Use accessory services (secrets come from .kamal/secrets).
# accessories:
#   db:
#     image: mysql:8.0
#     host: 153.127.48.108
#     # Change to 3306 to expose port to the world instead of just local network.
#     port: "127.0.0.1:3306:3306"
#     env:
#       clear:
#         MYSQL_ROOT_HOST: '%'
#       secret:
#         - MYSQL_ROOT_PASSWORD
#     files:
#       - config/mysql/production.cnf:/etc/mysql/my.cnf
#       - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
#     directories:
#       - data:/var/lib/mysql
#   redis:
#     image: valkey/valkey:8
#     host: 153.127.48.108
#     port: 6379
#     directories:
#       - data:/data
