The journey continues - from Elastic Beanstalk to CodeDeploy
A little while ago I wrote about deploying Gastropoda to an Amazon Web Services EC2 instance via Elastic Beanstalk. Since that day I have been running into multiple EB problems. I’m sure that if I took the time to learn I would figure out why these things were happening and how to fix them. Some problems included:
- Instance starting to fail with unknown errors and nothing in the logs after a bad composer command that is added and then removed. The only fix I could find for this was rebuilding the environment.
- No way to specify exact availability zone when using VPC, causing my reserved us-west-2b instance to not be utilized and resulting in my having to request zone changes for my reserved instance whenever Elastic Beanstalk spun up a new instance in the wrong zone.
- Attempting to fix the above with a command and Options.txt file recommended in documentation and AWS forums, only to be unable to get the actual command to even be recognized.
- Elastic Beanstalk seemingly terminating and recreating EC2 instance without warning or notice.
I learned that Amazon has another deployment option - CodeDeploy. It’s much different than Elastic Beanstalk and doesn’t seem to manage as much stuff for you, but appears to provide more control and doesn’t decide to terminate your instances at random. So I manually created a brand new EC2 instance in us-west-2a to match my reserved instance and have been able to work with it without terminations or any other weirdness.
CodeDeploy can deploy from either an S3 bucket or GitHub. I’ve set it up to work with GitHub and so far it’s been great.
I want it to be easy for potential collaborators to deploy new versions of the app to the development environment, so was looking into various CI options. Two that I came across were Wercker and Codeship. Both were quick to set up, but Codeship was surprisingly pain free and awesome. However, the free plan only allows 100 builds per month which I have a feeling will not be enough for me. And because Gastropoda is just a hobby project that won’t be monetized, I don’t feel like spending money on a CI system on top of existing web hosting and domain costs. Codeship does apparently provide discounts for educational and non profit projects sometimes, but no matter how small those monthly costs add up and I’m not made of enough money to pay for all these services for a project that won’t make any kind of return on investment.
So I started experimenting with GitHub hooks - if I can set up a hook to automatically trigger CodeDeploy I will be able to avoid using a third party CI solution to automate the whole shebang. I started off by following the instructions in this blog post about integrating GitHub with CodeDeploy, but unfortunately this isn’t yet working. I keep getting a very vague error on the GitHub service. I’ve posted on the CodeDeploy forums and apparently at least one other person is having exactly the same issue. Hopefully I’ll manage to get it resolved soon. In the meantime I’m just triggering manual deployments from my GitHub commits via the CodeDeploy dashboard.