更新部署文档

This commit is contained in:
Himit_ZH 2021-05-01 10:50:24 +08:00
parent c6391fb9e0
commit 26c16b2b64
6 changed files with 31 additions and 27 deletions

View File

@ -7,7 +7,7 @@
1. 创建自定义网络(用于容器通讯)
```shell
docker network create hoj-network
docker network create --subnet=172.18.0.0/16 hoj-network
```
2. 查看网络
@ -33,6 +33,7 @@
docker run -p 3306:3306 --name mysql -d \
--restart=always \
--network hoj-network \
--ip 172.18.0.1 \
-v /data/mysql/conf:/etc/mysql/conf.d \
-v /data/mysql/logs:/logs \
-v /data/mysql/data:/data \
@ -62,10 +63,26 @@
2. 启动nacos
```shell
docker run --env MODE=standalone --network hoj-network --name nacos -d -p 8848:8848 nacos/nacos-server
docker run -d \
-e JVM_XMS=128m \
-e JVM_XMX=128m \
-e JVM_XMN=64m \
-e MODE=standalone \
-e SPRING_DATASOURCE_PLATFORM=mysql \
-e MYSQL_SERVICE_HOST="数据库所在服务器ip" \
-e MYSQL_SERVICE_PORT=3306 \
-e MYSQL_SERVICE_USER=root \
-e MYSQL_SERVICE_PASSWORD="数据库密码" \
-e MYSQL_SERVICE_DB_NAME=nacos \
-p 8848:8848 \
--network hoj-network \
--ip 172.18.0.3 \
--name nacos \
--restart=always \
nacos/nacos-server
```
3. 查看自定义网络中各容器ip一般该network的ip应该是**172.18.0.2或172.19.0.2**
3. 查看自定义网络中各容器ip一般该hoj-network的ip应该是**172.18.0.2或172.19.0.2**
```shell
//查看网络
@ -74,24 +91,6 @@
docker network inspect hoj-network
```
4. 进入nacos容器修改配置
```shell
// 进入容器
docker exec -it nacos bash
// 修改容器配置
cd conf
vi application.properties
```
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200411202402562.jpg?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3hpZXFpbmdfeHE=,size_16,color_FFFFFF,t_70)
5. 重启容器
```shell
docker restart nacos
```
6. 连上nacos将后端服务需要的配置添加进去
```she
@ -194,8 +193,11 @@ docker pull redis
//查看本地是否有redis镜像
docker images
//运行redis并设置密码
docker run -d --name redis -p 6379:6379 redis --requirepass "mypassword" --restart=always
//运行redis并设置密码 一般运行
docker run -d --name redis -p 6379:6379 redis --appendonly yes --requirepass "mypassword" --restart="always" --network hoj-network
// 有配置文件 数据挂载的运行
docker run -d --name redis -p 6379:6379 -v /hoj/redis/data:/data -v /hoj/redis/conf/redis.conf:/etc/redis/redis.conf --restart="always" --network hoj-network --ip 172.18.0.2 redis --requirepass "mypassword"
```
#### 1.4 DataBackup数据后台部署

View File

@ -11,4 +11,5 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api")
public class CommentController {
}

View File

@ -1,6 +1,6 @@
hoj-backstage:
port: 6688 # 本服务器启动的端口号
nacos-url: 172.18.0.2:8848 # nacos的地址
nacos-url: 172.18.0.3:8848 # nacos的地址
server:
port: ${hoj-backstage.port}

View File

@ -68,6 +68,7 @@ public class CodeForcesJudge implements RemoteJudgeStrategy {
Map<String, Object> loginUtils = getLoginUtils(username, password);
CodeForcesToken token = (CodeForcesToken) loginUtils.get("token");
Connection connection = JsoupUtils.getConnectionFromUrl(HOST + String.format(SUBMIT_URL,token.csrf_token), headers, token.cookies);
System.out.println(token.cookies);
Connection.Response response = JsoupUtils.postResponse(connection, MapUtil
.builder(new HashMap<String, String>())
.put("csrf_token", token.csrf_token)

View File

@ -17,7 +17,7 @@ if (process.env.NODE_ENV == 'development') {
} else if (process.env.NODE_ENV == 'debug') {
axios.defaults.baseURL = "http://localhost:6688";
} else if (process.env.NODE_ENV == 'production') {
axios.defaults.baseURL = '你的域名';
axios.defaults.baseURL = '你网站的域名';
}
// 请求超时时间

View File

@ -3,7 +3,7 @@
<el-row class="header">
<el-col :xs="24" :sm="14" :md="14" :lg="14">
<div class="select-row">
<span>Langs:</span>
<span>Lang:</span>
<span>
<el-select
:value="this.language"
@ -274,7 +274,7 @@ export default {
}
@media screen and (min-width: 768px) {
.select-row span {
margin-right: 5px;
margin-right: 3px;
}
.fl-right {
float: right;