provisioning rails servers with ansible

17
Provisioning Rails Servers with Ansible Radamanthus Batnag @radamanthus https://github.com/radamanthus/

Upload: radamanthus-batnag

Post on 08-May-2015

441 views

Category:

Software


5 download

TRANSCRIPT

Page 1: Provisioning Rails Servers with Ansible

Provisioning Rails Servers with Ansible

Radamanthus Batnag @radamanthus

https://github.com/radamanthus/

Page 2: Provisioning Rails Servers with Ansible

This talk is about

• Tasks in provisioning a Rails server

• Ansible

• My cool open-source ansible-rails playbook

• Life in general

Page 3: Provisioning Rails Servers with Ansible

New Server?No problem!

http://www.animschoolblog.com/2012/12/new-server-for-animschoolcom.html

Page 4: Provisioning Rails Servers with Ansible

No problem!

• Get the latest OS packages

• Disable all ports except port 22

• Harden sysctl settings

• Add ssh keys for deploy user

• Disable root ssh

Page 5: Provisioning Rails Servers with Ansible

No problem…

• Add Brightbox PPA

• Install Ruby

• Install Bundler

Page 6: Provisioning Rails Servers with Ansible

No problem?

• Add PostgreSQL PPA

• Create the deploy postgres user

• Create database.yml with the correct password

• Create the app database

Page 7: Provisioning Rails Servers with Ansible

Hmmm…

• Add Nginx PPA

• Install Nginx

• Remove default site

• upload myapp.conf Nginx config file

Page 8: Provisioning Rails Servers with Ansible

Aaargh

• Install the Puma gem

• add puma to /etc/init.d/

• Prepare the puma pid directory

• add app to /etc/puma.conf

• create monitrc for puma

Page 9: Provisioning Rails Servers with Ansible

In the old days, we had a recipe…

Page 10: Provisioning Rails Servers with Ansible

https://www.digitalocean.com/community/articles/how-to-install-rails-and-nginx-with-passenger-on-ubuntu

Page 11: Provisioning Rails Servers with Ansible

These days, we have

Ansible

Puppet

Chef

Page 12: Provisioning Rails Servers with Ansible

Demo

Page 13: Provisioning Rails Servers with Ansible

https://github.com/radamanthus/ansible-rails

Start Here!

Page 14: Provisioning Rails Servers with Ansible

Key Ansible Concepts

• Variables

• Includes

• Templates

• Files

• Roles

Page 15: Provisioning Rails Servers with Ansible

Walkthrough

Page 16: Provisioning Rails Servers with Ansible

Resources

• http://docs.ansible.com

• http://lattejed.com/first-five-and-a-half-minutes-on-a-server-with-ansible

• http://guides.spreecommerce.com/developer/ansible-ubuntu.html

• https://github.com/radar/ansible-rails-app

• https://github.com/radamanthus/ansible-rails

Page 17: Provisioning Rails Servers with Ansible

Thank You