So Pushy

Deploy to S3 on Travis Build

Updated 2019-11-29: This is no longer the way this site is updated, it is now handled by Github Pages.

This site is usually a way to try open source tools and to have a link dump for my contact information. I don’t write as much as I’d like because pushing to prod takes a few extra steps on a laptop with AWS S3 credentials setup.

This website is currently a Jekyll static site and my goal for a while has been to figure out how to get the site to deploy this site on a push to master.

Setting up a Jekyll build on Travis is as easy as getting a Ruby environment setup and running the correct commands. You can find my Travis config file here: https://github.com/mjohnsey/michael.johnsey.me/.travis.yml.

I generated the deploy block of the Travis config using the Travis CLI. It steps you through all the necessary steps. The only thing I added after the fact was skip_cleanup: true.

Run this, being sure to encrypt your secret access key:

gem install travis
travis setup s3

It will generate the following yaml in your config:

deploy:
  provider: s3
  access_key_id: AKIAII2S3GRPXDR4R7NQ
  secret_access_key:
    secure: YtODIzpufOI7w7e4mEsvpE9AtDMvkw6R69dlKMa7+s90ASkWduDlUpKketPRYVmF5VJG0xyYE9iTNK8Vw9LiS/Ad0wY3U/tSAYho1vUcbsg8wZh04BuhHCoxQo+Sq2Z2myMqHh+98I/vvvqyiee5fcWMuhDYS68zz301T8YjtvPRJ29DI1+suA2NaAZKt158BPi0mwafmBNqQcMoFFtPy78RTOtdIO9W7CDTu53Trn6SK/UGAdRVTytZU5kF/FdopLeAWoD/fQlAEiV/rc6IAhEY45cVpYsbWAZXZ1QdHr1dmEB46H/oqx80yL+4T1yb19lo80Trvb/HhSUVYfdil4ld3/taLXYFXPs+H9w30VxATGHdUxrKt49z1eMxrefmQxTZ0kAW1nLmqfidTl0AlN8zLi65QlQi1kIH2Jt7p8b5XIHN2UWM3/W0tNOChNj/qCLl2n8BqMr0NhNdtZalI5avFp3Cs7lKo5qLKC9IQg3xZYIJ+WP7SbsCLJSrDIje66RrP3shtDM4+UCzoxYIX6G1mm1gYODcQ+E/vHUDTqmG8oaCZ/FPpbppJb6WL39rvEGPZtb6YUFjwdZGznhygfnFwEcRnP/fxmMqAeZO6ck2N7yyIED8EH/zcTEREoyzRonK4K+EulilgvNE0WESE+3lRRZTEW9ujUXYjfD9p1Y=
  bucket: michael.johnsey.me
  local-dir: _site
  acl: public_read
  on:
    repo: mjohnsey/michael.johnsey.me
  skip_cleanup: true

Setting up the S3 permissions in AWS IAM was the biggest hiccup I encountered but luckily this blog post from Michal Frystacky had an example of the permissions necessary to make it work. I think my problem originally was I did not give ACL permissions to the AWS user I setup for Travis.

Now on every push to master it will deploy the _site folder to the S3 bucket. This should open up my ability to write more since I can easily do it from Github’s editor. The only thing I have left that I might go back and add later is an invalidation script to clear out my CloudFront after a deploy.

Revisions:

© Michael Johnsey 2020