Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

bploetz/maestro-rails3-example

Repository files navigation

Maestro example Rails 3 application.

This is an example Rails 3 application which uses Maestro to provision and configure a cloud named “example”.

The “example” cloud applies the Chef role “allinone” to a single EC2 node named “web-1”. The “allinone” role is a complete web stack in a box, containing:

  • Ubuntu 10.04

  • Nginx + Phusion Passenger to run your Rails 3 app.

  • MySQL running on an EBS volume for persistent storage, as described in Eric Hammond’s guide. It also includes cron jobs to snapshot the database every hour, and to maintain a rolling window of the last 10 snapshots.

  • Postfix for outbound email, sending through an SMTP provider (AuthSMTP in this example).

  • Monit monitors for Nginx, MySQL, and Postfix.

  • Creates a “deploy” user to be used for deploying your app to the instance.

The example cloud uses the Rails environment named “staging”.

Caveats

This is just an example to get you started. There’s some hacks here and there, and some configurations that may not be appropriate for your application and/or infrastructure. Fork and extend as you see fit.

What you need to obtain

  • An EBS volume

  • An Elastic IP address

  • An AuthSMTP account

What you need to change within maestro-rails3-example

maestro-rails3-example/config/maestro/clouds/example.rb

The following attributes within the “example” aws_cloud need to be changed:

  • keypair_name

  • keypair_file

  • aws_account_id

  • aws_access_key

  • aws_secret_access_key

  • chef_bucket

  • elastic_ip

  • ebs_volume_id

The following attributes within the “web-1” ec2_node need to be changed:

  • elastic_ip

  • ebs_volume_id

The following cookbook_attributes within the “web-1” ec2_node need to be changed:

  • public_hostname

  • mysql: server_root_password

  • mysql_ebs: ebs_volume_id

  • mysql_ebs: aws_access_key_id

  • mysql_ebs: aws_secret_access_key

  • postfix: mydomain

  • postfix: relayhost

  • postfix: relayport

  • postfix: relayuserid

  • postfix: relaypassword

  • monit: alert_email_address

  • monit: from_email_address

maestro-rails3-example/config/maestro/cookbooks/mysql_ebs/files/default

Download your X.509 certificate and private key for accessing Amazon Web Services from your Amazon account, and save them in this directory with the following names:

aws-cert.pem

aws-pk.pem

These are used by a cron job which uses the Amazon EC2 command line tools to maintain a rolling window of the last 10 snapshots of your EBS volume.

maestro-rails3-example/config/maestro/cookbooks/nginx/files/default

Save the SSL certificate and private key for your domain name in this directory with the following names:

server.crt

server.key

maestro-rails3-example/config/maestro/cookbooks/users/files/default

Create an SSH keypair for the “deploy” user, which is created for the deployment of your app to the node. Extract the public key and save in this directory with the following name:

id_rsa-deploy.pub

What you need to configure externally

DNS

Configure your DNS to point the public_hostname hostname to the Elastic IP associated with the “web-1” ec2 node.

License

(The MIT License)

Copyright © 2010 Brian Ploetz <bploetz (at) gmail.com>

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

About

An example Rails 3 application which uses Maestro to provision and configure a cloud named "example"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published