- Create an account at aws.amazon.com
- Generate an ssh key (instructions here). Go up to step 4 where you do
pbcopy - You should have your public key in your clipboard
- In AWS go to "EC2 ->Network & Security->Key Pairs"
- Import Key Pair (name could be "My Mac"). Paste in the public key and click "import"
- Go back to AWS dasboard and click on "OpsWorks"
- Click on "Add Stack"
- Name: Your Application
- Default SSH Key: Select the key you created
- Click "Add Stack"
- Click on "Add a layer"
- Select Node.js as layer type and click "Add Layer"
- Under Navigation, click "Instances" and click "Add an instance"
- Under "Size" select "t2.micro" (smallest server)
- Add Instance
- Click "Start" to start up your instance
- Under Navigation, click "Apps" and click "Add an App"
- Name: Name of your app
- Repository URL: from github code repo copy the SSH clone URL on the right (ex: git@github.com:nycitt/codementor-example.git)
- Go to "Settings" in Github repo and click "Deploy keys"
- Follow same steps as here BUT when it asks "Enter file in which to save the key" name your key "yourapplication" with No Passphrase
- Copy the public key that's generated into the "Key" field in Github
- Name it "Amazon" and click "Add Key"
- Go back to AWS and copy the private key into the Repository SSH key field
- Fill in environmental variables by looking at the config file. Convert everything to Uppercase
1. camelCase -> CAMEL_CASE
2. nested object becomes PARENT_CHILD
{ parse: { masterKey: '' } } Environment Variable: PARSE_MASTER_KEY - Click "Add App"
- Click "Deploy" and "Deploy again"
- You will be able to access your app by going to Navigation->Instances and looking for the public ip of your server
- If you need to debug do
ssh ec2-user@IP-ADDRESSand it should automatically log in using your private key. All files are located in/srv/www/<name of app>/current
- In Github repo go to "settings"
- Go to "Webhooks & Services"
- Add Service -> OpsWorks
- Fill in info
- In AWS go to "IAM"
- Go to "Users"
- Create new user
- Name it "aws"
- Create Create
- Show User Security Credentials
- Copy security credentials to the GitHub page
- Close and click on user.
- Go to "Permissions"
- Click "attach policy
- Filter for "ops" and attach the 1st policy
- AppId: In opsworks, click on your app, and it's going to be the "OpsWorks ID" 13: Stack ID: In OpsWorks selet "Stack" from navigation, go to "Stack Settings". It's going to be the OpsWorks Id
- branch name: master