🐳 添加 docker 配置.
This commit is contained in:
53
docker-compose.yml
Normal file
53
docker-compose.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
orion-ops-pro:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/orion-ops-pro/Dockerfile
|
||||
image: orion-ops-pro:1.0.0
|
||||
ports:
|
||||
- 1081:80
|
||||
environment:
|
||||
- REDIS_HOST=orion-ops-pro-redis
|
||||
- MYSQL_HOST=orion-ops-pro-db
|
||||
- MYSQL_USER=orion
|
||||
- MYSQL_PASSWORD=Data@123456
|
||||
- SECRET_KEY=secret-key
|
||||
volumes:
|
||||
- /data/orion-ops-pro-space/docker-volumes/orion-ops-pro/logs:/root/orion/logs/orion-ops-pro
|
||||
depends_on:
|
||||
- orion-ops-pro-db
|
||||
- orion-ops-pro-redis
|
||||
orion-ops-pro-db:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: docker/mysql/Dockerfile
|
||||
privileged: true
|
||||
ports:
|
||||
- 3307:3306
|
||||
environment:
|
||||
- MYSQL_DATABASE=orion-ops-pro
|
||||
- MYSQL_USER=orion
|
||||
- MYSQL_PASSWORD=Data@123456
|
||||
- MYSQL_ROOT_PASSWORD=Data@123456
|
||||
volumes:
|
||||
- /data/orion-ops-pro-space/docker-volumes/mysql/var-lib-mysql:/var/lib/mysql
|
||||
- /data/orion-ops-pro-space/docker-volumes/mysql/var-lib-mysql-files:/var/lib/mysql-files
|
||||
- /data/orion-ops-pro-space/docker-volumes/mysql/etc-mysql:/etc/mysql
|
||||
image: orion-ops-pro-db:8.0
|
||||
orion-adminer:
|
||||
image: adminer
|
||||
restart: always
|
||||
ports:
|
||||
- 8081:8080
|
||||
orion-ops-pro-redis:
|
||||
image: redis:6.0.16-alpine
|
||||
command: redis-server --requirepass Data@123456
|
||||
ports:
|
||||
- 6380:6379
|
||||
volumes:
|
||||
- /data/orion-ops-pro-space/docker-volumes/redis/var-lib-mysql:/etc/redis
|
||||
- /data/orion-ops-pro-space/docker-volumes/redis/data:/data
|
||||
|
||||
|
||||
:
|
||||
9
docker/mysql/Dockerfile
Normal file
9
docker/mysql/Dockerfile
Normal file
@@ -0,0 +1,9 @@
|
||||
FROM mysql:8.0.28
|
||||
COPY sql/init-1-schema-databases.sql /tmp
|
||||
COPY sql/init-2-schema-tables.sql /tmp
|
||||
COPY sql/init-3-data.sql /tmp
|
||||
COPY docker/mysql/my.cnf /etc/mysql/conf.d/my.cnf
|
||||
RUN cat /tmp/init-1-schema-databases.sql >> /tmp/init.sql && \
|
||||
cat /tmp/init-2-schema-tables.sql >> /tmp/init.sql && \
|
||||
cat /tmp/init-3-data.sql >> /tmp/init.sql && \
|
||||
cp /tmp/init.sql /docker-entrypoint-initdb.d
|
||||
25
docker/mysql/my.cnf
Normal file
25
docker/mysql/my.cnf
Normal file
@@ -0,0 +1,25 @@
|
||||
[client]
|
||||
# 客户端默认字符集
|
||||
default_character_set=utf8mb4
|
||||
[mysql]
|
||||
# 默认字符集
|
||||
default_character_set=utf8mb4
|
||||
[mysqld]
|
||||
# pid文件
|
||||
pid-file=/var/run/mysqld/mysqld.pid
|
||||
# sock文件
|
||||
socket=/var/run/mysqld/mysqld.sock
|
||||
# 数据目录
|
||||
datadir=/var/lib/mysql
|
||||
# 不区分大小 0区分 1不区分
|
||||
lower_case_table_names=1
|
||||
# 服务器时区
|
||||
default-time_zone='+8:00'
|
||||
# 服务端字符集
|
||||
character_set_server=utf8mb4
|
||||
# 字符排序规则
|
||||
collation_server=utf8mb4_general_ci
|
||||
# 默认存储引擎
|
||||
default-storage-engine=InnoDB
|
||||
# 禁止 DNS 解析
|
||||
skip-name-resolve
|
||||
10
docker/orion-ops-pro/Dockerfile
Normal file
10
docker/orion-ops-pro/Dockerfile
Normal file
@@ -0,0 +1,10 @@
|
||||
FROM nginx:alpine
|
||||
USER root
|
||||
RUN apk add openjdk8
|
||||
RUN rm -rf /etc/nginx/conf.d/*
|
||||
WORKDIR /app
|
||||
COPY orion-ops-launch/target/orion-ops-launch.jar /app/app.jar
|
||||
COPY orion-ops-ui/dist /usr/share/nginx/html
|
||||
ADD docker/orion-ops-pro/entrypoint.sh /app/entrypoint.sh
|
||||
ADD docker/orion-ops-pro/nginx.conf /etc/nginx/conf.d
|
||||
ENTRYPOINT [ "sh", "/app/entrypoint.sh" ]
|
||||
4
docker/orion-ops-pro/entrypoint.sh
Normal file
4
docker/orion-ops-pro/entrypoint.sh
Normal file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
nginx
|
||||
cd /app
|
||||
java -jar app.jar --spring.profiles.active=prod
|
||||
53
docker/orion-ops-pro/nginx.conf
Normal file
53
docker/orion-ops-pro/nginx.conf
Normal file
@@ -0,0 +1,53 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name localhost;
|
||||
|
||||
# 是否启动 gzip 压缩
|
||||
gzip on;
|
||||
# 需要压缩的常见静态资源
|
||||
gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
|
||||
# 如果文件大于 1k 就启动压缩
|
||||
gzip_min_length 1k;
|
||||
# 缓冲区
|
||||
gzip_buffers 4 16k;
|
||||
# 压缩的等级
|
||||
gzip_comp_level 2;
|
||||
# access_log /var/log/nginx/host.access.log main;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /orion/api {
|
||||
proxy_pass http://localhost:9200/orion/api;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /orion/keep-alive {
|
||||
proxy_pass http://localhost:9200/orion/keep-alive;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_read_timeout 3600s;
|
||||
proxy_send_timeout 3600s;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
spring:
|
||||
datasource:
|
||||
druid:
|
||||
url: jdbc:mysql://127.0.0.1:3306/orion-ops-pro?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
||||
username: root
|
||||
password: Data@123456
|
||||
url: jdbc:mysql://${MYSQL_HOST:127.0.0.1}:3306/orion-ops-pro?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=Asia/Shanghai&autoReconnect=true
|
||||
username: ${MYSQL_USER:root}
|
||||
password: ${MYSQL_PASSWORD:Data@123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
# 最小连接池数量
|
||||
@@ -18,10 +18,10 @@ spring:
|
||||
stat:
|
||||
enabled: true
|
||||
redis:
|
||||
host: 127.0.0.1
|
||||
port: 6379
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
port: ${REDIS_PORT:6379}
|
||||
database: 0
|
||||
password: lijiahang
|
||||
password: ${REDIS_PASSWORD:Data@123456}
|
||||
timeout: 3000
|
||||
|
||||
springdoc:
|
||||
@@ -40,7 +40,7 @@ orion:
|
||||
crypto:
|
||||
aes:
|
||||
# 加密秘钥
|
||||
secret-key: uQeacXV8b3isvKLK
|
||||
secret-key: ${SECRET_KEY:uQeacXV8b3isvKLK}
|
||||
async:
|
||||
executor:
|
||||
core-pool-size: 8
|
||||
|
||||
Reference in New Issue
Block a user