How to get Git SHA in an Elastic Beanstalk App (and set other dynamic env vars at deployment)

Posted by Matt Bryson on 18-May-2015 08:57:28

As part of our deployment process, we include the short git SHA as a build number against our SemVer version number.

We wanted this available in our application UI to help identify running versions. Easy I thought, Beanstalk sets this as the Version Label when deploying, so we should be able to access that from the environment vars in PHP.

Unfortunately not, this is one of the many EB values you cant easily get to. After a lot of failed attempts, here is how we managed it as a one-liner in the .ebextensions

Read More

Topics: PHP, EC2, AWS, Deployment, EB (Elastic Beanstalk), Apache

Shellshock Bash Bug : How to patch Bash on AWS EC2 deployed with Elastic Beanstalk

Posted by Matt Bryson on 26-Sep-2014 10:18:02

In response to the ShellShock bug, we tried to patch all our AWS EC2 servers following this security bulletin... but it didn't work.

Turns out that the instructions in the AWS bulletin don't apply to Elastic Beanstalk deployed servers. After some searching, we found the answer.

Read More

Topics: EC2, AWS, yum, CentOS, EB (Elastic Beanstalk), Linux, Bash, Apache

CORS and the HTML5 Application cache manifest don't work together (neither do CORS and Apache)

Posted by Matt Bryson on 28-Feb-2014 19:10:24

If you are looking to make cross domain requests with ajax for items in a cache manifest, don't. It wont work.

We recently embarked on building a web application that runs completely offline on mobile devices.

It was fully content managed from our CMS, which published assets and a cache.manifest file to a couple of amazon S3 buckets.

Our set up was this:

  • The CMS and API run off an EC2 server on a domain A
  • The assets are published to a S3 bucket on domain B
  • The web app is hosted on a S3 static website bucket on domain C

You can't cross domain the cache manifest itself, but you can cross domain the items in it, as long as its not HTTPS.

So, we need the web app on domain C to load the API on domain A. As well as allow the web app on domain C to load the assets on domain B all via Ajax. This is not allowed due to security restrictions.

CORS to the rescue. or so we thought....


Read More

Topics: appcache, CORS, Apache