docker-compose快速体验夜莺v3 (#316)

* fix regular dot

* add yarn.lock to .gitignore

* add docker-compose

* add docker-compose

* Delete PORTForm.tsx

* Delete .gitignore

* add .gitignore

* Update .gitignore
This commit is contained in:
yimeng 2020-09-29 08:05:38 +08:00 committed by GitHub
parent 472ed62c12
commit 1482cfcf32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 231 additions and 0 deletions

6
dockerfiles/README.md Normal file
View File

@ -0,0 +1,6 @@
# 快速体验夜莺v3
1. cd dockerfiles
2. docker-compose up
3. 修改hosts 加入 127.0.0.1 n9e.example.com
4. 浏览器访问 http://n9e.example.com
5. 用户名 root 密码 root.2020

View File

@ -0,0 +1,59 @@
version: '3.6'
services:
web:
build:
dockerfile: Dockerfile
context: nginx
container_name: nginx-n9e
hostname: nginx-n9e
ports:
- 80:80
restart: unless-stopped
links:
- n9e:n9e
mysql:
image: mysql:5
container_name: mysql
hostname: mysql
ports:
- 3306:3306
environment:
MYSQL_ROOT_PASSWORD: 1234
# volumes:
# - /usr/local/docker/mysql/data:/var/lib/mysql
redis:
image: redis
container_name: redis
hostname: redis
ports:
- 6379:6379
n9e:
build:
dockerfile: Dockerfile
context: n9e
container_name: n9e
hostname: n9e
ports:
- 8000:8000
- 8002:8002
- 8004:8004
- 8005:8005
- 8006:8006
- 8008:8008
- 8009:8009
- 8010:8010
- 8011:8011
- 8012:8012
- 8013:8013
- 8014:8014
- 8015:8015
- 2080:2080
links:
- mysql:mysql
- redis:redis
depends_on:
- mysql
- redis

View File

@ -0,0 +1,7 @@
FROM centos:7
WORKDIR /home/n9e
COPY entrpoint.sh .
ADD http://116.85.64.82/n9e-3.0.0.tar.gz .
RUN tar xvf n9e-3.0.0.tar.gz
RUN yum install mysql -y
ENTRYPOINT ./entrpoint.sh

14
dockerfiles/n9e/entrpoint.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
sed -i 's/127.0.0.1/mysql/g' etc/mysql.yml
sed -i 's/addr: 127.0.0.1:6379/addr: redis:6379/g' etc/rdb.yml
mysql -hmysql -uroot -p1234 < sql/n9e_ams.sql
mysql -hmysql -uroot -p1234 < sql/n9e_hbs.sql
mysql -hmysql -uroot -p1234 < sql/n9e_job.sql
mysql -hmysql -uroot -p1234 < sql/n9e_mon.sql
mysql -hmysql -uroot -p1234 < sql/n9e_rdb.sql
mysql -hmysql -uroot -p1234 < sql/n9e_rdb.sql
mysql -hmysql -uroot -p1234 < sql/n9e_rdb.sql
./control start all
sleep infinity

View File

@ -0,0 +1,6 @@
FROM nginx
WORKDIR /home/n9e
COPY nginx.sh .
COPY nginx.conf /etc/nginx
ADD http://116.85.64.82/pub.20200928.tar.gz .
RUN tar xvf pub.20200928.tar.gz

View File

@ -0,0 +1,139 @@
user root;
worker_processes auto;
worker_cpu_affinity auto;
worker_rlimit_nofile 204800;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
use epoll;
worker_connections 204800;
}
http {
log_format main '$server_addr $host $remote_addr [$time_local] $scheme "$request" '
'$status $upstream_status $body_bytes_sent $request_time $upstream_addr $upstream_response_time "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
proxy_connect_timeout 500ms;
proxy_send_timeout 1000ms;
proxy_read_timeout 3000ms;
proxy_buffers 64 8k;
proxy_busy_buffers_size 128k;
proxy_temp_file_write_size 64k;
proxy_redirect off;
proxy_next_upstream error invalid_header timeout http_502 http_504;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-Port $remote_port;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 100m;
client_body_buffer_size 512k;
client_body_timeout 180;
client_header_timeout 10;
send_timeout 240;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_comp_level 2;
gzip_types application/javascript application/x-javascript text/css text/javascript image/jpeg image/gif image/png;
gzip_vary off;
gzip_disable "MSIE [1-6]\.";
upstream n9e.rdb {
server n9e:8000;
keepalive 60;
}
upstream n9e.ams {
server n9e:8002;
keepalive 60;
}
upstream n9e.job {
server n9e:8004;
keepalive 60;
}
upstream n9e.monapi {
server n9e:8006;
keepalive 60;
}
upstream n9e.transfer {
server n9e:8008;
keepalive 60;
}
upstream n9e.index {
server n9e:8012;
keepalive 60;
}
server {
listen 80 default_server;
server_name n9e.example.com;
root /home/n9e/pub;
# Load configuration files for the default server block.
include /etc/nginx/default.d/*.conf;
location =/ {
rewrite / /mon;
}
location / {
try_files $uri /layout/index.html;
}
location ~ .*(.htm|.html|manifest.json)$ {
add_header Cache-Control "private, no-store, no-cache, must-revalidate, proxy-revalidate";
}
location /api/rdb {
proxy_pass http://n9e.rdb;
}
location /api/ams {
proxy_pass http://n9e.ams;
}
location /api/job {
proxy_pass http://n9e.job;
}
location /api/mon {
proxy_pass http://n9e.monapi;
}
location /api/index {
proxy_pass http://n9e.index;
}
location /api/transfer {
proxy_pass http://n9e.transfer;
}
}
}