{"id":13747376,"url":"https://github.com/aleks/ansible-rails","last_synced_at":"2025-07-07T08:12:41.019Z","repository":{"id":77030326,"uuid":"75128214","full_name":"aleks/ansible-rails","owner":"aleks","description":"Ansible: Ruby on Rails Server","archived":false,"fork":false,"pushed_at":"2018-11-01T12:40:00.000Z","size":33,"stargazers_count":319,"open_issues_count":1,"forks_count":58,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-10-29T14:16:28.208Z","etag":null,"topics":["ansible","ansible-playbook","ansible-playbooks","deployment","rails","ruby","ruby-on-rails","rubyonrails"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aleks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-11-29T22:31:58.000Z","updated_at":"2024-09-07T00:38:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb346bfd-0593-489a-b77e-1203b53b1a87","html_url":"https://github.com/aleks/ansible-rails","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleks%2Fansible-rails","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleks%2Fansible-rails/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleks%2Fansible-rails/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aleks%2Fansible-rails/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aleks","download_url":"https://codeload.github.com/aleks/ansible-rails/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704571,"owners_count":20982298,"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":["ansible","ansible-playbook","ansible-playbooks","deployment","rails","ruby","ruby-on-rails","rubyonrails"],"created_at":"2024-08-03T06:01:26.865Z","updated_at":"2025-04-07T18:14:54.240Z","avatar_url":"https://github.com/aleks.png","language":"Ruby","funding_links":[],"categories":["Ruby","ruby"],"sub_categories":[],"readme":"# Ansible: Ruby on Rails Server\nUse this ansible playbook to setup a fresh server with the following components:\n\n* Nginx\n* Puma App Server\n* Certbot (Let's Encrypt)\n* MySQL\n* Memcached\n* Redis\n* Sidekiq\n* Monit (to keep Puma and Sidekiq runnig)\n* Elasticsearch\n* ruby-install\n* chruby\n* Directories to deploy Rails with Capistrano and Puma App Server (see below)\n* Swapfile (useful for small DO instances)\n* Locales\n* Tools (tmux, vim, htop, git, wget, curl etc.)\n\n## Prerequisites \u0026 Config\n\n1. Rename ```hosts.example``` to ```hosts``` and modify the contents.\n2. Rename ```group_vars/all.example``` to ```group_vars/all``` and modify the contentes.\n\n\tThere are a bunch of things you can set in ```group_vars/all```. Don't forget to add your host address to ```hosts```.\n\n## Install Playbook\n\nRun ```ansible-playbook site.yml -i hosts```.\n\n## Rails Setup\n\nThis is just a loose guideline for what you need to deploy your app with this playbook and server config. Please keep in mind, that you need to modify some values depending on your setup (**especially passwords and paths!**)\n\n### Gemfile\n\nAdd the following gems to your Gemfile and install via ```bundle install```:\n\n```ruby\ngroup :development do\n  gem 'capistrano', '~\u003e 3.6'\n  gem 'capistrano-rails', '~\u003e 1.2'\n  gem 'capistrano-chruby'\n  gem 'capistrano3-puma'\n  gem 'capistrano-sidekiq'\n  gem 'capistrano-npm'\nend\n```\n\n### Capfile\n\nAdd the following lines to your Capfile:\n\n```ruby\n# General\nrequire 'capistrano/rails'\nrequire 'capistrano/bundler'\nrequire 'capistrano/rails/migrations'\nrequire 'capistrano/rails/assets'\nrequire 'capistrano/chruby'\nrequire 'capistrano/npm'\n\n# Puma\nrequire 'capistrano/puma'\ninstall_plugin Capistrano::Puma  # Default puma tasks\ninstall_plugin Capistrano::Puma::Workers  # if you want to control the workers (in cluster mode)\n# install_plugin Capistrano::Puma::Jungle # if you need the jungle tasks\ninstall_plugin Capistrano::Puma::Monit  # if you need the monit tasks\ninstall_plugin Capistrano::Puma::Nginx  # if you want to upload a nginx site template\n\n# Sidekiq\nrequire 'capistrano/sidekiq'\nrequire 'capistrano/sidekiq/monit'\n```\n\n### config/deploy.rb\n\nPlease edit \"deploy\\_app\\_name\", \"repo\\_url\", \"deploy\\_to\" and \"chruby\\_ruby\" (if you've changed the Ruby version in `group_vars/all`).\n\nYour ```config/deploy.rb``` should look similar to this example:\n\n```ruby\nset :application, 'deploy_app_name'\nset :repo_url, 'YOUR_GIT_REPO'\nset :deploy_to, '/home/deploy/deploy_app_name'\nset :chruby_ruby, 'ruby-2.3.3'\nset :nginx_use_ssl, true\nset :puma_init_active_record, true\nset :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')\nset :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'public/system')\nset :keep_releases, 5\n```\n\n### config/deploy/production.rb\n\nAdd the target host:\n\n```ruby\nserver 'your_host_address', user: 'deploy', roles: %w{app db web}\n```\n\n## Feedback\n\nFeel free to send feedback or report problems via GitHub issues!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleks%2Fansible-rails","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faleks%2Fansible-rails","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faleks%2Fansible-rails/lists"}