Continuous Deployment with Spring-boot and Travis
One of the more interesting things I've setup lately has been continuous deployment for Spring-boot using Travis. We are deploying to Elastic Beanstalk with our database running on Amazon RDS. Our current process creates a database snapshot and updates the app when the master branch is updated.
Deploying Spring boot
This is pretty simple thanks to dpl the deployment library travis uses. Elastic Beanstalk is supported so deployment is as simple as adding some confirmation to your .travis.yml file. Here is what our war deployment looks like.
[Embedded code (GitHub Gist)]
While our current process is deploying master, you can also control what branch gets deployed by adding. This would only deploy a branch called staging to elastic beanstalk.
[Embedded code (GitHub Gist)]
Backing up the database
Amazon's RDS does have a robust backup system, but we want to ensure we have a snapshot backup before deploying. We do this using the before_deploy hook. We fire a script that creates a snapshot.
[Embedded code (GitHub Gist)]
We do have to install the awscli tools. We use pip to install these then run our script.
[Embedded code (GitHub Gist)]
There you have it, continuous deployment with database backups to elastic beanstalk. I do still plan some small additions to our process. I'm hoping to have travis post to Slack that the app was updated and include a change log. Automation FTW.
Read the original post with all embeds and interactive content at https://rants.broonix.ca/continuous-deployment-with-spring-boot-and-travis/
Discussion in the ATmosphere