Skip to content

Instantly share code, notes, and snippets.

@mtmckenna
Last active October 25, 2015 19:16
Show Gist options
  • Save mtmckenna/2bbce8c14f520c78088b to your computer and use it in GitHub Desktop.
Save mtmckenna/2bbce8c14f520c78088b to your computer and use it in GitHub Desktop.
export AWS_SECRET_KEY=`cat .aws_secret_key`
ENVIRONMENT=production
ember deploy --environment=$ENVIRONMENT
if [ $? -eq 0 ]
then
LATEST_REVISION="$(ember deploy:list --environment=$ENVIRONMENT | grep "1)" | awk '{print $2}')"
ember deploy:activate --revision=$LATEST_REVISION --environment=$ENVIRONMENT
echo "$(tput setaf 2)Deployed the heck out of the latest revision."
exit 0
else
echo "$(tput setaf 1)Something is jacked up with the deploy."
exit 1
fi
@mtmckenna
Copy link
Author

This is a shell script to deploy and activate an ember-deploy-s3 compatible Ember app.

To use this script, paste your AWS secret key in a .aws_secret_key file and make sure you ignore .aws_secret_key in your .gitignore file so you don't commit it to your repo.

Your config/deploy.js will look something like this:

module.exports = {
  production: {
    store: {
      type: 'S3',
      accessKeyId: 'ACCESS_KEY_ID',
      secretAccessKey: process.env['AWS_SECRET_KEY'],
      bucket: 'www.example.com',
      hostName: 'www.example.com.s3-website-us-west-1.amazonaws.com',
      region: 'us-west-1'
    },

    assets: {
      accessKeyId: 'ACCCESS_KEY_ID',
      secretAccessKey: process.env['AWS_SECRET_KEY'],
      bucket: 'www.example.com-assets',
      region: 'us-west-1'
    }
  }
};

When you're all set up, you should be able to deploy your app by typing the following in the command line: sh deploy-latest-revision-to-s3.sh.

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