Merge pull request #1 from didi/master

update
master
sole 5 years ago committed by GitHub
commit 0fd6176ac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,28 @@
FROM golang AS builder
# RUN apk add --no-cache git gcc
WORKDIR /app
# comment this if using vendor
# ENV GOPROXY=https://mod.gokit.info
# COPY go.mod go.sum ./
# RUN go mod download
COPY . .
ENV GOPROXY=https://mod.gokit.info
RUN ./control build docker
FROM buildpack-deps:buster-curl
LABEL maintainer="llitfkitfk@gmail.com"
WORKDIR /app
COPY --from=builder /app/docker/scripts /app/scripts
COPY --from=builder /app/etc /app/etc
# Change default address (hard code)
RUN ./scripts/sed.sh
COPY --from=builder /app/bin /usr/local/bin
# ENTRYPOINT []
# CMD []

@ -15,7 +15,17 @@ Nightingale user manual: [https://n9e.didiyun.com/](https://n9e.didiyun.com/)
mkdir -p $GOPATH/src/github.com/didi
cd $GOPATH/src/github.com/didi
git clone https://github.com/didi/nightingale.git
cd nightingale && ./control build
cd nightingale
# export env[GOPROXY] if your network is not good
# export GOPROXY=https://mirrors.aliyun.com/goproxy/
./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

@ -15,7 +15,10 @@ Nightingale是一套衍生自Open-Falcon的互联网监控解决方案融入
mkdir -p $GOPATH/src/github.com/didi
cd $GOPATH/src/github.com/didi
git clone https://github.com/didi/nightingale.git
cd nightingale && ./control build
cd nightingale
# 如果网络环境不好可以尝试aliyun的mirror
# export GOPROXY=https://mirrors.aliyun.com/goproxy/
./control build
```
## 团队

@ -139,8 +139,16 @@ build_one()
go build -o n9e-${mod} --tags "md5" src/modules/${mod}/${mod}.go
}
build_docker()
{
mod=$1
go build -o bin/n9e-${mod} --tags "md5" src/modules/${mod}/${mod}.go
}
build()
{
export GO111MODULE=on
mod=$1
if [ "x${mod}" = "x" ]; then
build_one monapi
@ -151,6 +159,16 @@ build()
build_one tsdb
return
fi
if [ "x${mod}" = "xdocker" ]; then
build_docker monapi
build_docker transfer
build_docker index
build_docker judge
build_docker collector
build_docker tsdb
return
fi
build_one $mod
}

@ -0,0 +1,88 @@
version: "3"
volumes:
mysql-data:
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:
build: .
image: api
monapi:
image: api
restart: always
command: n9e-monapi
ports:
- 5800:5800
transfer:
image: api
restart: always
command: n9e-transfer
ports:
- 5810:5810
- 5811:5811
tsdb:
image: api
restart: always
command: n9e-tsdb
ports:
- 5820:5820
- 5821:5821
index:
image: api
restart: always
command: n9e-index
ports:
- 5830:5830
- 5831:5831
judge:
image: api
restart: always
command: n9e-judge
ports:
- 5840:5840
- 5841:5841
collector:
image: api
restart: always
command: n9e-collector
ports:
- 2058:2058
# web:
# build:
# context: web
# restart: always
# command: npm run dev
# ports:
# - 8010:8010
redis:
image: redis
restart: always
ports:
- 6379:6379
mysql:
image: mysql:5.7
restart: always
environment:
- MYSQL_ROOT_PASSWORD=1234
ports:
- 3306:3306
volumes:
- ./sql:/docker-entrypoint-initdb.d
- mysql-data:/var/lib/mysql

@ -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 index:5830;
keepalive 10;
}
upstream n9e.transfer {
server transfer: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/conf.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;
}
}
}

@ -0,0 +1,8 @@
#!/bin/bash
set -xe
sed -i 's/127.0.0.1:6379/redis:6379/g' /app/etc/judge.yml
sed -i 's/127.0.0.1:6379/redis:6379/g' /app/etc/monapi.yml
sed -i 's/127.0.0.1:3306/mysql:3306/g' /app/etc/mysql.yml
sed -i 's/127.0.0.1:5821/tsdb:5821/g' /app/etc/transfer.yml

@ -1,11 +1,10 @@
# use shell if specify is blank
logger:
dir: logs/collector
level: WARNING
keepHours: 2
identity:
specify: ""
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
shell: ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1
sys:
# timeout in ms
# interval in second
@ -28,4 +27,4 @@ sys:
- cpu.core.irq
- cpu.core.softirq
- cpu.core.iowait
- cpu.core.steal
- cpu.core.steal

@ -4,4 +4,4 @@ logger:
keepHours: 2
identity:
specify: ""
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
shell: ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1

@ -6,6 +6,7 @@ query:
redis:
addrs:
- 127.0.0.1:6379
db: 0
pass: ""
# timeout:
# conn: 500
@ -14,9 +15,9 @@ redis:
identity:
specify: ""
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
shell: ifconfig `route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|awk -F ':' '{print $NF}'|head -n 1
logger:
dir: logs/judge
level: WARNING
keepHours: 2
keepHours: 2

@ -14,11 +14,19 @@ ldap:
host: "ldap.example.org"
port: 389
baseDn: "dc=example,dc=org"
# AD: manange@example.org
bindUser: "cn=manager,dc=example,dc=org"
bindPass: "*******"
# openldap: (&(uid=%s))
# AD: (&(sAMAccountName=%s))
authFilter: "(&(uid=%s))"
attributes:
dispname: "cn"
email: "mail"
phone: "mobile"
im: ""
coverAttributes: false
autoRegist: false
tls: false
startTLS: false
@ -44,6 +52,7 @@ link:
# for alarm event and message queue
redis:
addr: "127.0.0.1:6379"
db: 0
pass: ""
# in ms
# timeout:

@ -1,4 +1,4 @@
user nginx;
user root;
worker_processes auto;
worker_cpu_affinity auto;

@ -0,0 +1 @@
n9e-collector

@ -0,0 +1 @@
n9e-monapi

@ -0,0 +1 @@
n9e-transfer

@ -0,0 +1 @@
n9e-tsdb

@ -0,0 +1 @@
n9e-index

@ -0,0 +1 @@
n9e-judge

@ -1 +0,0 @@
{"version":3,"file":"index-3eb7c9ca4d88e3ad5c58.js","sources":["webpack:///index-3eb7c9ca4d88e3ad5c58.js"],"mappings":"AAAA;;;;;;;AAmsYA","sourceRoot":""}

File diff suppressed because one or more lines are too long

@ -0,0 +1 @@
{"version":3,"file":"index-5c8cbf958683e20086f5.js","sources":["webpack:///index-5c8cbf958683e20086f5.js"],"mappings":"AAAA;;;;;;;AAmsYA","sourceRoot":""}

@ -1 +1 @@
<!doctype html><html><head><meta charset="UTF-8"><title>Nightingale</title><link rel="shortcut icon" href="/favicon.ico"><link href="/index-3eb7c9ca4d88e3ad5c58.css" rel="stylesheet"></head><body><div id="react-content"></div><script src="/lib-033bee8514de110e36ef.dll.js"></script><script src="/index-3eb7c9ca4d88e3ad5c58.js"></script></body></html>
<!doctype html><html><head><meta charset="UTF-8"><title>Nightingale</title><link rel="shortcut icon" href="/favicon.ico"><link href="/index-5c8cbf958683e20086f5.css" rel="stylesheet"></head><body><div id="react-content"></div><script src="/lib-033bee8514de110e36ef.dll.js"></script><script src="/index-5c8cbf958683e20086f5.js"></script></body></html>

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save