Skip to content

Instantly share code, notes, and snippets.

@gterrill
Last active May 30, 2018 15:10
Show Gist options
  • Save gterrill/50ba52076f1ef3b2d3a85f7c9146c503 to your computer and use it in GitHub Desktop.
Save gterrill/50ba52076f1ef3b2d3a85f7c9146c503 to your computer and use it in GitHub Desktop.
Notes on setting up a Rails App on Opsworks Stacks using Chef 12

Setting up Stack

  • use ssh-keygen -f appname to generate key
  • put public key in github
  • private key in opsworks (app layer)

Chef

Using Berkshelf: http://docs.aws.amazon.com/opsworks/latest/userguide/cookbooks-101-opsworks-berkshelf.html (says Chef 11 but also works on Chef 12)

http://www.mattboldt.com/aws-opsworks-rails-chef-12/

https://github.com/ajgon/opsworks_ruby http://opsworks-ruby.rzegocki.pl/configuration-builder

Packaging cookbooks http://docs.aws.amazon.com/opsworks/latest/userguide/best-practices-packaging-cookbooks-locally.html

AWS Command Line

http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html

  • Set up access key

aws configure

S3 Bucket

Creating bucket

http://docs.aws.amazon.com/cli/latest/reference/s3api/create-bucket.html aws s3api create-bucket --bucket my-bucket --region us-east-1

Make available

http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html#example-bucket-policies-use-case-2

Uploading cookbooks file

aws s3 cp cookbooks.tar.gz s3://searchify-staging/

Stack Settings

Custom JSON to specify ruby version:

{
  "ruby-ng": {
    "ruby_version": "2.3"
  }
}

Security

  • RDS instance need to have "AWS-OpsWorks-DB-Master-Server"
  • Rails layer needs "AWS-OpsWorks-Rails-App-Server"

Rails App

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment