Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Continuously deploying https served statically compiled sites to S3 with canonical domains

Continuously deploying https served statically compiled sites to S3 with canonical domains

coldclimate

May 05, 2015
Tweet

More Decks by coldclimate

Other Decks in Technology

Transcript

  1. Disclaimer 1. Work in progress 2. Lots of room for

    improvement 3. A bit of stuff for stuffs sake (learning)
  2. End goals 1. Static compiled site 2. Testable locally 3.

    Automatically built and deployed 4. Hosted in S3 5. Served only over HTTPS 6. With www Vs non-www canonical domains 7. Achievable in an evening 8. Cheap/free
  3. What is a static site compiler • Write markdown •

    Write rules • Compiles to HTML • Add dynamism with JavaScript • Every language www.staticgen.com • Example github. com/coldclimate/omnomfrickinnom
  4. Vagrant to build locally • Overkill • Avoids ruby (and

    other) ecosystem hell • My current hammer
  5. AWS Policy { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow",

    "Action": "s3:*", "Resource": ["arn:aws:s3:::www.omnomfrickinnom.com", "arn:aws:s3:::www.omnomfrickinnom.com/*"] } ] }
  6. AWS Policy: Sorry • Don’t use * • Cut it

    down to what you need • https://blog.codeship.com/aws-iam-security/
  7. Building with CodeShip • Sign up with GitHub/BitBucket (Oauth) •

    Create Project • Hijack the “test” process to run the build
  8. Why CloudFlare? • DNS management • Attach protection (DDOS etc)

    • Free SSL Cert (limited) • CNAME Flattening! • PageRules!
  9. Bolting on CloudFlare • Sign up • Add your domain

    name • Migrate all your DNS entries • Set your nameservers to CloudFlare • Set your DNS entries • Set up PageRules
  10. Testing it curl -I http://x.com 301 to http://www.x.com curl -I

    https://x.com 301 to https://www.x.com curl -I http://www.x.com 301 to https://www.x.com curl -I https://www.x.com 200
  11. Redirect Worst Case Scenario • 301 non-www. to www. •

    301 http to https • Finally download