/ Meteor Continuous Integration on AWS

Part 4: Running Meteor bundles on Elastic Beanstalk

We have a working Continuous Integration pipeline and are getting really close to finishing the thing. We just need to adjust some final things and after that it becomes a matter of making it "nicer".

If you did not yet read the previous to articles. Here they are:

Elastic Beanstalk allows a couple of ways on how it can be configured:

  • Command line tools
  • Via code
  • Via the console
  • Trough Cloudformation templates

Since we've done our build step via code, it might be a good idea to configure the environment trough code as well. However, environment configurations have generic configurations, but also configurations that are specific for each environment. For example the environment variables and scaling behaviors. You don't want to change your code each time, just because your environment or scaling behavior changes. There can theoretically be infinite environments either local or even on different clouds...

Remember that I told that putting environment specific things in code is not recommended in article 1? There you have it. Gotcha avoided. Most of the time configuring an environment in the cloud is a one time thing. Its just not worth the added complexity of code vs doing it via the console. That's why I prefer using the AWS Elastic Beanstalk console to finish the last step.

  1. Navigate to the Elastic Beanstalk service
  2. Click on your freshly created green environment. Just to be sure, mine is called cloudspider-tutorial-web-dev.
  3. On the left menu, click on 'Configuration'.
  4. Look for 'Software configuration' and click on its gear icon
  5. Change the 'Node version' to 4.6.1 (if using Meteor < 1.6)
  6. Change the 'Node command' to node main.js
  7. Scroll all the way down to 'Environment Properties' and fill in the ROOT_URL and MONGO_URL environment variables over there.

Note: Step 7 is important. In my case Meteor will not tell me that I've forgotten them and it will also not start up. The command line in that case will remain empty on a flashing cursor right after the node main.js command execution.

Now click on the blue 'Apply' button at the bottom right of the page. This will trigger a re-deploy of our application. If all went well, the environment will first turn grey with a spinning refresh icon and eventually turn green with a check-mark icon. Now visit your environment's url and it should load Meteor's default page!

Congratulations! We've finished the full continuous integration flow! We want more of course since the environment URL is not the URL we want. We want a custom domain and make it work with a SSL certificate (HTTPS). After that there is still the part where we want automated tests (unit, UI and integration).

Coming up: Part 5 - about enabling HTTPS with a custom domain!

All articles of the continuous integration guide for MeteorJS