Company Culture

Everwise’s Continuous Deployment Culture

By Justin ByersJuly 31, 2014

Everwise has experienced tremendous growth in the last year.  With the help of cloud tools such as CircleCI, we’ve adopted a continuous deployment culture, allowing us to move fast and take big risks without the fear of breaking things for our customers.

We’re a small engineering team who believes in the importance of testing but hates manual testing.  To get the most quality assurance with our limited resources, we decided to focus on unit testing our backend business layer and E2E/integration testing our key product features and flows. With CircleCI we were able to cheaply build a Continuous Integration (CI) process to test and deploy our web application and services.

Our CI flow is fairly standard: run our tests in quickest to fail order, keep the team notified of the build status, and at set intervals query CircleCI for the last successful build and deploy to QA.  While we’re still ironing out our internal Dev process to bless a QA candidate, a green-lit CircleCI build is a must.  Let’s dive into the actual steps:

  1. Developer commits. CircleCI picks up GitHub’s push notification and launches an EC2 instance (or cluster if parallelizing) with our machine configuration:


machine:
ruby:
version: X.X.X-pXXX
node:
version: vX.XX.XX
post:
# Fetch Protractor
- npm install -g protractor
# Start WebdriverJs client and Selenium server
- webdriver-manager update
- webdriver-manager start:
background: true

 

  1. Once the environment is setup with our latest commit, we run our backend static analysis.  We use Rubocop to enforce best practices outlined in the Ruby Style Guide.


test:
pre:
- bundle exec rake rubocop

  1. Next, we run our backend unit tests. Luckily, no configuration needed. CircleCI is smart enough to kick off our RSpec tests and halt the build if any of them fail.  We also run code coverage tool and publish our coverage report through CircleCI’s build artifact interface. Note, we fail the build if code coverage drops below 80% or some percentage.
  2. In step 3 we started the Selenium server and since our front-end is AngularJS, we installed Protractor and the WebDriverJS client onto the CI box.  We just need to create and seed our test database:


database:
post:
- bundle exec rake test:seed

  1. Now we’re ready to deploy our web application (and dependent services) and kick off our E2E tests with Protractor. A few things to note:
    1. We precompile assets so our CI box better mirrors that of production.
    2. We poll until our Unicorn web server is ready.  This will surely need revisiting when our infrastructure increases in complexity.
    3. We avoid committing sensitive credentials by storing them in CircleCI’s key vault.


test:
post:
# Must set rails_env to production to compress assets
- bundle exec rake assets:precompile RAILS_ENV=production
# Start web server and app services
- mkdir -p tmp/pids; touch tmp/pids/unicorn.pid
- foreman start:
background: true
# Poll web server until connection is ready
- while [ `curl -sIL -w '%{http_code}' $E2E_BASE_URL -o /dev/null` -ne "200" ]; do sleep 5; done
# Kick off integration tests
- protractor /home/ubuntu/tasmania/src/app/e2e.conf.js
--params.login.user=$E2E_LOGIN_USER
--params.login.password=$E2E_LOGIN_PASSWORD
--params.login.url=$E2E_LOGIN_URL
--baseUrl=$E2E_BASE_URL
--params.artifacts=$CIRCLE_ARTIFACTS

So with just a handful of configuration steps, the right tools, and bit of DevOps love and attention, we’ve made our testing and deployments less painful.  So, where do we go from here? Perhaps…

  • Add front-end analysis with JSHint or other linter.
  • Create process to merge all new pull requests to upstream branch onto an “proxy” upstream branch, so a developer can always be sure their changes won’t break the build before merging.
  • Add to CircleCI more of our cloud/SaaS tools, such as CodeClimate, to profile and identify a larger set of security vulnerabilities.
  • Hook into Sauce Labs for E2E testing across multiple browsers and platforms – both CircleCI and Protractor support!

Want to help us reinvent mentoring and improve our continuous deployment culture?  We’re looking for great engineers.  Cick below or send us a note: dev-jobs@geteverwise.com

Topics: Inside Everwise, Engineering

Justin Byers

Justin Byers

VP Engineering at Everwise

About the Author

Related Articles

It’s easy to run better programs with the right tool.

  • Request demo