Make End-of-the-month-process Great Again!
This is the repository holding the sources for our MEGA application, which provides us an aggregated view over our employees ZEP time entries.
MEGA 1.x.x
The first intention was to provide our employees an application where at the beginning of a month the employees can check their time entries of the former month.
MEGA 2.x.x
In this version we implemented features for project managers whereby the project managers can check project related time entries of their project members.
The following image illustrates the service structure of the MEGA services and external services MEGA depends on.
The following services are provided by MEGA:
-
Backend
The Quarkus microservice representing the REST backend for the frontend application and integrates the external services such asZEP
andGMAIL
-
Frontend
The Apache service hosting the compiled Angular frontend application which retrieves its data from the backend -
Database (PostgreSQL)
The MEGA database which holds transformed and aggregated data retrieved from the ZEP time management system
The following external services are integrated and used by MEGA:
-
OAUTH (Google)
The OAUTH service provided by Google which is used to authenticate our employees -
GMAIL (Google)
The Gmail email service provided by Google which is used by MEGA for communicating with our employees -
ZEP
The time management system where all our employees enter their time entries
The following listing shows the technologies used by the project MEGA.
MEGA depends on an Openshift Infrastructure setup with mega-infrastructure:2.x.
The following sections will explain how a developer can setup the local development environment and get MEGA running.
You need the following software suitable for your used platform:
-
OpenJDK 11
-
Maven 3.6.3
-
NodeJS 12.x.x
-
Npm 6+
-
Docker
The backend project is located at ./mega-zep-backend
.
-
Start local postgres instance
docker run -p 5432:5432 --env POSTGRES_PASSWORD=mega --env POSTGRES_USER=mega --env POSTGRES_DB=mega --name mega-db postgres:10
-
Go to
cd ./mega-zep-backend
-
Build the application
mvn clean install
-
Start quarkus in development mode
mvn quarkus:dev
The database schema will be created/migrated after the service started with quarkus:dev
.
The frontend project is located at ./mega-zep-frontend
.
-
Install global dependencies
npm install -g @angular/cli
-
Go to the project
cd ./mega-zep-frontend/src/main/angular/frontend
-
Install project dependencies
npm install
-
Start webserver
npx ng serve
-
Test the frontend
npx ng test
The frontend will take some time to come up which is due to the compilation process which takes some time.
The following file ./mega-zep-backend/.env
contains the secret values and has to be added manually by the developers.
# The auth token provided by ZEP
TOKEN=***
# The gmail password to use
MAILER_PASSWORD=***
## STAGE deployments only, not for local
# The database user
DB_USER=***
# the database users password
DB_PASSWORD=***
# the host:port where to reach the database
DB_HOST=***
Important
|
Without this file the backend won’t start. |
MEGA uses a database to store persistent data whereby the database is managed by liquibase.
For the local development we use Postgres which is automatically setup by liquibase during mvn quarkus:dev
startup.
We use the liquibase-maven-plugin
which provides maven goals to manage the local database.
The source definition of our database schema is the JPA datamodel, and we generate the changeset files via the liquibase-maven-plugin
.
Important
|
All liquibase maven goals work on the compiled sources and resources located in ./mega-zep-backend/target/classes/ .
|
The following sections provide information about how to use the liquibase-maven-plugin properly.
-
Drop the current database schema
mvn liquibase:dropAll
-
Generate the changeset
mvn liquibase:generateChangeLog
Important
|
Ensure that the generated full changeset is proper and that everything has been defined in the JPA model. |
-
Ensure the database is consistent with the current liquibase definitions
liquibase:update
-
Generate the diff changeset
mvn liquibase:diff
-
Apply newly created changeset
liquibase:update
Important
|
Liquibase updates only work on consistent database states defined by changeset files, and the state persisted in the liquibase specific tables, so if a changeset has already been applied then it cannot be reapplied again anymore, and the database needs to be dropped and recreated in full. |