practice doing this
at main 3.9 kB view raw
1# Name of your application. Used to uniquely configure containers. 2service: practice 3 4# Name of the container image (use your-user/app-name on external registries). 5image: practice 6 7# Deploy to these servers. 8servers: 9 web: 10 - 192.168.0.1 11 # job: 12 # hosts: 13 # - 192.168.0.1 14 # cmd: bin/jobs 15 16# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server. 17# If used with Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption. 18# 19# Using an SSL proxy like this requires turning on config.assume_ssl and config.force_ssl in production.rb! 20# 21# Don't use this when deploying to multiple web servers (then you have to terminate SSL at your load balancer). 22# 23# proxy: 24# ssl: true 25# host: app.example.com 26 27# Where you keep your container images. 28registry: 29 # Alternatives: hub.docker.com / registry.digitalocean.com / ghcr.io / ... 30 server: localhost:5555 31 32 # Needed for authenticated registries. 33 # username: your-user 34 35 # Always use an access token rather than real password when possible. 36 # password: 37 # - KAMAL_REGISTRY_PASSWORD 38 39# Inject ENV variables into containers (secrets come from .kamal/secrets). 40env: 41 secret: 42 - RAILS_MASTER_KEY 43 clear: 44 # Run the Solid Queue Supervisor inside the web server's Puma process to do jobs. 45 # When you start using multiple servers, you should split out job processing to a dedicated machine. 46 SOLID_QUEUE_IN_PUMA: true 47 48 # Set number of processes dedicated to Solid Queue (default: 1) 49 # JOB_CONCURRENCY: 3 50 51 # Set number of cores available to the application on each server (default: 1). 52 # WEB_CONCURRENCY: 2 53 54 # Match this to any external database server to configure Active Record correctly 55 # Use practice-db for a db accessory server on same machine via local kamal docker network. 56 # DB_HOST: 192.168.0.2 57 58 # Log everything from Rails 59 # RAILS_LOG_LEVEL: debug 60 61# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation: 62# "bin/kamal logs -r job" will tail logs from the first server in the job section. 63aliases: 64 console: app exec --interactive --reuse "bin/rails console" 65 shell: app exec --interactive --reuse "bash" 66 logs: app logs -f 67 dbc: app exec --interactive --reuse "bin/rails dbconsole --include-password" 68 69# Use a persistent storage volume for sqlite database files and local Active Storage files. 70# Recommended to change this to a mounted volume path that is backed up off server. 71volumes: 72 - "practice_storage:/rails/storage" 73 74# Bridge fingerprinted assets, like JS and CSS, between versions to avoid 75# hitting 404 on in-flight requests. Combines all files from new and old 76# version inside the asset_path. 77asset_path: /rails/public/assets 78 79 80# Configure the image builder. 81builder: 82 arch: amd64 83 84 # # Build image via remote server (useful for faster amd64 builds on arm64 computers) 85 # remote: ssh://docker@docker-builder-server 86 # 87 # # Pass arguments and secrets to the Docker build process 88 # args: 89 # RUBY_VERSION: ruby-3.4.8 90 # secrets: 91 # - GITHUB_TOKEN 92 # - RAILS_MASTER_KEY 93 94# Use a different ssh user than root 95# ssh: 96# user: app 97 98# Use accessory services (secrets come from .kamal/secrets). 99# accessories: 100# db: 101# image: mysql:8.0 102# host: 192.168.0.2 103# # Change to 3306 to expose port to the world instead of just local network. 104# port: "127.0.0.1:3306:3306" 105# env: 106# clear: 107# MYSQL_ROOT_HOST: '%' 108# secret: 109# - MYSQL_ROOT_PASSWORD 110# files: 111# - config/mysql/production.cnf:/etc/mysql/my.cnf 112# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql 113# directories: 114# - data:/var/lib/mysql 115# redis: 116# image: valkey/valkey:8 117# host: 192.168.0.2 118# port: 6379 119# directories: 120# - data:/data