add nginx & update monapi
This commit is contained in:
parent
be73d2810f
commit
087333808e
|
@ -1,6 +1,6 @@
|
||||||
FROM golang:alpine AS builder
|
FROM golang:alpine AS builder
|
||||||
RUN apk add --no-cache git
|
RUN apk add --no-cache git
|
||||||
WORKDIR /home/app
|
WORKDIR /app
|
||||||
|
|
||||||
# comment this if using vendor
|
# comment this if using vendor
|
||||||
# ENV GOPROXY=https://mod.gokit.info
|
# ENV GOPROXY=https://mod.gokit.info
|
||||||
|
@ -13,12 +13,12 @@ RUN go build -o ./bin/monapi src/modules/monapi/monapi.go
|
||||||
|
|
||||||
FROM alpine:3.10
|
FROM alpine:3.10
|
||||||
LABEL maintainer="llitfkitfk@gmail.com"
|
LABEL maintainer="llitfkitfk@gmail.com"
|
||||||
RUN apk add --no-cache ca-certificates
|
RUN apk add --no-cache tzdata ca-certificates
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=builder /home/app/etc /app/etc
|
COPY --from=builder /app/etc /app/etc
|
||||||
COPY --from=builder /home/app/bin /usr/local/bin
|
COPY --from=builder /app/bin /usr/local/bin
|
||||||
|
|
||||||
# ENTRYPOINT []
|
# ENTRYPOINT []
|
||||||
# CMD []
|
# CMD []
|
|
@ -18,6 +18,13 @@ git clone https://github.com/didi/nightingale.git
|
||||||
cd nightingale && ./control build
|
cd nightingale && ./control build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Quick Start (need install docker for [mac](https://docs.docker.com/docker-for-mac/install/)/[win](https://docs.docker.com/docker-for-windows/install/))
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker-compose up -d
|
||||||
|
# open http://localhost in web browser
|
||||||
|
```
|
||||||
|
|
||||||
## Team
|
## Team
|
||||||
|
|
||||||
[ulricqin](https://github.com/ulricqin) [710leo](https://github.com/710leo) [jsers](https://github.com/jsers) [hujter](https://github.com/hujter) [n4mine](https://github.com/n4mine) [heli567](https://github.com/heli567)
|
[ulricqin](https://github.com/ulricqin) [710leo](https://github.com/710leo) [jsers](https://github.com/jsers) [hujter](https://github.com/hujter) [n4mine](https://github.com/n4mine) [heli567](https://github.com/heli567)
|
||||||
|
|
|
@ -2,6 +2,14 @@ version: "3"
|
||||||
volumes:
|
volumes:
|
||||||
mysql-data:
|
mysql-data:
|
||||||
services:
|
services:
|
||||||
|
nginx:
|
||||||
|
image: nginx:stable-alpine
|
||||||
|
ports:
|
||||||
|
- 80:80
|
||||||
|
volumes:
|
||||||
|
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||||
|
- ./docker/nginx/conf.d:/etc/nginx/conf.d
|
||||||
|
- ./pub:/home/n9e/pub
|
||||||
api:
|
api:
|
||||||
build: .
|
build: .
|
||||||
image: api
|
image: api
|
||||||
|
@ -10,13 +18,18 @@ services:
|
||||||
image: api
|
image: api
|
||||||
restart: always
|
restart: always
|
||||||
command: monapi
|
command: monapi
|
||||||
|
volumes:
|
||||||
web:
|
- ./docker/etc:/app/etc
|
||||||
build:
|
|
||||||
context: web
|
|
||||||
restart: always
|
|
||||||
ports:
|
ports:
|
||||||
- 8010:8010
|
- 5800:5800
|
||||||
|
|
||||||
|
# web:
|
||||||
|
# build:
|
||||||
|
# context: web
|
||||||
|
# restart: always
|
||||||
|
# command: npm run dev
|
||||||
|
# ports:
|
||||||
|
# - 8010:8010
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis
|
image: redis
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
monapi:
|
||||||
|
http: 0.0.0.0:5800
|
||||||
|
addresses:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
|
transfer:
|
||||||
|
http: 0.0.0.0:5810
|
||||||
|
rpc: 0.0.0.0:5811
|
||||||
|
addresses:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
|
tsdb:
|
||||||
|
http: 0.0.0.0:5820
|
||||||
|
rpc: 0.0.0.0:5821
|
||||||
|
addresses:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
|
index:
|
||||||
|
http: 0.0.0.0:5830
|
||||||
|
rpc: 0.0.0.0:5831
|
||||||
|
addresses:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
|
judge:
|
||||||
|
http: 0.0.0.0:5840
|
||||||
|
rpc: 0.0.0.0:5841
|
||||||
|
addresses:
|
||||||
|
- 127.0.0.1
|
||||||
|
|
||||||
|
collector:
|
||||||
|
http: 0.0.0.0:2058
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
---
|
||||||
|
salt: "PLACE_SALT"
|
||||||
|
|
||||||
|
logger:
|
||||||
|
dir: "logs/monapi"
|
||||||
|
level: "WARNING"
|
||||||
|
keepHours: 24
|
||||||
|
|
||||||
|
http:
|
||||||
|
secret: "PLACE_SECRET"
|
||||||
|
|
||||||
|
# for ldap authorization
|
||||||
|
ldap:
|
||||||
|
host: "ldap.example.org"
|
||||||
|
port: 389
|
||||||
|
baseDn: "dc=example,dc=org"
|
||||||
|
bindUser: "cn=manager,dc=example,dc=org"
|
||||||
|
bindPass: "*******"
|
||||||
|
# openldap: (&(uid=%s))
|
||||||
|
# AD: (&(sAMAccountName=%s))
|
||||||
|
authFilter: "(&(uid=%s))"
|
||||||
|
tls: false
|
||||||
|
startTLS: false
|
||||||
|
|
||||||
|
# notify support: voice, sms, mail, im
|
||||||
|
# if we have all of notice channel
|
||||||
|
# notify:
|
||||||
|
# p1: ["voice", "sms", "mail", "im"]
|
||||||
|
# p2: ["sms", "mail", "im"]
|
||||||
|
# p3: ["mail", "im"]
|
||||||
|
|
||||||
|
# if we only have mail channel
|
||||||
|
notify:
|
||||||
|
p1: ["mail"]
|
||||||
|
p2: ["mail"]
|
||||||
|
p3: ["mail"]
|
||||||
|
|
||||||
|
# addresses accessible using browsers
|
||||||
|
link:
|
||||||
|
stra: http://n9e.example.com/#/monitor/strategy/%v
|
||||||
|
event: http://n9e.example.com/#/monitor/history/his/%v
|
||||||
|
claim: http://n9e.example.com/#/monitor/history/cur/%v
|
||||||
|
|
||||||
|
# for alarm event and message queue
|
||||||
|
redis:
|
||||||
|
addr: "redis:6379"
|
||||||
|
pass: ""
|
||||||
|
# in ms
|
||||||
|
# timeout:
|
||||||
|
# conn: 500
|
||||||
|
# read: 3000
|
||||||
|
# write: 3000
|
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
uic:
|
||||||
|
addr: "root:1234@tcp(mysql:3306)/n9e_uic?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
|
||||||
|
max: 16
|
||||||
|
idle: 4
|
||||||
|
debug: false
|
||||||
|
mon:
|
||||||
|
addr: "root:1234@tcp(mysql:3306)/n9e_mon?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
|
||||||
|
max: 16
|
||||||
|
idle: 4
|
||||||
|
debug: false
|
||||||
|
hbs:
|
||||||
|
addr: "root:1234@tcp(mysql:3306)/n9e_hbs?charset=utf8&parseTime=True&loc=Asia%2FShanghai"
|
||||||
|
max: 16
|
||||||
|
idle: 4
|
||||||
|
debug: false
|
|
@ -0,0 +1,89 @@
|
||||||
|
user root;
|
||||||
|
|
||||||
|
worker_processes auto;
|
||||||
|
worker_cpu_affinity auto;
|
||||||
|
|
||||||
|
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 '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
|
'$status $body_bytes_sent "$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;
|
||||||
|
|
||||||
|
upstream n9e.monapi {
|
||||||
|
server monapi:5800;
|
||||||
|
keepalive 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream n9e.index {
|
||||||
|
server 127.0.0.1:5830;
|
||||||
|
keepalive 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
upstream n9e.transfer {
|
||||||
|
server 127.0.0.1:5810;
|
||||||
|
keepalive 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 80 default_server;
|
||||||
|
server_name _;
|
||||||
|
root /usr/share/nginx/html;
|
||||||
|
|
||||||
|
# Load configuration files for the default server block.
|
||||||
|
include /etc/nginx/default.d/*.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
root /home/n9e/pub;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/portal {
|
||||||
|
proxy_pass http://n9e.monapi;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/index {
|
||||||
|
proxy_pass http://n9e.index;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /api/transfer {
|
||||||
|
proxy_pass http://n9e.transfer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,5 +1,7 @@
|
||||||
FROM node:lts-alpine AS builder
|
FROM node:lts-alpine AS builder
|
||||||
|
|
||||||
WORKDIR /home/app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
|
RUN npm install
|
Loading…
Reference in New Issue