Skip to content

Instantly share code, notes, and snippets.

@ravzski
Last active August 29, 2015 14:08
Show Gist options
  • Save ravzski/b900dd1fcdeedd8190b0 to your computer and use it in GitHub Desktop.
Save ravzski/b900dd1fcdeedd8190b0 to your computer and use it in GitHub Desktop.
Step 1: Precompile Assets
RAILS_ENV=production rake assets:precompile
commit, then push to the master branch.
Note
*This is not neccessarily needs to be the master branch. Say there's a separate instance of staging, then it is proper to have a staging branch and use that instead.
*Check for conflicts in the manifest file. If there are conflicts, precompile again. If precompile fails. Use rake assets:clean or purge the public assets folder.
Step 2: Test Production ENV in local
RAILS_ENV=production rails s
Note
*if there are no errors meaning webrick boots normal (no need to click on anything), then the codes are reading to be deployed
*Amazon EC2 instance's degrades fully if the current deployment fails. Meaning it will automatically rollback the deployment.
*Because also of this nature, deployments of this nature have ZERO(0) downtime. The "commit" part of the deployment will only take place in less than 1 second in which the new codes will be reflected.
*If you installed a new gem, or something with heavy depency (like unicorn), you have to reboot the server instance
Step 3: Install Amazon CLI
You only need to install the OPSWORK CLI although you can install all AWS CLI. This is the counter part of Heroku's CLI which allows you to do a "heroku run rake db:migrate"
For installation instructions, refer to http://docs.aws.amazon.com/cli/latest/reference/opsworks/index.html
Step 4 will be have 4 sub-steps in which you only have to do once.
Get the APP description.
aws opsworks --region us-east-1 describe-apps
*note: us-east-1 is the region in which the server instance was initialize. Double check on this one if in any case you want to move all instances to singapore region.
From there get the APP ID and run
aws opsworks --region us-east-1 create-deployment --stack-id "insert-stack-id" --app-id "app-id" --command "{\"Name\":\"deploy\"}"
note:
*six sigma's stack id is 01114211-96be-49ad-ae98-49b816ae4a86
*buplas stack id is 06acc272-c6c0-4ff8-bf21-b85d60fc2c99
*Knowing amazon, this things might change (if they upgrade their API or services). So understanding is the key, not memorizing.
*you can also run additional commands like migration and stuffs refer to this http://docs.aws.amazon.com/opsworks/latest/userguide/cli-examples.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment