Name: roadrunner-devops
Owner: Department of Veterans Affairs
Description: Starter project for automating deployment of a roadrunner-rails (Rails + rbenv) application to AWS
Created: 2016-06-01 16:12:35.0
Updated: 2016-06-01 16:12:35.0
Pushed: 2016-09-15 19:50:35.0
Homepage:
null
Size: 20
Language: null
GitHub Committers
User | Most Recent Commit | # Commits |
Other Committers
User | Email | Most Recent Commit | # Commits |
README
Roadrunner DevOps
Starter project for automating deployment of a roadrunner-rails (Rails + rbenv) project in two steps:
- Automates installation of an application to an instance (local Vagrant, EC2, or any other system).
- Automates deployment of application instances to the AWS cloud environment by creating a production-ready AMI image.
What You Get: Overview
- Launch a new instance
- Optionally bootstrap the new instance with an ssh user other than the one baked into its source AMI (e.g., something other than ec2-user and key-pair).
- Deploy your rails application to the instance as a puma server (automatically detects and installs proper ruby version).
- Configure application user and upstart script
- Configure CloudWatch logs agent
- Configure mechanism to pass environment variables to application via EC2 tags so the same image can be deployed to multiple environments without modification (optional).
- Take a production-ready snapshot of the instance
- Create a new launch configuration with the newly created AMI
- Modify existing auto-scaling group to use the newly created launch configuration.
- Replace old instances in the auto-scaling group with new instances on a rolling basis (with configurable batch size).
Quickstart: Vagrant
Deploy a roadrunner application to Vagrant instance(s). Prerequisites:
Vagrant
Virtualbox
Start vargrant
SSH to “jumpbox” driving the ansible process
Run ansible from local files (via default Vagrant synced_folder
)
grant up
grant ssh ansible_host
sible-playbook -i /vagrant/hosts.vagrant /vagrant/hello-world.yml -e "skip_update=true"
To verify,
- reboot an instance
- SSH into the instance
- Verify Rails is running on desired port (or visit forwarded port on localhost)
rl localhost:3000
CTYPE html>
l>
ead>
<title>Ruby on Rails: Welcome aboard</title>
.
.
Quickstart: AWS
Create an AMI image of a roadrunner application. Prerequisites:
Ansible to drive the process;
An AWS environment with
Subnet
Security group
Keypair
ELB
Auto-scaling group
Configure ssh agent with your AWS keypair
Edit the vars/aws-config.yml
file and modify the AWS-related variables.
Run ansible
sible-playbook -i localhost, deploy-to-aws.yml --private-key [PATH TO YOUR KEY]
Customization
This project deploys a sample Rails application but the conventions can be used on any application:
- Configure base OS:
centos
role
- Install and configure dependencies:
ruby
- Assemble application artifacts:
git
and rails-build
- Configure application:
process
What You Get: Details
Step 1: Install application on target instance
- Update OS
- Install required packages
- Configure OS for production use
- Time zone,
ntpd
service
- Appropriate
ulimit
, e.g., open files (sockets)
- Create user accounts for sysadmins with keys
- Obtain latest application, either
- Download pre-assembled from a central repository like S3
- Assemble from source by checking out and compiling
- Copy environment-specific variables
- Add
upstart
script
- Install logging and monitoring agents (production)
Step 2: Deploy instance to cloud environment
- “Bake” AMI of newly packaged instance (from above)
- Previously provisioned
auto-scaling group
is running and behind ELB
- The new
launch configuration
is applied to the existing auto-scaling group.
- Instances are replaced in batches.
Resources