Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增网络限流的shell脚本和常用的Docker安装命令 #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Docker安装脚本/MinIo/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
cur_dir=`pwd`

docker stop lamp_minio
docker rm lamp_minio
docker run -p 9000:9000 -p 9999:9999 --name lamp_minio --restart=always \
-e "MINIO_ROOT_USER=lamp" \
-e "MINIO_ROOT_PASSWORD=ZHadmin123." \
-v /Users/tangyh/data/minio_data:/data \
-v /Users/tangyh/data/minio_config:/root/.minio \
-d minio/minio server --address '0.0.0.0:9000' --console-address '0.0.0.0:9999' /data
13 changes: 13 additions & 0 deletions Docker安装脚本/mssql/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
cur_dir=`pwd`


docker stop mssql
docker rm mssql
sudo docker run --name mssql -e 'ACCEPT_EULA=Y' \
-e 'MSSQL_SA_PASSWORD=1234@abcd' \
-p 1433:1433 \
-v /opt/mssql/data:/var/opt/mssql/data \
-v /opt/mssql/log:/var/opt/mssql/log \
-v /opt/mssql/secrets:/var/opt/mssql/secrets \
mcr.microsoft.com/mssql/server:2019-latest
33 changes: 33 additions & 0 deletions Docker安装脚本/mysql8/conf/my.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[mysql]
default-character-set=utf8mb4

[mysqld]
federated
default-storage-engine=INNODB
character_set_server=utf8mb4
collation-server = utf8mb4_general_ci

datadir = /var/lib/mysql
port = 3306
socket = /var/run/mysqld/mysqld.sock
lower_case_table_names=1
ft_min_word_len=1
# SQL数据包发送的大小,如果有BLOB对象建议修改成1G
max_allowed_packet=128M

innodb_buffer_pool_size=4G

innodb_data_file_path=ibdata1:1024M:autoextend:max:1G
innodb_temp_data_file_path=ibtmp1:12M:autoextend:max:1G
default_password_lifetime = 0

max_connections = 32000
max_user_connections=20000

# MySQL连接闲置超过一定时间后(单位:秒)将会被强行关闭
# MySQL默认的wait_timeout 值为8个小时, interactive_timeout参数需要同时配置才能生效
interactive_timeout = 1800
wait_timeout=1800
default_authentication_plugin=mysql_native_password

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
12 changes: 12 additions & 0 deletions Docker安装脚本/mysql8/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
cur_dir=`pwd`

docker stop lamp_mysql
docker rm lamp_mysql
docker run --name lamp_mysql --restart=always \
-v `pwd`/conf:/etc/mysql/conf.d \
-v /data/docker-data/mysql8-data/:/var/lib/mysql \
-p 3306:3306 \
-e MYSQL_ROOT_PASSWORD="root" \
-e TZ=Asia/Shanghai \
-d mysql:8.0.19
17 changes: 17 additions & 0 deletions Docker安装脚本/nacos/init.d/custom.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for prometheus
#management.endpoints.web.exposure.include=*
# metrics for elastic search
#management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for influx
#management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true
15 changes: 15 additions & 0 deletions Docker安装脚本/nacos/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

docker stop lamp_nacos
docker rm lamp_nacos
docker run -idt --name lamp_nacos --restart=always \
-e JVM_XMS=512m -e JVM_XMX=512m -e JVM_XMN=384m \
-e PREFER_HOST_MODE=hostname -e MODE=standalone -e SPRING_DATASOURCE_PLATFORM=mysql \
-e MYSQL_DATABASE_NUM=1 \
-e MYSQL_SERVICE_HOST=192.168.80.130 -e MYSQL_SERVICE_DB_NAME=lamp_nacos -e MYSQL_SERVICE_PORT=3306 \
-e MYSQL_SERVICE_USER=root \
-e MYSQL_SERVICE_PASSWORD=root \
-p 8848:8848 \
-v `pwd`/logs/:/home/nacos/logs \
-v `pwd`/init.d/custom.properties:/home/nacos/init.d/custom.properties \
nacos/nacos-server:v2.1.1
8 changes: 8 additions & 0 deletions Docker安装脚本/nginx/conf/conf.d/prod_80.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 80;
server_name tangyh.top;
underscores_in_headers on;

rewrite ^(.*)$ https://$host$1 permanent;
}

