This repository contains a web application implemented with Spring Framework (Java). The application is a CRUD of an admin system available in spring-boot-adminlte project.
We use GitLab CI/CD & Heroku to execute the continuous delivery pipeline. You can found the GitLab version of this project here: https://gitlab.com/Samuellucas97/Admin-CI-CD.
App deployed:
Staging mode
: https://admin-lte2-staging.herokuapp.comProduction mode
: https://admin-lte2.herokuapp.com
- Java (version 11)
- Postgres database service
- Docker compose (optional)
- Maven
- Google Chrome
In your computer, run the following commands to clone in your local machine:
$ git clone https://github.com/Samuellucas97/Admin-CI-CD
$ cd Admin-CI-CD
After this, we need to start database service. We will use Docker technology to do this. But you can use whatever database service you want.
Otherwise, it's very important to have the same configuration used in application.yaml
.
We are setting the file src/main/resource/application.yaml
as following:
- Database name:
spring_adminlte
- Database user:
sa
- Database password:
root
Since you have installed Docker compose, just execute the following instruction at terminal:
$ docker-compose up -d
It will be generated a database service container according docker-compose.yaml
.
Since you have a database running in you local machine, you have the following set of available commands:
Command | Information |
---|---|
To run the application on port 8080 | mvn spring-boot:run |
To generate project's build | mvn clean package |
To run end-to-end test (headless mode activated) | mvn test |
To run end-to-end test (with graphic interface activated) | HEADLESS=false mvn test |
To run tests and generate HTML test report (available in target/site/surefire-report.html ) |
mvn surefire-report:report site -DgenerateReports=false |
To run end-to-end test on staging environment | SPRING_PROFILES_ACTIVE='staging' HOST='<protocol><your host>' mvn clean test |
If the application is running, you will have only this user registered:
- username:
admin
- password:
1234
Title Page | URL | Screenshots |
---|---|---|
Login | http://localhost:8080/login | |
Dashboard | http://localhost:8080/ | |
Add Customer | http://localhost:8080/login | |
List of Customers | http://localhost:8080/login |
If you have cloned this repository, and you would like to execute the pipeline available on .gitlab-ci.yaml
, you have:
- access the Heroku platform
- create two new Heroku app (staging app and production app)
- add Postgres as add-on
- get Heroku API Key from your account
- access GitLab.com platform
- create a new project
- choose the option
Run CI/CD for external repository
- import from GitHub
- For this, you will need connect your GitHub account with your GitLab account
- Create new variables in
Setting -> CI/CD
- name: HEROKU_APP_STAGING; value:
<name of your staging app>
- name: HEROKU_APP_PRODUCTION; value:
<name of your production app>
- name: HEROKU_API_KEY; value:
<heroku api key>
- name: HEROKU_APP_STAGING; value:
With the pipeline result is ok, then try to access your site in https://<HEROKU_APP_PRODUCTION>.herokuapp.com