rancher powerjob部署

Last updated on November 22, 2024 pm

🧙 Questions

powerjobv3.2.2 rancher单节点安装

☄️ Ideas

前提

  • 安装git
sudo yum install -y git
  • 初始化一个数据库
CREATE DATABASE IF NOT EXISTS powerjob DEFAULT CHARSET utf8mb4;
GRANT ALL PRIVILEGES ON powerjob.* TO 'ispong'@'%';
Flush Privileges;
  • 安装maven
sudo yum install -y maven
powerjob 源码下载
git clone -b v3.2.2 https://gitee.com/KFCFans/PowerJob.git
sudo ln -s /data/downloads/PowerJob /opt/powerjob
修改配置文件
vim /opt/powerjob/powerjob-server/src/main/resources/application-daily.properties
oms.env=DAILY
logging.config=classpath:logback-dev.xml

####### 外部数据库配置(需要用户更改为自己的数据库配置) #######
# ispong :) 一般使用mysql做数据持久化
spring.datasource.core.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.core.jdbc-url=jdbc:mysql://172.23.39.226:30102/powerjob?useUnicode=true&characterEncoding=UTF-8
spring.datasource.core.username=ispong
spring.datasource.core.password=Define2022..

spring.datasource.core.hikari.maximum-pool-size=20
spring.datasource.core.hikari.minimum-idle=5

####### mongoDB配置,非核心依赖,可移除 #######
# spring.data.mongodb.uri=mongodb://jacdba:jac2021@192.168.16.80:27017/powerjob-daily

####### 邮件配置(启用邮件报警则需要) #######
#spring.mail.host=smtp.163.com
#spring.mail.username=zqq
#spring.mail.password=qqz
#spring.mail.properties.mail.smtp.auth=true
#spring.mail.properties.mail.smtp.starttls.enable=true
#spring.mail.properties.mail.smtp.starttls.required=true

####### 资源清理配置 #######
oms.instanceinfo.retention=1
oms.container.retention.local=1
oms.container.retention.remote=-1

####### 缓存配置 #######
oms.instance.metadata.cache.size=1024
vim /opt/powerjob/powerjob-server/src/main/resources/application-daily.properties
# http 服务端口
server.port=7700

spring.profiles.active=daily
spring.main.banner-mode=log
spring.jpa.open-in-view=false
spring.data.mongodb.repositories.type=none
logging.level.org.mongodb=warn

# 文件上传配置
spring.servlet.multipart.enabled=true
spring.servlet.multipart.file-size-threshold=0
spring.servlet.multipart.max-file-size=209715200
spring.servlet.multipart.max-request-size=209715200

###### PowerJob 自身配置(该配置只允许存在于 application.properties 文件中) ######
# akka ActorSystem 服务端口  默认端口号10086
# ispong :) 30110 如果自己jar运行则需要修改端口号
oms.akka.port=10086
# 报警服务 bean名称
oms.alarm.bean.names=omsDefaultMailAlarmService
# 表前缀(默认无表前缀,有需求直接填入表前缀即可,比如 pj_ )
oms.table-prefix=
# --- vim application.properties ---
maven打包
cd /opt/powerjob/powerjob-server
mvn clean package -Dmaven.test.skip=true
Jar直接运行 (可选|不推荐)
cd /opt/powerjob/powerjob-server/target
nohup java -jar -Xmx2048m powerjob-server-3.2.2.jar >> powerjob.log 2>&1 &
tail -f powerjob.log
镜像打包
sudo vim /opt/powerjob/powerjob-server/docker/Dockerfile
FROM adoptopenjdk:8-jdk-hotspot
MAINTAINER tengjiqi@gmail.com
ENV M2_HOME=/opt/powerjob-maven
ENV TZ=Asia/Shanghai
ENV APP_NAME=powerjob-server
ENV PARAMS=""
ENV JVMOPTIONS=""
COPY powerjob-server.jar /powerjob-server.jar
EXPOSE 7700 10086
ENTRYPOINT ["sh","-c","java $JVMOPTIONS -jar /powerjob-server.jar $PARAMS"]
cp /opt/powerjob/powerjob-server/target/powerjob-server-3.2.2.jar  /opt/powerjob/powerjob-server/docker/powerjob-server.jar
cd /opt/powerjob/powerjob-server/docker
docker build -t ispong/powerjob:3.2.2 .
Rancher部署
  • Name: infra-powerjob
  • Docker Image: ispong/powerjob:3.2.2
  • Port Mapping:
    • Port Name: powerjob-port
      • Publish the container port: 7700
      • On listening port: 30116
    • Port Name: powerjob-port-1
      • Publish the container port: 10086
      • On listening port: 30117
  • Security & Host Config
    • Pull Image: Never
  • 配置存在则不拉取

Note:
powerjob的传参长度默认是200 可能不够用,我们需要设置为5000

alter table powerjob.job_info modify job_params varchar(5000) null;

默认端口号: 7700


rancher powerjob部署
https://ispong.isxcode.com/kubernetes/rancher/rancher powerJob部署/
Author
ispong
Posted on
July 1, 2022
Licensed under