- Start the devops-ci VM in the BME VIK Cloud (Smallville)
- Create new GitHub repository for the demo SpringBoot RESTFul application
git clone https://github.com/szatmari/devops-ci.git
git remote set-url myorigin YOUR_GIT_URL
git pull myorigin master --allow-unrelated-histories
git push -u myorigin master
- Run the SpringBoot REST App
./gradlew bootRun
- Test the application:
curl http://localhost:8088/greeting?name=Zoltan
- Add dependency (src/main/java/hello/Greeting.java)
import org.joda.time.LocalTime;
...
public String getContent() {
LocalTime currentTime = new LocalTime();
return content +" " + currentTime;
}
- Test the application again
curl http://localhost:8088/greeting?name=Zoltan
- Map the port 8088 to the public interface in the BME Cloud Manager
- Test the application on the generated URL using a browser
- Map the port 8080 to the public interface in the BME Cloud Manager
- Visit the generated endpoint
- Create a new freestyle job
- Set your GitHub link to your project
- Configure SCM: git
- Add your repository URL
- Set the "Branches to build" property to "*/master"
- Add "Invoke gradle script" to the Build section
- Set the gradle task: "build"
- Add a Post Build action: Publish Junit test results
- Set the path of the "Test report XMLs" to "build/test-results/test/*.xml"
- Set build trigger: Poll SCM "* * * * *"
- Add a new build task to do deployment: "Execute shell"
docker-compose up -d --force-recreate
- Visit and login to https://travis-ci.org/ using your GitHub account
- Open your profile page and connect your GitHub Rpository (enable) to Travis https://travis-ci.org/account/repositories
- Add, commit and push the travis.yml file to your repository
language: java
jdk: openjdk8
- Add Procfile for Heroku deployment
web java -Dserver.port=$PORT -jar target/gs-rest-service-0.1.0.jar
- Add deploy steps to the .travis,yml
language: java
jdk: openjdk8
deploy:
provider: heroku
api_key: paceholder
app: devops-ci
- Generate secure API key for Heroku deployment for this repository
travis encrypt paste-your-api-key-here --add deploy.api_key --org
- Check the app on your Heroku URL