58 changes: 58 additions & 0 deletions Docker安装脚本/nginx/conf/conf.d/prod_ssl_443.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
server {
listen 443 ssl;

server_name tangyh.top;
root html;
index index.html index.htm;
ssl_certificate ../ssl/tangyh.top.crt;
ssl_certificate_key ../ssl/tangyh.top.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

underscores_in_headers on;

# 网关
location /api {
proxy_pass http://172.30.30.195:8760/api;

# https + web socket 配置
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host:$server_port;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_connect_timeout 60;
proxy_read_timeout 600;
proxy_send_timeout 600;
}

# 文件访问配置
location ^~ /file {
if ($request_uri ~* ^.*\/(.*)\.(apk|java|txt|doc|pdf|rar|gz|zip|docx|exe|xlsx|ppt|pptx|jpg|png)(\?fileName=([^&]+))$) {
add_header Content-Disposition "attachment;filename=$arg_attname";
}
root /data_prod/uploadfile;
index index.html;
}

# 前端
location /lamp-web {
root /data_prod/webapp/;
index index.html;
}

# 前端
location ^~ / {
# 不缓存html,防止程序更新后缓存继续生效
if ($request_filename ~* .*\.(?:htm|html)$) {
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
access_log on;
}
root /data_prod/webapp/lamp-web-plus;
index index.html index.htm;
}
}
27 changes: 27 additions & 0 deletions Docker安装脚本/nginx/conf/conf.d/static_ssl_443.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

upstream minio_server {
least_conn;
server 172.30.30.194:9000;
}

server {
listen 443 ssl;
server_name static.tangyh.top;
root html;
index index.html index.htm;
ssl_certificate ../ssl/static.tangyh.top.crt;
ssl_certificate_key ../ssl/static.tangyh.top.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;

underscores_in_headers on;

location / {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://minio_server;
}
}
25 changes: 25 additions & 0 deletions Docker安装脚本/nginx/conf/fastcgi_params
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;

fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;

fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;

fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
109 changes: 109 additions & 0 deletions Docker安装脚本/nginx/conf/koi-utf
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

# This map is not a full koi8-r <> utf8 map: it does not contain
# box-drawing and some other characters. Besides this map contains
# several koi8-u and Byelorussian letters which are not in koi8-r.
# If you need a full and standard map, use contrib/unicode2nginx/koi-utf
# map instead.

charset_map koi8-r utf-8 {

80 E282AC ; # euro

95 E280A2 ; # bullet

9A C2A0 ; # &nbsp;

9E C2B7 ; # &middot;

A3 D191 ; # small yo
A4 D194 ; # small Ukrainian ye

A6 D196 ; # small Ukrainian i
A7 D197 ; # small Ukrainian yi

AD D291 ; # small Ukrainian soft g
AE D19E ; # small Byelorussian short u

B0 C2B0 ; # &deg;

B3 D081 ; # capital YO
B4 D084 ; # capital Ukrainian YE

B6 D086 ; # capital Ukrainian I
B7 D087 ; # capital Ukrainian YI

B9 E28496 ; # numero sign

BD D290 ; # capital Ukrainian soft G
BE D18E ; # capital Byelorussian short U

BF C2A9 ; # (C)

C0 D18E ; # small yu
C1 D0B0 ; # small a
C2 D0B1 ; # small b
C3 D186 ; # small ts
C4 D0B4 ; # small d
C5 D0B5 ; # small ye
C6 D184 ; # small f
C7 D0B3 ; # small g
C8 D185 ; # small kh
C9 D0B8 ; # small i
CA D0B9 ; # small j
CB D0BA ; # small k
CC D0BB ; # small l
CD D0BC ; # small m
CE D0BD ; # small n
CF D0BE ; # small o

D0 D0BF ; # small p
D1 D18F ; # small ya
D2 D180 ; # small r
D3 D181 ; # small s
D4 D182 ; # small t
D5 D183 ; # small u
D6 D0B6 ; # small zh
D7 D0B2 ; # small v
D8 D18C ; # small soft sign
D9 D18B ; # small y
DA D0B7 ; # small z
DB D188 ; # small sh
DC D18D ; # small e
DD D189 ; # small shch
DE D187 ; # small ch
DF D18A ; # small hard sign

E0 D0AE ; # capital YU
E1 D090 ; # capital A
E2 D091 ; # capital B
E3 D0A6 ; # capital TS
E4 D094 ; # capital D
E5 D095 ; # capital YE
E6 D0A4 ; # capital F
E7 D093 ; # capital G
E8 D0A5 ; # capital KH
E9 D098 ; # capital I
EA D099 ; # capital J
EB D09A ; # capital K
EC D09B ; # capital L
ED D09C ; # capital M
EE D09D ; # capital N
EF D09E ; # capital O

F0 D09F ; # capital P
F1 D0AF ; # capital YA
F2 D0A0 ; # capital R
F3 D0A1 ; # capital S
F4 D0A2 ; # capital T
F5 D0A3 ; # capital U
F6 D096 ; # capital ZH
F7 D092 ; # capital V
F8 D0AC ; # capital soft sign
F9 D0AB ; # capital Y
FA D097 ; # capital Z
FB D0A8 ; # capital SH
FC D0AD ; # capital E
FD D0A9 ; # capital SHCH
FE D0A7 ; # capital CH
FF D0AA ; # capital hard sign
}
Loading