remove duplicate etc config yml && add sed scripts

This commit is contained in:
llitfkitfk 2020-03-24 22:30:37 +08:00
parent 8709136ec1
commit 3d13c44ae1
12 changed files with 31 additions and 195 deletions

View File

@ -9,14 +9,18 @@ WORKDIR /app
COPY . .
ENV GOPROXY=https://mod.gokit.info
RUN ./control build
RUN ./control build docker
FROM buildpack-deps:buster-curl
LABEL maintainer="llitfkitfk@gmail.com"
WORKDIR /app
COPY --from=builder /app/docker/etc /app/etc
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

18
control
View File

@ -134,6 +134,12 @@ status()
}
build_one()
{
mod=$1
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
@ -141,7 +147,7 @@ build_one()
build()
{
export GO111MODULE=on
export GO111MODULE=on
mod=$1
if [ "x${mod}" = "x" ]; then
@ -154,6 +160,16 @@ build()
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
}

View File

@ -18,8 +18,6 @@ services:
image: api
restart: always
command: n9e-monapi
volumes:
- ./docker/etc:/app/etc
ports:
- 5800:5800
@ -27,8 +25,6 @@ services:
image: api
restart: always
command: n9e-transfer
volumes:
- ./docker/etc:/app/etc
ports:
- 5810:5810
- 5811:5811
@ -37,8 +33,6 @@ services:
image: api
restart: always
command: n9e-tsdb
volumes:
- ./docker/etc:/app/etc
ports:
- 5820:5820
- 5821:5821
@ -47,8 +41,6 @@ services:
image: api
restart: always
command: n9e-index
volumes:
- ./docker/etc:/app/etc
ports:
- 5830:5830
- 5831:5831
@ -57,8 +49,6 @@ services:
image: api
restart: always
command: n9e-judge
volumes:
- ./docker/etc:/app/etc
ports:
- 5840:5840
- 5841:5841
@ -67,8 +57,6 @@ services:
image: api
restart: always
command: n9e-collector
volumes:
- ./docker/etc:/app/etc
ports:
- 2058:2058

View File

@ -1,34 +0,0 @@
---
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

View File

@ -1,30 +0,0 @@
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
sys:
# timeout in ms
# interval in second
timeout: 1000
interval: 20
ifacePrefix:
- eth
- em
mountPoint: []
mountIgnorePrefix:
- /var/lib
ignoreMetrics:
- cpu.core.idle
- cpu.core.util
- cpu.core.sys
- cpu.core.user
- cpu.core.nice
- cpu.core.guest
- cpu.core.irq
- cpu.core.softirq
- cpu.core.iowait
- cpu.core.steal

View File

@ -1,7 +0,0 @@
logger:
dir: logs/index
level: WARNING
keepHours: 2
identity:
specify: ""
shell: /sbin/ifconfig `/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1

View File

@ -1,22 +0,0 @@
query:
connTimeout: 1000
callTimeout: 2000
indexCallTimeout: 2000
redis:
addrs:
- redis:6379
pass: ""
# timeout:
# conn: 500
# read: 3000
# write: 3000
identity:
specify: ""
shell: /usr/sbin/ifconfig `/usr/sbin/route|grep '^default'|awk '{print $NF}'`|grep inet|awk '{print $2}'|head -n 1
logger:
dir: logs/judge
level: WARNING
keepHours: 2

View File

@ -1,52 +0,0 @@
---
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

View File

@ -1,16 +0,0 @@
---
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

View File

@ -1,11 +0,0 @@
backend:
# in ms
# connTimeout: 1000
# callTimeout: 3000
cluster:
tsdb01: 127.0.0.1:5821
logger:
dir: logs/transfer
level: WARNING
keepHours: 2

View File

@ -1,8 +0,0 @@
rrd:
storage: data/5821
cache:
keepMinutes: 120
logger:
dir: logs/tsdb
level: WARNING
keepHours: 2

8
docker/scripts/sed.sh Executable file
View File

@ -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