What our Deployment Scripts Do
We have one deploy script for each of our main repos: our Rails backend and our React frontend.
These two scripts have minor variations, but roughly execute the same steps. Some of the steps executed by the scripts are contained in their own bash scripts or rake files.
Pre-deployment CLI checks & confirmations
First, our scripts run through a series of automatic checks, or forced developer confirmations to help prevent against ill-advised deployments.
- Confirm which branch you are deploying to which environment
- Confirm continuous integration specs are passing
- Check git branch takes the form of “release/<version>”
- Confirm user awareness of any data migrations that need to be run
- Confirm whether to use Heroku Preboot in case of migrations
Pre-deployment notification
Next, our scripts notify slack channels that [developer] is deploying [release] to [env].
Press enter or click to view image in full size
Deployment
The actual deployment is not that complicated, and mainly involves compilation, pushing or hosting files, and turning over servers.
- Bundler or Webpack compile assets
For the frontend:
- Upload assets to s3
For the backend:
- Push release branch to Heroku
- Run Rails migrations
- Restart Heroku workers
Post-deployment notification
After deploying, we notify slack channels that [developer] deployed [release] to [env], with relevant included commits and JIRA tickets listed for the sake of awareness.
Press enter or click to view image in full size
JIRA book-keeping
To save developers from manually keeping JIRA up-to-date our scripts then label and transition tickets involved in the release.
For staging deploys:
- Prompt the developer if each Pre-Release-Candidate (column) JIRA ticket is included the release [y/n]
- Apply a label for the release version to included JIRA tickets
- Transition included JIRA tickets to a Staging/QA column
For production deploys:
- Close JIRA tickets labeled with the release version
Press enter or click to view image in full size
Git book-keeping (for production deploys)
- Apply a tag to the git branch, annotate with developer and timestamp
- Merge release branch changes to master and develop
- Destroy remote and local release branches
Press enter or click to view image in full size
Clear Conceptual Benefits
With these deployment scripts in place, there are three thematic ways that this has made life easier on the development team.
Ensured consistency
Branch names, release tags, JIRA tickets, migrations are always handled in a consistent manner — buying the development team ease-of-mind.
Ensured safety
Having the deploying developer prompted with a set of gut-check questions ensures that no one should be deploying without skipping a step, forgetting about a test, etc.
Public deployment notifications help promote team awareness and avoid miscommunication about timing or dependencies involved in builds.
Ensured simplicity
Not worrying about deployment details means less mental overhead spent by developers. This helps productivity, stress levels, and team trust.
Subtle Practical Benefits
When deployment is consistent, safe, and simple a whole slew of practical benefits are naturally realized
- A developer can deploy code their second day on the job
- A developer having an off-day is insulated against deployment mistakes
- Many deployments per day does not cause operational complexity
- Deploying early in the morning or late at night is less worrisome
- Developers can multi-task and save time while while deploying
- Tracking regressions over time/deployments becomes easier
If you asked developers to describe hypothetical traits of development teams they would like to work on, many of the above traits might be described.
And so, when given the chance to add those capabilities for one or two hundred lines of bash or ruby, the choice should be a no-brainer.
For millions of professionals, relationships are the backbone of a viable business. Whether you’re working with clients, prospects, or potential investors, Contactually helps you build stronger relationships with the people who can make you successful.