Skip to content

pludoni/ansible-rails

 
 

Repository files navigation

dresden-weekly.Rails

Ansible Galaxy Build Status

Our think-tank for modules and playbooks that help to deploy Ruby on Rails applications

This repository contains many roles that you can glue together to represent your individual Rails deployment.

Requirements

  • Ubuntu 12.04 (Precise)
  • Ubuntu 14.04 (Trusty)
  • CentOS 7

Content Roles

Provisioning:

  • user/profile store facts to .profile and .bashrc
  • postgresql install a PostgreSQL 9.3 database
  • database/backup Simple rotating SQL dump backups
  • upstart/userjobs enables Upstart userjobs
  • ruby/rvm installs a specific Ruby version with rvm
  • ruby/rbenv installs a specific Ruby version with rbenv
  • ruby/postgresql support for PostgreSQL client gems
  • ruby/imagemagick installs the popular image manipulation tool with support for rmagick binding and some image optimization libraries
  • ruby/sqlite3 support for sqlite3 client gems
  • ruby/mysql support for Mysql client gems
  • rails/create-folders prepares a folder for Rails releases
  • rails/logrotate create logrotate configuration for Rails logs
  • rails/jobs/sidekiq manage/restart sidekiq as a upstart job or Systemd unit
  • rails/jobs/mailroom manage/restart Mailroom as an systemd job (Ubuntu 16+) to listen for incoming emails in time
  • nginx/server install Nginx webserver
  • nginx/passenger install Nginx webserver
  • nginx/puma prepare nginx for Puma appserver
  • nginx/webrick prepare nginx for Webrick apperserver
  • puma/upstart install userjob for Puma
  • webrick/service setup init system to start Webrick
  • apache/server install and configure Apache server
  • apache/passenger install and configure Passenger for apache
  • apache/vhost add an Apache vhost configuration
  • firewalld configure firewalld (for CentOS)
  • selinux currently only enable/disable selinux on CentOS
  • yarn Installs nodejs + yarn (default nodejs-6.x)

Deployment:

  • rails/create-release create a new release from a git repo
  • rails/use-vagrant create the vagrant release from a vagrant share
  • rails/tasks/bundle install all bundles gems
  • rails/jobs/sidekiq/restart see Sidekiq role
  • rails/tasks/migrate-database run Rails database migrations
  • rails/tasks/compile-assets create the precompiled assets
  • rails/publish-assets transfer compiled assets from app- to web-servers
  • rails/update-current change the symlink for the current release
  • rails/tasks/whenever update crontab of app user using whenever Gem
  • rails/cleanup-old-releases only keep N last releases
  • rails/rollback rollback the the previous and delete the current release
  • rails/tasks/rake Run arbitrary Rake task on app

Dependencies

no other roles currently

You may want to use our vagrant-ansible-remote for testing and deploying

Example Playbook

Github based single tier deployment

dresden-weekly/ansible-rails-example@simple

  • Git based deployment
  • single tier
  • PostgreSql database
  • Nginx Webserver
  • Webrick as application server
  • Support for Vagrant based development

dresden-weekly/ansible-rails-example@threetier

  • like simple but for classic 3-tier deployment
    1. database
    2. rails application servers
    3. web-servers

hicknhack-software/ansible-redmine-example

  • stable version based deployment
  • single tier with Git and Subversion hosting
  • MySql database
  • Apache webserver
  • Passenger as application server
  • customized for Redmine

stefanwienert.de/ansible

  • Blog post that explains on how to use this role for deploying a Rails app

Changelog

0.3 (stables) planned

  • (Your pull requests are welcome)

0.2 (more features!) 13.05.2015

  • Features
    • multiple machine deployment (see three tier example)
    • skip deploy if nothing changed (using stable release names)
  • Webserver
    • Apache (see redmine example)
  • Rails Application Server
    • Passenger on Apache
  • Database support
    • MySql (see redmine example)
    • Sqlite3
  • Ruby installation
    • rbenv (contributed by @tnt)
  • Linux distribution
    • CentOS (simple)

0.1 (first release) 09.01.2015

  • Features
    • Windows Vagrant support
    • Simple Remote-Tool to trigger deployments
  • Release Management
    • Git based release management
    • Vagrant shared folder based releases for development
  • Webservers
    • nginx
  • Rails application servers
    • puma
    • webrick
  • Database support
    • PostgreSql
  • Ruby installation
    • RVM
  • Configuration management
    • Deployment User environment variables
  • Linux distributions
    • Ubuntu 12.04
    • Ubuntu 14.04

Roadmap

  • Release Management
    • Download based releases
  • Webserver
    • Passenger Standalone
  • Rails Application Server
    • Passenger on NGINX
    • Thin
    • Unicorn
  • Ruby installation
    • Package based
  • Configuration management
    • Generator for secrets.yml
    • Generator for database.yml
  • Linux distribution
    • Ubuntu 15.04
    • CentOS (remaining parts)

License

The MIT License (MIT)

Copyright (c) 2015 dresden-weekly

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

flexible Rails deployment with Ansible

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 97.9%
  • Shell 2.1%