{"id":15527159,"url":"https://github.com/berlinmagic/magic_recipes_two","last_synced_at":"2025-04-23T12:15:21.623Z","repository":{"id":26866069,"uuid":"30326333","full_name":"berlinmagic/magic_recipes_two","owner":"berlinmagic","description":"Our recipes for Capistrano-3, including: Monit, letsencrypt (install, build, update-cron-job), nGinX, sidekiq, redis, postgres, secret-handling, slack-messages, ...","archived":false,"fork":false,"pushed_at":"2023-07-18T18:04:47.000Z","size":263,"stargazers_count":2,"open_issues_count":13,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-23T12:14:58.837Z","etag":null,"topics":["capistrano-tasks","letsencrypt","monit","nginx","sidekiq","slack","thin"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/berlinmagic.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-04T23:06:24.000Z","updated_at":"2022-06-19T10:58:36.000Z","dependencies_parsed_at":"2025-03-05T12:42:04.727Z","dependency_job_id":null,"html_url":"https://github.com/berlinmagic/magic_recipes_two","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlinmagic%2Fmagic_recipes_two","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlinmagic%2Fmagic_recipes_two/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlinmagic%2Fmagic_recipes_two/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berlinmagic%2Fmagic_recipes_two/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berlinmagic","download_url":"https://codeload.github.com/berlinmagic/magic_recipes_two/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250430598,"owners_count":21429324,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capistrano-tasks","letsencrypt","monit","nginx","sidekiq","slack","thin"],"created_at":"2024-10-02T11:04:46.411Z","updated_at":"2025-04-23T12:15:21.604Z","avatar_url":"https://github.com/berlinmagic.png","language":"Ruby","readme":"# MagicRecipesTwo\n\nOur most used recipes for Capistrano-3!\n\nNot using capistrano-3, see [Capistrano 2 version](https://github.com/twetzel/magic_recipes)\n\n\n### Includes\n\n- **assets** compile assets locally, than upload them (fully integrated)\n- **db** seed task + backup task\n- **exception_pages** copy exception pages from assets to public (if you generate them with sprockets)\n- **inform_slack** inform a slack channel about successful upload\n- **lets encrypt** install certs, add cron job, create Diffie-Hellman\n- **monit** control monit with monit-webinterface\n- **nginx** control nginx with several instances and ssl\n- **redirect_page** a page that redirects to new domain after 10 sec. info old-page -\u003e new-page\n- **redis** control redis\n- **secrets** handling of rails 4 secrets\n- **sidekiq** control sidekiq\n- **sidekiq_six** control sidekiq with systemd deamon\n- **thin** control thin\n- **thin_sysd** control thin with systemd deamon\n\n\n### ChangeLog:\n\n- [see gem CHANGELOG](https://github.com/berlinmagic/magic_recipes_two/blob/master/CHANGELOG.md)\n\n\n\n### DOCU:\n\n- [MONIT](/docs/monit.md)\n\n\n\n\n\n\n\n\n---\n#### Still work in progress .. so maybe not  ready for your needs! .. but also used a lot in production :)\n---\n\n## Usage\n\n- add Gem to your gemfile\n```ruby\n  gem 'magic_recipes_two', '\u003e= 0.0.95', group: :development\n```\n- run `bundle`\n- run `bundle exec cap install`\n- add the following:\n\n\n## in Capfile\n\n```ruby\n    ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n    ## MagicRecipes .. pick what you need\n    \n    # =\u003e require 'capistrano/rvm'\n    # =\u003e require 'rvm1/capistrano3'\n    # =\u003e require 'capistrano/bundler'\n    # =\u003e require 'capistrano/rails/assets'\n    # =\u003e require 'capistrano/rails/migrations'\n    # =\u003e require 'capistrano/postgresql'\n    \n    # =\u003e require 'capistrano/magic_recipes/assets'\n    # =\u003e require 'capistrano/magic_recipes/db'\n    # =\u003e require 'capistrano/magic_recipes/exception_pages'\n    # =\u003e require 'capistrano/magic_recipes/inform_slack'\n    # =\u003e require 'capistrano/magic_recipes/lets_encrypt'\n    # =\u003e require 'capistrano/magic_recipes/logs'\n    # =\u003e require 'capistrano/magic_recipes/monit'\n    # =\u003e require 'capistrano/magic_recipes/nginx'\n    # =\u003e require 'capistrano/magic_recipes/pwa'\n    # =\u003e require 'capistrano/magic_recipes/redis'\n    # =\u003e require 'capistrano/magic_recipes/redirect_page'\n    # =\u003e require 'capistrano/magic_recipes/secrets'\n    # =\u003e require 'capistrano/magic_recipes/sidekiq'\n\t\t# =\u003e require 'capistrano/magic_recipes/sidekiq_six'\n    # =\u003e require 'capistrano/magic_recipes/thin'\n\t\t# =\u003e require 'capistrano/magic_recipes/thin_sysd'\n    \n    ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n```\n\n\n## in deploy file\n\n```ruby\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n## MagicRecipes .. pick what you need\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n    \n    # =\u003e set :user,        'deployuser'\n    # =\u003e set :deploy_to,   \"/home/#{fetch(:user)}/#{fetch(:application)}-#{fetch(:stage)}\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e bundler\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :bundle_roles,         :all                                  # this is default\n    # =\u003e set :bundle_servers,       release_roles(fetch(:bundle_roles)) } # this is default\n    # =\u003e set :bundle_binstubs,      shared_path.join('bin') }             # default: nil\n    # =\u003e set :bundle_gemfile,       release_path.join('MyGemfile') }      # default: nil\n    # =\u003e set :bundle_path,          shared_path.join('my_special_bundle') # default: nil\n    # =\u003e set :bundle_without,       %w{development test}.join(' ')        # this is default\n    # =\u003e set :bundle_flags,         '--deployment --quiet'                # this is default\n    # =\u003e set :bundle_env_variables, {}                                    # this is default\n    # =\u003e set :bundle_bins, fetch(:bundle_bins, []).push('my_new_binary')  # You can add any custom executable to this list\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e db\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :db_roles,             :db\n    # =\u003e set :db_backup_on_deploy,  false   # make DB backup (yaml_db) before deployment\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e inform slack\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :slack_token,           \"xxx-xxx-xxx-xxx\"\n    # =\u003e set :slack_channel,         \"xxx-xxx-xxx-xxx\" # \"channel_id\" or \"#channel_name\"\n    # =\u003e set :slack_text,            \"New Deployment on *#{ fetch(:stage) }* ... check:  #{fetch(:nginx_use_ssl) ? 'https': 'htpp'}://#{ fetch(:nginx_major_domain) ? fetch(:nginx_major_domain).gsub(/^\\*?\\./, \"\") : Array( fetch(:nginx_domains) ).first.gsub(/^\\*?\\./, \"\") }\"\n    # =\u003e set :slack_username,        \"capistrano (#{fetch(:stage)})\"\n    # =\u003e set :slack_production_icon, \"http://icons.iconarchive.com/icons/itzikgur/my-seven/128/Backup-IBM-Server-icon.png\"\n    # =\u003e set :slack_staging_icon,    \"http://itekblog.com/wp-content/uploads/2012/07/railslogo.png\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e lets encrypt  .. needs *nginx* :allow_well_known to be true!\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :lets_encrypt_roles,         :web\n    # =\u003e set :lets_encrypt_path,          \"~\"\n    # Array without www.domains \"www\" will be auto-added! .. First domain is main one!\n    # =\u003e set :lets_encrypt_domains,       fetch(:nginx_major_domain,false) ? [fetch(:nginx_major_domain)] + Array(fetch(:nginx_domains)) : Array(fetch(:nginx_domains))\n    # =\u003e set :lets_encrypt__www_domains,  true # also encrypt www. domains\n    # =\u003e set :lets_encrypt_cron_log,      \"#{shared_path}/log/lets_encrypt_cron.log\"\n    # =\u003e set :lets_encrypt_email,         \"admin@example.com\"\n\t# Client type: new: \"certbot\" or old \"certbot-auto\"\n\t# =\u003e set :lets_encrypt_client,        \"certbot-auto\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e logs .. (if you need to check app log-files)\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :logs_roles,                 :web    # on roles ..\n    # =\u003e set :logs_show_lines,            500     # show the last .. lines of log-file\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e monit\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    ## Status (monit is running or not .. activate monit hooks in deploy chain)\n    # =\u003e set :monit_active,                         true\n    ## Main-Instance (write monitrc?)\n    # =\u003e set :monit_main_rc,                        true\n    ## Monit-Processes (what should be monitored) = nginx pm2 postgresql pwa redis sidekiq thin website\n    # =\u003e set :monit_processes,                      %w[nginx postgresql thin website]\n    # =\u003e set :monit_name,                           \"#{ fetch(:application) }_#{ fetch(:stage) }\"\n    ## Monit System\n    # =\u003e set :monit_roles,                          :web\n    # =\u003e set :monit_interval,                       30\n    # =\u003e set :monit_bin,                            '/usr/bin/monit'\n    ## Monit Log-File (Monit default: '/var/log/monit.log')\n    # =\u003e set :monit_logfile,                        \"#{shared_path}/log/monit.log\"\n    # =\u003e set :monit_idfile,                         '/var/lib/monit/id'\n    # =\u003e set :monit_statefile,                      '/var/lib/monit/state'\n    ## Downgrade to 5.16 on deploy (to fix action problems):\n    # =\u003e set :monit_downgrade_on_deploy,            false\n    ## Mailer\n    # =\u003e set :monit_mail_server,                    \"smtp.gmail.com\"\n    # =\u003e set :monit_mail_port,                      587\n    # =\u003e set :monit_mail_authentication,            false # SSLAUTO|SSLV2|SSLV3|TLSV1|TLSV11|TLSV12\n    # =\u003e set :monit_mail_username,                  \"foo@example.com\"\n    # =\u003e set :monit_mail_password,                  \"secret\"\n    # =\u003e set :monit_ignore,                         []  # %w[action pid]\n    ## Change me!!\n    # =\u003e set :monit_mail_to,                        \"foo@example.com\"\n    # =\u003e set :monit_mail_from,                      \"monit@foo.bar\"\n    # =\u003e set :monit_mail_reply_to,                  \"support@foo.bar\"\n    ## Additional stuff for postrgres\n    # =\u003e set :monit_pg_pid,                       \t\"/var/run/postgresql/12-main.pid\"\n    ## Additional stuff for thin (need secrets_key_base to be set)\n    # =\u003e set :monit_thin_totalmem_mb,               300\n    ## Additional stuff for sidekiq (need secrets_key_base to be set)\n    # =\u003e set :monit_sidekiq_totalmem_mb,            300\n    # =\u003e set :monit_sidekiq_timeout_sec,            90\n    ## Additional App helpers (for in app processes like: thin, sidekiq)\n    # =\u003e set :monit_app_worker_command,             \"cd #{ current_path } ; #{fetch(:rvm_path)}/bin/rvm #{fetch(:rvm_ruby_version)} do bundle exec MONIT_CMD\"\n    #   needs to include at least MONIT_CMD, which gets replaced with current command\n    #   ## RVM:\n    #    - \"cd #{ current_path } ; #{fetch(:rvm_path)}/bin/rvm #{fetch(:rvm_ruby_version)} do bundle exec MONIT_CMD\"\n    #   ## RVM1Caspistrano3:\n    #    - \"cd #{ current_path } ; #{fetch(:rvm1_auto_script_path)}/rvm-auto.sh #{fetch(:rvm1_ruby_version)} bundle exec MONIT_CMD\"\n    #   ## if all is root\n    #    - \"/usr/bin/env cd #{current_path} ; bundle exec MONIT_CMD\"\n    #   ## last option (if nothing else helps)\n    #    - \"/bin/su - #{@role.user} -c 'cd #{current_path} ; bundle exec MONIT_CMD'\"\n    ## WebClient\n    # =\u003e set :monit_http_client,                    true\n    # =\u003e set :monit_http_port,                      2812\n    # =\u003e set :monit_http_username,                  \"admin\"\n    # =\u003e set :monit_http_password,                  \"monitor\"\n    # use a domain / subdomain for monit?\n    # =\u003e set :monit_webclient,             \t\t\t\t\tfalse\n    # =\u003e set :monit_webclient_domain,      \t\t\t\t\tfalse\n    # =\u003e set :monit_webclient_use_ssl,     \t\t\t\t\tfalse\n    # =\u003e set :monit_webclient_ssl_cert,    \t\t\t\t\tfalse\n    # =\u003e set :monit_webclient_ssl_key,     \t\t\t\t\tfalse\n    # =\u003e set :monit_nginx_template,        \t\t\t\t\t:default\n    ## Website\n    # =\u003e set :monit_website_check_content,          false\n    # =\u003e set :monit_website_check_path,             \"/\"\n    # =\u003e set :monit_website_check_text,             \"\u003c!DOCTYPE html\u003e\"\n    # =\u003e set :monit_website_check_timeout,          20\n    # =\u003e set :monit_website_check_cycles,           3\n    ## check other Sites:\n    set :monit_websites_to_check,     \t\t\t\t\t\t\t[]  # instance =\u003e { name: String, domain: String, ssl: Boolean, check_content: Boolean, path: String, content: String }\n    ## M/Monit\n    # =\u003e set :monit_mmonit_url,                     false\n    ## PM2 - JS - App\n    # set :monit_pm2_app_name,                      \"app\"\n    # set :monit_pm2_app_instances,                 1\n    # set :monit_pm2_app_path,                      \"/home/#{fetch(:user)}/pm2_app\"\n    # set :monit_pm2_pid_path,                      \"/home/#{fetch(:user)}/.pm2/pids\"\n    # set :monit_pm2_start_script,                  \"ecosystem.config.js\"\n    # set :monit_pm2_stage,                         \"production\"\n    # set :pm2_roles,                               :web\n    # set :monit_pm2_worker_role,                   :user\n    ## if prefix for monit command is needed .. ie: \"[ -s \\\"$HOME/.nvm/nvm.sh\\\" ] \u0026\u0026 \\. \\\"$HOME/.nvm/nvm.sh\\\" ; nvm use 9.9.0 ; \"\n    # set :monit_pm2_worker_prefix,                 \"\"\n\t\t## check website powered by pm2 .. for more settings use :monit_websites_to_check\n    # set :monit_pm2_check_website,     \t\t\t\t\t\tfalse\n    # set :monit_pm2_website_name,      \t\t\t\t\t\t\"PM2 #{fetch(:application)} #{fetch(:stage)}\"\n    # set :monit_pm2_website_url,       \t\t\t\t\t\t\"example.com\"\n    # set :monit_pm2_website_ssl,       \t\t\t\t\t\tfalse\n    ## check other Sites:\n    set :monit_websites_to_check,     \t\t\t\t\t\t\t[]\n    # Website: { name: String, domain: String, ssl: Boolean, check_content: Boolean, path: String, content: String }\n    ## Check files\n    set :monit_files_to_check,        \t\t\t\t\t\t\t[]\n    ## FILE: { name: String, path: String, max_size: Integer, clear: Boolean }\n    ## Slack Alerts\n    set :monit_use_slack,             \t\t\t\t\t\t\tfalse\n    set :monit_slack_webhook,         \t\t\t\t\t\t\t\"\" # your Slack webhook URL\n    set :monit_slack_bin_path,        \t\t\t\t\t\t\t\"/etc/monit/alert_slack.sh\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e nginx\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :app_server_ip,                   \"127.0.0.1\"\n    ## all domains the app uses\n    # =\u003e set :nginx_domains,                   []               # array of domains\n    ## app is the default site for this server?\n    # =\u003e set :default_site,                    false            # true | false\n    ## all domains are redirected to this one, domain\n    # =\u003e set :nginx_major_domain,              false            # \"domain-name.tld\" | false\n    ## remove \"www\" from each request?\n    # =\u003e set :nginx_remove_www,                true             # true | false\n    ## how many (thin) server instances \n    # =\u003e set :app_instances,                   1                # number \u003e= 1\n    ## use wildcard for domain?\n    # =\u003e set :nginx_domain_wildcard,           false\n    ## redirect all subdomains?\n    # =\u003e set :nginx_redirect_subdomains,       false\n    ## nginx service path\n    # =\u003e set :nginx_service_path,              'service nginx'\n    # =\u003e set :nginx_roles,                     :web\n    # =\u003e set :nginx_log_path,                  \"#{shared_path}/log\"\n    # =\u003e set :nginx_root_path,                 \"/etc/nginx\"\n    # =\u003e set :nginx_static_dir,                \"public\"\n    # =\u003e set :nginx_sites_enabled,             \"sites-enabled\"\n    # =\u003e set :nginx_sites_available,           \"sites-available\"\n    # =\u003e set :nginx_template,                  :default\n    # =\u003e set :nginx_use_ssl,                   false\n    ## ssl certificates\n    # =\u003e set :nginx_ssl_cert,                  \"/etc/ssl/certs/#{fetch(:application)}.crt\"\n    # =\u003e set :nginx_ssl_key,                   \"/etc/ssl/private/#{fetch(:application)}.key\"\n    ## certs for other domains (when :nginx_major_domain is set)\n    # =\u003e set :nginx_other_ssl_cert,            fetch(:nginx_ssl_cert)\n    # =\u003e set :nginx_other_ssl_key,             fetch(:nginx_ssl_key)\n    ## activate nginx hooks in deploy chain ?\n    # =\u003e set :nginx_hooks,                     true\n    ## Lets Encrypt - Challenge Path\n    # =\u003e set :allow_well_known,                false\n    ## only turn on, when rails :force_ssl is false !\n    # =\u003e set :nginx_strict_security,           false\n    # Diffie-Hellman settings\n    # =\u003e set :nginx_use_diffie_hellman,        false\n    # =\u003e set :nginx_diffie_hellman_param,      \"/etc/ssl/certs/dhparam.pem\"\n    # =\u003e set :nginx_ssl_ciphers,               \".. long cipher string ..\" # check: https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e NginX - Proxy-Cache\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # -\u003e Send appropriate cache headers ( Cache-Control: max-age=X, public ) to activate cache\n    # -\u003e Send bypass headers ( bypass_proxy: true ) to bypass cache\n    ## ## ##\n    ## Cache Rails-App\n    ## ## ##\n    # =\u003e set :proxy_cache_rails,           false                                                   # cache active?\n    # =\u003e set :proxy_cache_rails_directory, \"#{shared_path}/tmp/proxy_cache/rails\"                  # cache directory\n    # =\u003e set :proxy_cache_rails_levels,    \"1:2\"                                                   # cache level\n    # =\u003e set :proxy_cache_rails_name,      \"RAILS_#{fetch(:application)}_#{fetch(:stage)}_CACHE\"   # cache name\n    # =\u003e set :proxy_cache_rails_size,      \"4m\"                                                    # max-key-size ( 1m = 8000 keys)\n    # =\u003e set :proxy_cache_rails_time,      \"24h\"                                                   # cache invalidate after\n    # =\u003e set :proxy_cache_rails_max,       \"1g\"                                                    # max-cache-size\n    # cache 200 / 302 Pages ?\n    # =\u003e set :proxy_cache_rails_200,       false                                                   # false | time\n    # cache 404 Pages ?\n    # =\u003e set :proxy_cache_rails_404,       \"60m\"                                                   # false | time\n    # use stale content when state is in:\n    # =\u003e set :proxy_cache_rails_stale,     [\"error\", \"timeout\", \"invalid_header\", \"updating\"]      # stale when (array)\n    ## ## ##\n    ## Cache Media (Dragonfly/Paperclip/..) \n    ## ## ##\n    # =\u003e set :proxy_cache_media,           false                                                   # cache active?\n    # media-path ('media' for dargonfly, 'system' for paperclip)\n    # =\u003e set :proxy_cache_media_path,      \"media\"                                                 # media path (string)\n    # =\u003e set :proxy_cache_media_directory, \"#{shared_path}/tmp/proxy_cache/media\"                  # cache directory\n    # =\u003e set :proxy_cache_media_levels,    \"1:2\"                                                   # cache level\n    # =\u003e set :proxy_cache_media_name,      \"MEDIA_#{fetch(:application)}_#{fetch(:stage)}_CACHE\"   # cache name\n    # =\u003e set :proxy_cache_media_size,      \"2m\"                                                    # max-key-size ( 1m = 8000 keys)\n    # =\u003e set :proxy_cache_media_time,      \"48h\"                                                   # cache invalidate after\n    # =\u003e set :proxy_cache_media_max,       \"1g\"                                                    # max-cache-size\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e pwa\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :pwa_roles,           :web\n    # =\u003e set :pwa_application,     \"#{fetch(:application)}_mobile\"\n    ## Pathes\n    # =\u003e set :pwa_root_path,       \"#{ current_path }/dist\"\n    # =\u003e set :pwa_local_path,      \"./dist/\"\n    ## Site (nginx helper)\n    # =\u003e set :pwa_domains,         []\n    # =\u003e set :pwa_major_domain,    false\n    # =\u003e set :pwa_ssl_domains,     fetch(:pwa_major_domain,false) ? [fetch(:pwa_major_domain)] + Array(fetch(:pwa_domains)) : Array(fetch(:pwa_domains))\n    # =\u003e set :pwa_is_default_site, false\n    # =\u003e set :pwa_nginx_hooks,     false\n    # =\u003e set :pwa_nginx_template,  :default\n    ## SSL (lets_encrypt helper)\n    # =\u003e set :pwa_use_ssl,         false\n    # =\u003e set :pwa_ssl_cert,        \"\"\n    # =\u003e set :pwa_ssl_key,         \"\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e postgresql\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :pg_database,         \"#{fetch(:application)}_#{fetch(:stage)}\"\n    # =\u003e set :pg_user,             fetch(:pg_database)\n    # =\u003e set :pg_ask_for_password, false\n    # =\u003e set :pg_password,         ask_for_or_generate_password\n    # =\u003e set :pg_system_user,      'postgres'\n    # =\u003e set :pg_system_db,        'postgres'\n    # =\u003e set :pg_use_hstore,       false\n    # =\u003e set :pg_extensions,       []\n    ## template only settings\n    # =\u003e set :pg_templates_path,   'config/deploy/templates'\n    # =\u003e set :pg_env,              fetch(:rails_env) || fetch(:stage)\n    # =\u003e set :pg_pool,             5\n    # =\u003e set :pg_encoding,         'unicode'\n    ## for multiple release nodes automatically use server hostname (IP?) in the database.yml\n    # =\u003e set :pg_host, -\u003e do\n    # =\u003e   if release_roles(:all).count == 1 \u0026\u0026 release_roles(:all).first == primary(:db)\n    # =\u003e     'localhost'\n    # =\u003e   else\n    # =\u003e     primary(:db).hostname\n    # =\u003e   end\n    # =\u003e end\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e rails\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :rails_env, 'staging'                  # If the environment differs from the stage name\n    # =\u003e set :migration_role, 'migrator'            # Defaults to 'db'\n    # =\u003e set :conditionally_migrate, true           # Defaults to false. If true, it's skip migration if files in db/migrate not modified\n    # =\u003e set :assets_roles, [:web, :app]            # Defaults to [:web]\n    # =\u003e set :assets_prefix, 'prepackaged-assets'   # Defaults to 'assets' this should match config.assets.prefix in your rails config/application.rb\n    ## If you need to touch public/images, public/javascripts and public/stylesheets on each deploy:\n    # =\u003e set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e redirect_page\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :redirect_page_active,        false  # auto-include on each deploy ?\n    # =\u003e set :redirect_old_domains,        []     # list of old sites to redirect (ie:  ['test.com', 'try.com'])\n    # =\u003e set :redirect_old_ssl_domains,    []     # which old_sites have ssl (ie:  ['test.com'])\n    # =\u003e set :redirect_new_domain,         ''     # domain of new page (ie:  https://example.com)\n    # =\u003e set :redirect_new_name,           ''     # name of new page (ie:  example.com)\n    # =\u003e set :redirect_ssl_cert,           ''     # path to cert for all old_ssl_domains\n    # =\u003e set :redirect_ssl_key,            ''     # path to key for all old_ssl_domains\n    ## deeper configs\n    # =\u003e set :redirect_roles,              :app\n    # =\u003e set :redirect_index_path,         \"redirector\"\n    # =\u003e set :redirect_index_parent,       \"#{ shared_path }\"\n    # =\u003e set :redirect_index_template,     :default\n    # =\u003e set :redirect_nginx_template,     :default\n    # =\u003e set :redirect_conf_name,          \"redirector_#{fetch(:application)}_#{fetch(:stage)}\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e redis\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :redis_roles,            :web\n    # =\u003e set :redis_pid,              \"/var/run/redis/redis-server.pid\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e rvm  (if used)\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :rvm_type,               :user               # Defaults to: :auto .. (:auto | :system | :user)\n    # =\u003e set :rvm_ruby_version,       '2.0.0-p247'        # Defaults to: 'default'\n    # =\u003e set :rvm_custom_path,        '~/.myveryownrvm'   # only needed if not detected\n    # =\u003e set :rvm_roles,              [:app, :web]\n    # =\u003e set :rvm_map_bins,           %w{gem rake ruby bundle}\n\t# =\u003e set :rvm_path,               '/usr/local/rvm'\n    \n        \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e rvm1capistrano3  (if used)\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :rvm1_ruby_version,      \".\"\n    # =\u003e set :rvm1_map_bins,          %w{rake gem bundle ruby}\n    # =\u003e set :rvm1_alias_name,        fetch(:application)\n    # =\u003e set :rvm1_auto_script_path,  \"#{fetch(:deploy_to)}/rvm1scripts\"\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e secrets\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :secrets_roles,       :app\n    # =\u003e set :secrets_profile,     \"bashrc\" # \"profile\" | \"bashrc\" | \"bach_profile\" | \"bash_login\"\n    # =\u003e set :secrets_key_base,    generate_secrect_key\n    # =\u003e set :secrets_key_name,    \"#{ fetch(:application) }_#{ fetch(:stage) }_SECRET_KEY_BASE\".gsub(/-/, \"_\").gsub(/[^a-zA-Z_]/, \"\").upcase\n    # =\u003e set :secrets_user_path,   { \"/home/#{fetch(:user)}\"\n    # =\u003e set :secrets_set_both,    false  # also save usual SECRET_KEY_BASE \n    # =\u003e set :secrets_hooks,       true   # activate secrets hooks in setup chain ?\n    # =\u003e set :secrets_set_env,     true   # also set in /etc/environment (for rvm usage)\n    # =\u003e set :secrets_set_etc,     false  # also set in /etc/profile (for all machine users)\n    # =\u003e set :secrets_symlink,     false  # auto symlink secrets.yml on each deploy (not needed if set in :linked_files)\n    \n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e sidekiq\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :sidekiq_default_hooks,   true\n    # =\u003e set :sidekiq_pid,             File.join(shared_path, 'pids', 'sidekiq.pid')\n    # =\u003e set :sidekiq_env,             fetch(:rack_env, fetch(:rails_env, fetch(:stage)))\n    # =\u003e set :sidekiq_log,             File.join(shared_path, 'log', 'sidekiq.log')\n    # =\u003e set :sidekiq_timeout,         10\n    # =\u003e set :sidekiq_roles,           :app\n    # =\u003e set :sidekiq_processes,       1\n    # =\u003e set :sidekiq_concurrency,     3      # how many threads to spawn\n    ## If needed, you can set special queues and configure it seperately .. options:\n    ##    - queue:      string    # =\u003e queue-name       (default: \"default\")\n    ##    - processes:  integer   # =\u003e number processes (default: 1)\n    ##    - worker:     integer   # =\u003e concurrency      (default: 7)\n    ##      ie: [ {queue: \"default\", processes: 1, worker: 15}, {queue: \"single\", processes: 1, worker: 1} ]\n    # =\u003e set :sidekiq_special_queues,   false\n    # =\u003e set :sidekiq_queued_processes, []\n    ## Rbenv and RVM integration\n    # =\u003e set :rbenv_map_bins,          fetch(:rbenv_map_bins).to_a.concat(%w(sidekiq sidekiqctl))\n    # =\u003e set :rvm_map_bins,            fetch(:rvm_map_bins).to_a.concat(%w(sidekiq sidekiqctl))\n\t\n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e sidekiq_six  *(sidekiq 6+ on sysd)*\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n\t## CAUTION: if used with rvm, set `:rvm_custom_path` to `/home/YOUR_USER/.rvm` or whatever absolute path .. \n\t## new systemd doesn't like `~/..` path in ExecCommand !!! (stderr: Failed to start ...service has a bad unit file setting.)\n\t##\n\t# =\u003e set :sidekiq_six_default_hooks,     true\n    # =\u003e set :sidekiq_six_deamon_file,       \"sidekiq_#{fetch(:application)}_#{fetch(:stage)}\"\n    # =\u003e set :sidekiq_six_timeout,           10\n    # =\u003e set :sidekiq_six_roles,             :app\n    # =\u003e set :sidekiq_six_processes,         1\n    # =\u003e # Sidekiq queued processes:\n    # =\u003e \n    # =\u003e set :sidekiq_six_special_queues,    false\n    # =\u003e set :sidekiq_six_queued_processes,  []\n    # =\u003e \n\t## If needed you can set special queues and configure it seperately\n    ## .. options:  \n    ##    - queue:      string    # =\u003e queue-name       (default: \"default\")\n    ##    - processes:  integer   # =\u003e number processes (default: 1)\n    ##    - worker:     integer   # =\u003e concurrency      (default: 7)\n    ## =\u003e [ { queue: \"queue_name\", processes: \"count\", worker: \"count\" }]\n    # =\u003e \n    # =\u003e set :sidekiq_six_deamon_path,       \"/lib/systemd/system\"\n    # =\u003e set :sidekiq_six_deamon_template,   :default\n\t# =\u003e \n    # =\u003e set :sidekiq_six_ruby_vm,           :system   \t## ( :rvm | :rbenv | :system )\n\t# =\u003e set :sidekiq_six_user,              fetch(:user, 'deploy')   ## role-user\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e thin\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n    # =\u003e set :thin_path,                  '/etc/thin'     # =\u003e thin path on your server\n    # =\u003e set :thin_roles,                 :web            # =\u003e thin roles\n    # =\u003e set :thin_timeout,               30              # =\u003e Request or command timeout in sec (default: 30)\n    # =\u003e set :thin_max_conns,             1024            # =\u003e Maximum number of open file descriptors (default: 1024)\n    # =\u003e set :thin_max_persistent_conns,  512             # =\u003e Maximum number of persistent connections (default: 100)\n    # =\u003e set :thin_require,               []              # =\u003e require the library\n    # =\u003e set :thin_wait,                  90              # =\u003e Maximum wait time for server to be started in seconds\n    # =\u003e set :thin_onebyone,              true            # =\u003e for zero-downtime deployment (only works with restart command)\n    # =\u003e set :thin_daemonize,             true \t\t\t  # =\u003e daemonize ? default = true\n    # =\u003e set :thin_hooks,                 true            # =\u003e activate thin hooks in deploy chain ?\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n## =\u003e thin_sysd   *.. thin with systemd managed process*\n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##\n    \n\t## CAUTION: if used with rvm, set `:rvm_custom_path` to `/home/YOUR_USER/.rvm` or whatever absolute path .. \n\t## new systemd doesn't like `~/..` path in ExecCommand !!! (stderr: Failed to start ...service has a bad unit file setting.)\n\t## \n    # =\u003e set :thin_path,                  '/etc/thin'     # =\u003e thin path on your server\n    # =\u003e set :thin_roles,                 :web            # =\u003e thin roles\n    # =\u003e set :thin_timeout,               30              # =\u003e Request or command timeout in sec (default: 30)\n    # =\u003e set :thin_max_conns,             1024            # =\u003e Maximum number of open file descriptors (default: 1024)\n    # =\u003e set :thin_max_persistent_conns,  512             # =\u003e Maximum number of persistent connections (default: 100)\n    # =\u003e set :thin_require,               []              # =\u003e require the library\n    # =\u003e set :thin_wait,                  90              # =\u003e Maximum wait time for server to be started in seconds\n    # =\u003e set :thin_onebyone,              true            # =\u003e for zero-downtime deployment (only works with restart command)\n\t# =\u003e set :thin_daemonize,             true \t\t\t  # =\u003e daemonize ? default = true\n    # =\u003e set :thin_hooks,                 true            # =\u003e activate thin hooks in deploy chain ?\n\t## New control thin daemon\n    # =\u003e set :thin_daemon_file,           \"thin_#{fetch(:application)}_#{fetch(:stage)}\"\n    # =\u003e set :thin_daemon_path,           \"/lib/systemd/system\"\n\t# =\u003e set :thin_daemon_ruby_vm,        :system   \t  ## ( :rvm | :rbenv | :system )\n    # =\u003e set :thin_daemon_template,       :default\n    # =\u003e set :thin_daemon_log_lines,      100\n    # =\u003e set :thin_daemon_user,           fetch(:user, 'deploy')\t # =\u003e daemon user\n    \n    \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## \n```\n\n\n---\n\n\n### ToDos\n\n- clean up code\n- write some generators\n- testing\n\n\n### LICENSE\n\nThis project rocks and uses MIT-LICENSE.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberlinmagic%2Fmagic_recipes_two","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberlinmagic%2Fmagic_recipes_two","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberlinmagic%2Fmagic_recipes_two/lists"}