• Only MySQL is supported as external Database
Or
• Embedded MariaDB4j is supported, which is persistent and data is not lost, thus eliminating the need for external
The idea is to build a single production grade Spring Boot Jar with the following
• API Calls Scheduling - Using Quartz
• Optional Embedded Persistent MariaDB4j
To avoid the pain points of
• Perform API calls at partical schedules of the day manually
• Housing external database engine for API Calls Quartz Scheduler persistence unit.
--> Docker Image to host the Jar.
--> Spring Boot
• MariaDB4j
• Liquibase
• Flyway
• Spring Security
• Spring Boot Quartz Starter
cd <to project root folder>
mvn clean install
The maven build should place the APICallsScheduler-2.2.4.RELEASE.jar inside the target folder.
CI Provider | Status |
---|---|
Circle CI | |
Java CI | |
Travis CI |
CI Provider | Status |
---|---|
Docker | |
Docker Image CI |
Docker Image published to DockerHub here
Image is equipped with basic tools like vim, curl, wget, net-tools(telnet), iputils-ping
To pull the image :
docker pull zzzmahesh/APICallsScheduler
cd <to project root folder>/target
Below command will start the API Calls Scheduler Wrapper with Embedded MariaDB4J as Database and Embedded OAuth2 security as well as persistent Embedded Elasticsearch
java -jar APICallsScheduler-2.2.4.RELEASE.jar
The profiles included by default are
- basic
- mariadb4j
1) basic
This profile holds the basic startup configuration needed for the Spring Boot Wrapper.
2) mariadb4j
This profile configures and startsup Embedded MariaDB4J and the database details are passed on to Integrated ansible Server.
By default, the database is non-persistent. Set MARIADB4J_DIR parameter for enabling a persistent database. More details are discussed in configurations section.
Configurations available are as below. Shown are default values.
MYSQL_DATABASE: quartz
MYSQL_USER: quartz
MYSQL_PASSWORD: quartz
# This directory has to be explicitly set to let Embedded MariaDB know the master persistence location.
# Use embedded/persistence/mariadb4j to have a common persistence location for all embedded components.
# Default is NONE
MARIADB4J_DIR: NONE
3) mysql (cannot be selected alone, will need basic profile as well)
This profile configures the external MySQL database details passed on to Integrated quartz Server.
Configurations available are as below. Shown are default values.
MYSQL_DATABASE_HOST: localhost
MYSQL_DATABASE_PORT: 3306
MYSQL_DATABASE: quartz
MYSQL_USER: quartz
MYSQL_PASSWORD: quartz
Default Startup will include - basic, mariadb4j (without-persistent-storage).
For more detailed properties, refer to application-{profile}.yml file as per the required profile properties.
http://localhost:8880/ - To access the Swagger pertaining to APIs for ansible-docs, as redirection is taken care to OpenAPI UI.
To run the container :
docker run --name APICallsScheduler -p 8880:8880 -d zzzmahesh/api-calls-scheduler:latest
Few other examples / ways / configurations to run the container as:
1) Running with external MySQL - The database is decoupled. The Ansible Docs data is persistent as it uses MySQL Database.
docker run --name APICallsScheduler -p 8880:8880 \
-e SPRING_PROFILES_ACTIVE=basic,mysql \
-e MYSQL_DATABASE_HOST=172.x.x.x \
-e MYSQL_DATABASE_PORT=3306 \
-e MYSQL_USER=quartz \
-e MYSQL_PASSWORD=quartz \
-d zzzmahesh/api-calls-scheduler:latest
Similarly any combination of profile and configurations can be used.
All the below mentioned configurables / properties (under Available Profiles section) can be passed as Docker Container environment variables and will be set accordingly.
Available configurables - shown below with default values.
MYSQL_DATABASE quartz
MYSQL_USER quartz
MYSQL_PASSWORD quartz
MYSQL_DATABASE_HOST localhost
MYSQL_DATABASE_PORT 3306
MARIADB4J_DIR /appln/data/mariadb4j
SPRING_PROFILES_ACTIVE basic,mariadb4j
Also the below mentioned paths / volumes can be mounted to docker container for persistence, in case of embedded profiles (mariadb4j)
MARIADB4J_DIR /appln/data/mariadb4j
1) Deploy basic profile
cf push -f manifests/manifest.yml
2) Deploy cf-mysql profile : For PCF MySQL as Datasource i.e. binding Database service "cf-mysql-service"
cf push -f manifests/manifest-cf-mysql.yml