# Terminal gem set up rails --pre kamal setup kamal deploy kamal config rails action_text:set up rails g scaffold put up title content material:rich_text rails g job update_post_title
# config/deploy.yml
# Identify of your software. Used to uniquely configure containers.
service: app1
# Identify of the container picture.
picture: kobaltz/app1
# Deploy to those servers.
servers:
net:
- 134.122.126.42
# job:
# hosts:
# - 134.122.126.42
# cmd: bin/jobs
# Allow SSL auto certification through Let's Encrypt (and permit for a number of apps on one server).
# If utilizing one thing like Cloudflare, it is suggested to set encryption mode
# in Cloudflare's SSL/TLS setting to "Full" to allow end-to-end encryption.
proxy:
ssl: true
host: app.talkrails.com,www.talkrails.com
# kamal-proxy connects to your container over port 80, use `app_port` to specify a unique port.
# app_port: 3000
# Credentials on your picture host.
registry:
# Specify the registry server, if you happen to're not utilizing Docker Hub
# server: registry.digitalocean.com / ghcr.io / ...
username: kobaltz
# All the time use an entry token relatively than actual password (pulled from .kamal/secrets and techniques).
password:
- KAMAL_REGISTRY_PASSWORD
# Configure builder setup.
builder:
arch: amd64
# Inject ENV variables into containers (secrets and techniques come from .kamal/secrets and techniques).
#
# env:
# clear:
# DB_HOST: 192.168.0.2
# secret:
# - RAILS_MASTER_KEY
# Aliases are triggered with "bin/kamal <alias>". You'll be able to overwrite arguments on invocation:
# "bin/kamal logs -r job" will tail logs from the primary server within the job part.
#
# aliases:
# shell: app exec --interactive --reuse "bash"
# Use a unique ssh consumer than root
#
# ssh:
# consumer: app
# Use a persistent storage quantity.
#
# volumes:
# - "app_storage:/app/storage"
# Bridge fingerprinted property, like JS and CSS, between variations to keep away from
# hitting 404 on in-flight requests. Combines all information from new and outdated
# model contained in the asset_path.
#
# asset_path: /app/public/property
# Configure rolling deploys by setting a wait time between batches of restarts.
#
# boot:
# restrict: 10 # May also specify as a share of whole hosts, equivalent to "25%"
# wait: 2
# Use accent providers (secrets and techniques come from .kamal/secrets and techniques).
#
# equipment:
# db:
# picture: mysql:8.0
# host: 192.168.0.2
# port: 3306
# env:
# clear:
# MYSQL_ROOT_HOST: '%'
# secret:
# - MYSQL_ROOT_PASSWORD
# information:
# - config/mysql/manufacturing.cnf:/and so forth/mysql/my.cnf
# - db/manufacturing.sql:/docker-entrypoint-initdb.d/setup.sql
# directories:
# - information:/var/lib/mysql
# redis:
# picture: redis:7.0
# host: 192.168.0.2
# port: 6379
# directories:
# - information:/information
# app/fashions/put up.rb class Publish < ApplicationRecord has_rich_text :content material broadcasts finish
# app/views/posts/present.html.erb <%= turbo_stream_from @put up %>
# config/environments/manufacturing.rb
Rails.software.routes.default_url_options = { host: "app.talkrails.com", protocol: :https }
# app/jobs/update_post_title_job.rb
class UpdatePostTitleJob < ApplicationJob
queue_as :default
def carry out
put up = Publish.all.pattern
put up.title = SecureRandom.hex
put up.save
finish
finish
# config/recurring.yml
manufacturing:
random_title:
class: UpdatePostTitleJob
queue: background
schedule: each 1 seconds

