docker镜像打包脚本维护:docker compose;建表语句deploy/DB

business
Mahone 8 months ago
parent 13c9b5583a
commit 077083e137

@ -0,0 +1,5 @@
FROM mysql:5.7
MAINTAINER mahone<liuwenxiong@mail.kykms.cn>
COPY ./km_mysql.sql /docker-entrypoint-initdb.d

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -0,0 +1,5 @@
FROM elasticsearch:7.6.1
MAINTAINER hnliuwx@gmail.com
ADD elasticsearch.tar /usr/share/elasticsearch/plugins/analysis-ik

Binary file not shown.

@ -0,0 +1,4 @@
FROM redis:6.0
MAINTAINER hnliuwx@gmail.com

File diff suppressed because it is too large Load Diff

@ -0,0 +1,96 @@
# 先创建讯网络:
# docker network create --driver=bridge kykms_network
version: '3'
services:
kykms-mysql:
build:
context: DB
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: '%'
TZ: Asia/Shanghai
restart: always
container_name: kykms-mysql
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-mysql:comm
volumes:
- ./docker/mysql/data:/var/lib/mysql
- ./docker/mysql/log:/var/log/mysql
command:
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--max_allowed_packet=128M
ports:
- 3306:3306
networks:
kykms_network:
kykms-redis:
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-redis:6.0
build:
context: ./redis
ports:
- 6379:6379
restart: always
container_name: kykms-redis
networks:
kykms_network:
kykms-ES:
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-es:7.6.1
build:
context: ES
restart: always
container_name: kykms-ES
environment:
discovery.type: single-node
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
TZ: Asia/Shanghai
ports:
- 9200:9200
- 9300:9300
networks:
kykms_network:
kykms:
build:
context: ../jeecg-boot/jeecg-boot-module-system
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms:comm
container_name: kykms
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
depends_on:
- kykms-mysql
- kykms-redis
- kykms-ES
ports:
- "8080:8080"
networks:
kykms_network:
restart: always
command: java -jar ./jeecg-boot-module-system-2.4.5.jar 2>&1 &
kykms-nginx:
build:
context: ../ant-design-vue-jeecg
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-nginx:comm
depends_on:
- kykms
container_name: kykms-nginx
privileged: true
ports:
- "80:80"
volumes:
- ./docker/nginx/conf.d/:/etc/nginx/conf.d/
- ./docker/nginx/log:/var/log/nginx
networks:
kykms_network:
restart: always
networks:
kykms_network:
external: true

@ -0,0 +1,84 @@
version: '3'
services:
kykms-mysql-comm:
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_ROOT_HOST: '%'
TZ: Asia/Shanghai
restart: always
container_name: kykms-mysql-comm
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-mysql:comm
command:
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--explicit_defaults_for_timestamp=true
--lower_case_table_names=1
--max_allowed_packet=128M
ports:
- 3306:3306
networks:
kykms_network:
kykms-redis-comm:
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-redis:6.0
ports:
- 6379:6379
restart: always
container_name: kykms-redis-comm
volumes:
- ./docker/redis/conf:/etc/redis
command: [ "redis-server", "/etc/redis/redis.conf" ]
networks:
kykms_network:
kykms-ES-comm:
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-es:7.6.1
restart: always
container_name: kykms-ES-comm
volumes:
- ./docker/elasticsearch/ddata:/usr/share/elasticsearch/data
- ./docker/elasticsearch/logs:/usr/share/elasticsearch/logs
ports:
- 9200:9200
- 9300:9300
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms1G -Xmx2G"
- TZ=Asia/Shanghai
networks:
kykms_network:
kykms-comm:
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms:comm
container_name: kykms-comm
environment:
- TZ=Asia/Shanghai
- LANG=en_US.UTF-8
depends_on:
- kykms-mysql-comm
- kykms-redis-comm
- kykms-ES-comm
ports:
- "8080:8080"
networks:
kykms_network:
restart: always
command: java -jar ./jeecg-boot-module-system-2.4.5.jar ./catalina.out 2>&1 &
kykms-nginx-comm:
image: registry.cn-guangzhou.aliyuncs.com/kyxxjs/kykms-nginx:comm
depends_on:
- kykms-comm
container_name: kykms-nginx-comm
ports:
- "80:80"
volumes:
- ./docker/nginx/conf.d/:/etc/nginx/conf.d/
- ./docker/nginx/log:/var/log/nginx
networks:
kykms_network:
restart: always
networks:
kykms_network:
external: true

@ -0,0 +1,19 @@
#!/bin/bash
# shellcheck disable=SC2046
BASE_PATH=$(cd `dirname $0`;pwd)
echo "当前系统版本:";sudo cat /etc/redhat-release;
echo -e "\033[46;37;5m -------------- 开始安装docker所需环境 -------------- \033[0m";
# 安装docker环境
echo " ------------ 开始安装docker服务 ------------ ";
yum update -y;
yum install -y yum-utils device-mapper-persistent-data lvm2;
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo;
yum install -y docker-ce;
systemctl start docker;
systemctl enable docker;
docker version;
sudo curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose;
sudo chmod +x /usr/local/bin/docker-compose;
docker-compose version;
echo " ------------ docker服务安装完毕 ------------ ";
sudo ./kms-init.sh

