Commit 2512a06a authored by tanyang's avatar tanyang

迁移华为云改造

parent 6250a3d6
FROM anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER Tanyang
RUN mkdir -p /ruoyi/server/logs \
/ruoyi/server/temp \
/ruoyi/skywalking/agent
WORKDIR /ruoyi/server
ENV SERVER_PORT=8080
EXPOSE ${SERVER_PORT}
ADD ./target/dsk-operate-sys.jar ./dsk-operate-sys.jar
ENTRYPOINT ["java", \
"-Djava.security.egd=file:/dev/./urandom", \
"-Dserver.port=${SERVER_PORT}", \
# 应用名称 如果想区分集群节点监控 改成不同的名称即可
# "-Dskywalking.agent.service_name=ruoyi-server", \
# "-javaagent:/ruoyi/skywalking/agent/skywalking-agent.jar", \
"-jar", "dsk-operate-sys.jar"]
version: "3"
services:
dsk-operate-sys:
image: java:8u111-jdk-alpine
container_name: dsk-operate-sys
network_mode: host
restart: always
working_dir: /app
volumes:
- ./dsk-operate-sys:/app
command: "java -jar dsk-operate-sys.jar"
nginx:
image: nginx:perl
container_name: nginx
restart: always
network_mode: host
working_dir: /app
volumes:
- ./dsk-operate-ui/dist/:/www/szh/web/dist/
- ./dsk-operate-ui/operate.conf:/etc/nginx/conf.d/operate.conf
- ./dsk-operate-ui/log:/var/log/nginx
\ No newline at end of file
......@@ -49,9 +49,12 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://192.168.0.79:3306/dsk_operate_sys?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: dev
password: 8AXjjCHZ666!
# url: jdbc:mysql://192.168.0.79:3306/dsk_operate_sys?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: dev
# password: 8AXjjCHZ666!
url: jdbc:mysql://rds-szh.dsk.com/dos?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: dsk_api_szh
password: j1nxbVPF0QS*B57C
# 从库数据源
# slave:
# lazy: true
......@@ -101,13 +104,13 @@ spring:
--- # redis 单机配置(单机与集群只能开启一个另一个需要注释掉)
spring:
redis:
host: 192.168.0.79
host: redis-szh.dsk.com
# 端口,默认为6379
port: 6379
# 数据库索引
database: 6
# 密码
password: zfTFIJjaN#6xB83r
password: Xi8$r*@d7zn5FaP2
# 密码(如没有密码请注释掉)
# password:
# 连接超时时间
......
......@@ -107,7 +107,7 @@ sa-token:
# token名称 (同时也是cookie名称)
token-name: Authorization
# token有效期 设为一天 (必定过期) 单位: 秒
timeout: 18000
timeout: 28800
# 多端不同 token 有效期 可查看 LoginHelper.loginByDevice 方法自定义
# token最低活跃时间 (指定时间无操作就过期) 单位: 秒
active-timeout: 18000
......
package com.dsk.test;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.*;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.web.client.RestTemplate;
/**
* @author tanyang
* @create 2023-08-07 13:30
**/
@Slf4j
@SpringJUnitConfig
@SpringBootTest
public class JunitTest {
@Autowired
private RestTemplate restTemplate;
@Test
public void testApi(){
String requestBody="[\n" +
"\t{\n" +
"\t\t\"distribution\": 1,\n" +
"\t\t\"params\": {\n" +
"\t\t\t\"current\": 1,\n" +
"\t\t\t\"fields\": \"\",\n" +
"\t\t\t\"orderBy\": \"astId desc\",\n" +
"\t\t\t\"page\": 9,\n" +
"\t\t\t\"perpage\": 200\n" +
"\t\t},\n" +
"\t\t\"psrType\": \"0301\"\n" +
"\t}\n" +
"]";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> requestEntity = new HttpEntity<>(requestBody, headers);
ResponseEntity<String> responseEntity = restTemplate.exchange("http://25.84.40.150:32100/PSROenter/queryServices/commonQuery", HttpMethod.POST, requestEntity, String.class);
if (responseEntity.getStatusCode().is2xxSuccessful()) {
String responseBody = responseEntity.getBody();
log.info("获取结果:{}",responseBody);
// 处理响应结果
// return responseBody;
} else {
// 处理错误情况
int statusCodeValue = responseEntity.getStatusCodeValue();
String responseBody = responseEntity.getBody();
log.info("错误结果{}",responseBody);
// return "状态吗错误:"+ statusCodeValue;
}
}
}
server
{
listen 80;
server_name szh.jiansheku.com;
index index.php index.html index.htm default.php default.htm default.html;
error_page 500 502 503 504 /50x.html;
access_log /var/log/nginx/szh.jiansheku.com.access.log;
error_log /var/log/nginx/szh.jiansheku.com.error.log;
location / {
root /www/szh/web/dist/;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location = /50x.html {
root html;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment