spring boot quartz scheduler
1.0.0
Spring Boot + Quartz + vueJs(Vuetify) 应用程序。
该解决方案提供管理和调度作业,这些作业对提供的端点进行 HTTP 调用。调度器的好处是我们可以将它部署在集群中。(受到quartz集群模式设置的启发)
环境变量:
export DB_NAME='<your_db_name>'
export DB_HOST='<your_db_host>'
export DB_PORT='<your_db_port>'
export DB_USERNAME='<your_db_user>'
export DB_PASSWORD='<your_db_password>'
Quartz 模式创建:
./gradlew flywayMigrate
#Note : this is alreday initialise by spring hibernate.ddl-auto: update property
要构建 fat JAR 并运行测试:
./gradlew build test
Jacoco tst 覆盖范围:
./gradlew jacocoTestReport
跑步:
java -jar build/libs/spring-boot-quartz-scheduler-1.0-SNAPSHOT.jar
OR
./gradlew bootRun
码头工人:
## build
docker build -t needubey/quartz_scheduler
# RUN
docker run --name quartz_scheduler
-p 1234:1234
--env DB_NAME="quartz_scheduler"
--env DB_HOST="postgres"
--env DB_PORT="5432"
--env DB_USER_NAME="postgres"
--env DB_PASSWORD="postgres"
--detach
needubey/quartz_scheduler
Docker 组合:
version: '3'
services:
postgres:
container_name: postgres
image: postgres
environment:
POSTGRES_DB: ${DB_NAME:-quartz_scheduler}
POSTGRES_USER: ${DB_USERNAME:-postgres}
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
PGDATA: /data/postgres
volumes:
- postgres:/data/postgres
ports:
- "5432:5432"
networks:
- postgres
restart: unless-stopped
quartzscheduler:
depends_on:
- "postgres"
container_name: quartz_scheduler
build: .
image: needubey/quartz_scheduler
environment:
DB_NAME: ${DB_NAME:-quartz_scheduler}
DB_HOST: ${DB_HOST:-postgres}
DB_PORT: 5432
DB_USERNAME: ${DB_USERNAME:-postgres}
DB_PASSWORD: ${DB_PASSWORD:-postgres}
ports:
- "${SCHEDULER_PORT:-1234}:1234"
networks:
- postgres
restart: unless-stopped
networks:
postgres:
driver: bridge
volumes:
postgres:
应用程序-> http://localhost:1234/
招摇 - > http://localhost:1234/swagger-ui.html