1.先去pg建一个·powerjob-product·库
2.首先去拉最新的包,然后找到server模块,把mysql的配置文件信息替换成pg的
spring.datasource.hikari.auto-commit=true
spring.datasource.remote.hibernate.properties.hibernate.dialect=tech.powerjob.server.persistence.config.dialect.PowerJobPGDialect
spring.datasource.core.driver-class-name=org.postgresql.Driver
spring.datasource.core.jdbc-url=jdbc:postgresql://ip:15432/powerjob-product?currentSchema=public&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
currentSchema=public&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true
spring.datasource.core.username=postgres
spring.datasource.core.password=postgres
spring.datasource.core.hikari.maximum-pool-size=20
spring.datasource.core.hikari.minimum-idle=5
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL94Dialect
3.搜索server中实体注解为@lob的实体,加一个注解
@org.hibernate.annotations.Type(type = "org.hibernate.type.TextType")
然后启动就好了,这样可以jar包部署
下面是docker部署方法:
1.把项目中server下的docker下面的内容传到服务器上,加上server的jar包
传到指定目录下
2.运行Dockerfile打镜像命令
docker build -t tjqq/powerjob-server:v1 .
运行·docker images|grep powerjob·命令查看镜像是否打成功
成功后运行起docker容器命令
docker run -d \
--restart=always \
--name powerjob-server \
-p 7700:7700 -p 10086:10086 -p 10010:10010 \
-e TZ="Asia/Shanghai" \
-e JVMOPTIONS="" \
-e PARAMS="--spring.profiles.active=product --spring.datasource.core.jdbc-url=jdbc:postgresql://ip:15432/powerjob-product?currentSchema=public&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useSSL=false&allowMultiQueries=true --spring.datasource.core.username=postgres --spring.datasource.core.password=postgres --spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL94Dialect --spring.datasource.core.auto-commit=true" \
-v /data/cy/powerjob/powerjob-server:/root/powerjob/server -v /data/cy/powerjob/powerjob-server/.m2:/root/.m2 \
tjqq/powerjob-server:v1
就可以成功启动了
注意:手动起的容器,没有前端页面,因此前端页面必须自己部署,用nginx代理一下