Build Status

ci-spring-boot

Example of Continuous Integration using Travis and Spring Boot.

This example is a simulation of a Task Manager.

Technologies

Configuration

You need to have installed Java and Maven

Spring Boot

For the development profile you do not need to configure anything. In this profile you will use a h2 database.

If you want to use a production profile, you need to change the database configurations into application-prod.properties. In my example I use a environment variable __${DATABASE_URL}__ to configure the database url.

Heroku

Create an account and then create a new app.

Into your new app add a Add-ons Postgresql database. By default, the environment variable DATABASE_URL will be created.

Travis CI

Create an account and put your repository to be observed by travis.

In your new listener, you need to configure the environment variable $HEROKU_API_KEY or put directly into a .travis.yml (it's not secure).

You need to change the deploy>app into .travis.yml to the same name of heroku app.

Run

Dev Profile
$ mvn spring-boot:run 
Production Profile
$ mvn spring-boot:run -Dspring.profiles.active=prod

Run with Docker Command Line

$ mvn clean package  
$ docker build -t mytask .  
$ docker run -it -p 8080:8080 --name mytask-container mytask

Run with docker-maven-plugin

$  mvn clean package docker:build --batch-mode release:update-versions  
$ docker run -it -p 8080:8080 --name mytask-container mytask

License

MIT