Browse Source
feat:update docker file and doc (#104)
* feat: add DATABASIR_JWT_SECRET config
* feat:update docs
master
vran
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
15 additions and
17 deletions
-
Dockerfile
-
api/src/main/resources/application.properties
-
docs/README/deploy/docker-deploy.md
-
docs/README/deploy/jar-deploy.md
-
local.Dockerfile
|
@ -8,7 +8,4 @@ WORKDIR /app |
|
|
COPY --from=build /app/api/build/libs/databasir.jar /app/databasir.jar |
|
|
COPY --from=build /app/api/build/libs/databasir.jar /app/databasir.jar |
|
|
EXPOSE 8080 |
|
|
EXPOSE 8080 |
|
|
|
|
|
|
|
|
#-Ddatabasir.datasource.username=${databasir.datasource.username} |
|
|
|
|
|
#-Ddatabasir.datasource.password=${databasir.datasource.password} |
|
|
|
|
|
#-Ddatabasir.datasource.url=${databasir.datasource.url} |
|
|
|
|
|
ENTRYPOINT ["sh", "-c","java -Ddatabasir.db.url=${DATABASIR_DB_URL} -Ddatabasir.db.username=${DATABASIR_DB_USERNAME} -Ddatabasir.db.password=${DATABASIR_DB_PASSWORD} -jar /app/databasir.jar"] |
|
|
ENTRYPOINT ["sh", "-c","java -Ddatabasir.db.url=${DATABASIR_DB_URL} -Ddatabasir.db.username=${DATABASIR_DB_USERNAME} -Ddatabasir.db.password=${DATABASIR_DB_PASSWORD} -jar /app/databasir.jar"] |
|
|
|
@ -12,4 +12,4 @@ spring.flyway.baseline-on-migrate=true |
|
|
spring.flyway.locations=classpath:db/migration |
|
|
spring.flyway.locations=classpath:db/migration |
|
|
# driver directory |
|
|
# driver directory |
|
|
databasir.db.driver-directory=drivers |
|
|
databasir.db.driver-directory=drivers |
|
|
databasir.jwt.secret=${random.uuid} |
|
|
databasir.jwt.secret=${DATABASIR_JWT_SECRET:${random.uuid}} |
|
@ -5,7 +5,7 @@ |
|
|
## 环境要求 |
|
|
## 环境要求 |
|
|
|
|
|
|
|
|
1. Docker |
|
|
1. Docker |
|
|
2. Mysql |
|
|
2. Mysql 5.7+ |
|
|
|
|
|
|
|
|
## 测活接口 |
|
|
## 测活接口 |
|
|
|
|
|
|
|
@ -38,13 +38,14 @@ docker run -p 8888:8080 --name my-databasir -e DATABASIR_DB_URL=127.0.0.1:3306 - |
|
|
|
|
|
|
|
|
**docker 启动命令参数说明** |
|
|
**docker 启动命令参数说明** |
|
|
|
|
|
|
|
|
| 参数 | 说明 | |
|
|
| 参数 | 说明 | 必填 | |
|
|
| ---------------------------------- | ------------------------------------------------- | |
|
|
| ---------------------------------- | ------------------------------------------------------------ | ---- | |
|
|
| --name my-databasir | 启动的镜像名称 | |
|
|
| --name my-databasir | 启动的镜像名称 | | |
|
|
| -e DATABASIR_DB_URL=127.0.0.1:3306 | 数据库连接地址 | |
|
|
| -e DATABASIR_DB_URL=127.0.0.1:3306 | 数据库连接地址 | 是 | |
|
|
| -e DATABASIR_DB_USERNAME=root | 数据库连接用户名 | |
|
|
| -e DATABASIR_DB_USERNAME=root | 数据库连接用户名 | 是 | |
|
|
| -e DATABASIR_DB_PASSWORD=123456 | 数据库连接密码 | |
|
|
| -e DATABASIR_DB_PASSWORD=123456 | 数据库连接密码 | 是 | |
|
|
| -p 8888:8080 | 将 databasir 的 8080 端口映射到宿主机的 8888 端口 | |
|
|
| -e DATABASIR_JWT_SECRET=databasir | 生成用户登录 Token 的秘钥,如果部署了多个实例,那多个实例之间的秘钥要保持一致。默认为 UUID | 否 | |
|
|
|
|
|
| -p 8888:8080 | 将 databasir 的 8080 端口映射到宿主机的 8888 端口 | | |
|
|
|
|
|
|
|
|
## 登录验证 |
|
|
## 登录验证 |
|
|
|
|
|
|
|
@ -54,4 +55,3 @@ docker run -p 8888:8080 --name my-databasir -e DATABASIR_DB_URL=127.0.0.1:3306 - |
|
|
- 密码:`databasir` |
|
|
- 密码:`databasir` |
|
|
|
|
|
|
|
|
这时候访问 http://localhost:8888 进入登录页,输入上面的账号和密码即可成功登入,到此就算部署完成 |
|
|
这时候访问 http://localhost:8888 进入登录页,输入上面的账号和密码即可成功登入,到此就算部署完成 |
|
|
|
|
|
|
|
|
|
@ -20,10 +20,14 @@ databasir.db.username=root |
|
|
databasir.db.password=123456 |
|
|
databasir.db.password=123456 |
|
|
# 数据库地址 |
|
|
# 数据库地址 |
|
|
databasir.db.url=127.0.0.1:3306 |
|
|
databasir.db.url=127.0.0.1:3306 |
|
|
|
|
|
# 登录 token 生成秘钥,可选 |
|
|
|
|
|
databasir.jwt.secret=${random.uuid} |
|
|
``` |
|
|
``` |
|
|
|
|
|
|
|
|
4. 通过 `java -jar Databasir.jar` 启动应用即可 |
|
|
4. 通过 `java -jar Databasir.jar` 启动应用即可 |
|
|
|
|
|
|
|
|
|
|
|
**注意:**如果部署了多个 databasir 实例,一定要定义 `databasir.jwt.secret` 的值,从而使得多个实例之间的 `databasir.jwt.secret` 保持一致 |
|
|
|
|
|
|
|
|
## 登录验证 |
|
|
## 登录验证 |
|
|
|
|
|
|
|
|
应用启动完成后会默认创建 Databasir 管理员用户 |
|
|
应用启动完成后会默认创建 Databasir 管理员用户 |
|
|
|
@ -3,7 +3,4 @@ WORKDIR /app |
|
|
ADD api/build/libs/databasir.jar /app/databasir.jar |
|
|
ADD api/build/libs/databasir.jar /app/databasir.jar |
|
|
EXPOSE 8080 |
|
|
EXPOSE 8080 |
|
|
|
|
|
|
|
|
#-Ddatabasir.datasource.username=${databasir.datasource.username} |
|
|
ENTRYPOINT ["sh", "-c","java -XX:+PrintCommandLineFlags -Ddatabasir.db.url=${DATABASIR_DB_URL} -Ddatabasir.db.username=${DATABASIR_DB_USERNAME} -Ddatabasir.db.password=${DATABASIR_DB_PASSWORD} -jar /app/databasir.jar"] |
|
|
#-Ddatabasir.datasource.password=${databasir.datasource.password} |
|
|
|
|
|
#-Ddatabasir.datasource.url=${databasir.datasource.url} |
|
|
|
|
|
ENTRYPOINT ["sh", "-c","java -Ddatabasir.db.url=${DATABASIR_DB_URL} -Ddatabasir.db.username=${DATABASIR_DB_USERNAME} -Ddatabasir.db.password=${DATABASIR_DB_PASSWORD} -jar /app/databasir.jar"] |
|
|
|
|
|