@ -0,0 +1,85 @@
# ======================== Elasticsearch Configuration =========================
#
# NOTE: Elasticsearch comes with reasonable defaults for most settings.
# Before you set out to tweak and tune the configuration, make sure you
# understand what are you trying to accomplish and the consequences.
#
# The primary way of configuring a node is via this file. This template lists
# the most important settings you may want to configure for a production cluster.
#
# Please consult the documentation for further information on configuration options:
# https://www.elastic.co/guide/en/elasticsearch/reference/index.html
#
# ---------------------------------- Cluster -----------------------------------
#
# Use a descriptive name for your cluster:
#
#cluster.name: my-application
#
# ------------------------------------ Node ------------------------------------
#
# Use a descriptive name for the node:
#
#node.name: node-1
#
# Add custom attributes to the node:
#
#node.attr.rack: r1
#
# ----------------------------------- Paths ------------------------------------
#
# Path to directory where to store the data (separate multiple locations by comma):
#
#path.data: /path/to/data
#
# Path to log files:
#
#path.logs: /path/to/logs
#
# ----------------------------------- Memory -----------------------------------
#
# Lock the memory on startup:
#
#bootstrap.memory_lock: true
#
# Make sure that the heap size is set to about half the memory available
# on the system and that the owner of the process is allowed to use this
# limit.
#
# Elasticsearch performs poorly when the system is swapping the memory.
#
# ---------------------------------- Network -----------------------------------
#
# By default Elasticsearch is only accessible on localhost. Set a different
# address here to expose this node on the network:
#
network.host: 0.0.0.0
#
# By default Elasticsearch listens for HTTP traffic on the first free port it
# finds starting at 9200. Set a specific HTTP port here:
#
#http.port: 9200
#
# For more information, consult the network module documentation.
#
# --------------------------------- Discovery ----------------------------------
#
# Pass an initial list of hosts to perform discovery when this node is started:
# The default list of hosts is ["127.0.0.1", "[::1]"]
#
#discovery.seed_hosts: ["host1", "host2"]
#
# Bootstrap the cluster using an initial set of master-eligible nodes:
#
#cluster.initial_master_nodes: ["node-1", "node-2"]
#
# For more information, consult the discovery and cluster formation module documentation.
#
# ---------------------------------- Various -----------------------------------
#
# Require explicit names when deleting indices:
#
#action.destructive_requires_name: true
xpack.security.enabled: false
discovery.type: single-node
indices.query.bool.max_clause_count: 102400

@ -0,0 +1,77 @@
## JVM configuration
################################################################
## IMPORTANT: JVM heap size
################################################################
##
## You should always set the min and max JVM heap
## size to the same value. For example, to set
## the heap to 4 GB, set:
##
## -Xms4g
## -Xmx4g
##
## See https://www.elastic.co/guide/en/elasticsearch/reference/current/heap-size.html
## for more information
##
################################################################
# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space
-Xms1g
-Xmx2g
################################################################
## Expert settings
################################################################
##
## All settings below this section are considered
## expert settings. Don't tamper with them unless
## you understand what you are doing
##
################################################################
## GC configuration
8-13:-XX:+UseConcMarkSweepGC
8-13:-XX:CMSInitiatingOccupancyFraction=75
8-13:-XX:+UseCMSInitiatingOccupancyOnly
## G1GC Configuration
# NOTE: G1 GC is only supported on JDK version 10 or later
# to use G1GC, uncomment the next two lines and update the version on the
# following three lines to your version of the JDK
# 10-13:-XX:-UseConcMarkSweepGC
# 10-13:-XX:-UseCMSInitiatingOccupancyOnly
14-:-XX:+UseG1GC
14-:-XX:G1ReservePercent=25
14-:-XX:InitiatingHeapOccupancyPercent=30
## JVM temporary directory
-Djava.io.tmpdir=${ES_TMPDIR}
## heap dumps
# generate a heap dump when an allocation from the Java heap fails
# heap dumps are created in the working directory of the JVM
-XX:+HeapDumpOnOutOfMemoryError
# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=data
# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=logs/hs_err_pid%p.log
## JDK 8 GC logging
8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:logs/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m
# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m

@ -0,0 +1,38 @@
# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2.0,
# as published by the Free Software Foundation.
#
# This program is also distributed with certain software (including
# but not limited to OpenSSL) that is licensed under separate terms,
# as designated in a particular file or component or in included license
# documentation. The authors of MySQL hereby grant you an additional
# permission to link the program and your derivative works with the
# separately licensed software that they have included with MySQL.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License, version 2.0, for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# The MySQL Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
#log-error = /var/log/mysql/error.log
# By default we only accept connections from localhost
#bind-address = 127.0.0.1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
sql_mode = STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

@ -0,0 +1,49 @@
server {
listen 80;
listen [::]:80;
server_name _;
client_max_body_size 2000M;
# gzip config
gzip on;
gzip_min_length 1k;
gzip_comp_level 9;
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;
gzip_vary on;
gzip_disable "MSIE [1-6]\.";
# root /usr/share/nginx/;
# Load configuration files for the default server block.
location / {
root /usr/share/nginx/kykms-root;
index index.html index.htm;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.html?s=$1 last;
break;
}
}
location /api/{
proxy_pass http://kykms-comm:8080/ky/;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 请求服务器升级协议为 WebSocket
#proxy_http_version 1.1;
#proxy_set_header Upgrade $http_upgrade;
#proxy_set_header Connection $connection_upgrade;
}
error_page 404 /404.html;
location = /404.html {
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}

File diff suppressed because it is too large Load Diff

@ -0,0 +1,2 @@
chmod 777 -R ./docker/elasticsearch
docker network create --driver=bridge kykms_network
Loading…
Cancel
Save