forked from open-falcon/falcon-plus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
292 additions
and
1,008 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
FROM golang:1.10-alpine3.7 | ||
LABEL maintainer [email protected] | ||
USER root | ||
|
||
ENV FALCON_DIR=/open-falcon | ||
ENV PROJ_PATH=${GOPATH}/src/github.com/open-falcon/falcon-plus | ||
|
||
RUN mkdir -p $FALCON_DIR && \ | ||
apk add --no-cache ca-certificates bash git g++ perl make supervisor | ||
COPY . ${PROJ_PATH} | ||
|
||
WORKDIR ${PROJ_PATH} | ||
RUN make all \ | ||
&& make pack4docker \ | ||
&& tar -zxf open-falcon-v*.tar.gz -C ${FALCON_DIR} \ | ||
&& rm -rf ${PROJ_PATH} | ||
ADD docker/supervisord.conf /etc/supervisord.conf | ||
RUN mkdir -p $FALCON_DIR/logs | ||
|
||
EXPOSE 8433 8080 | ||
WORKDIR ${FALCON_DIR} | ||
|
||
# Start | ||
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,106 @@ | ||
## Running falcon-plus container | ||
## Running open-falcon container | ||
|
||
docker pull openfalcon/falcon-plus:0.2.0 | ||
docker run -itd -p 8081:8081 openfalcon/falcon-plus:0.2.0 bash /run.sh hbs | ||
`the latest version in docker hub is v0.2.1` | ||
|
||
## Running falcon-plus container with docker-compose | ||
##### 1. Start mysql and init the mysql table before the first running | ||
``` | ||
## start mysql in container | ||
docker run -itd \ | ||
--name falcon-mysql \ | ||
-v /home/work/mysql-data:/var/lib/mysql \ | ||
-e MYSQL_ROOT_PASSWORD=test123456 \ | ||
-p 3306:3306 \ | ||
mysql:5.7 | ||
docker-compose -f init.yml up -d falcon-plus | ||
## init mysql table before the first running | ||
cd /tmp && \ | ||
git clone https://github.com/open-falcon/falcon-plus && \ | ||
cd /tmp/falcon-plus/ && \ | ||
for x in `ls ./scripts/mysql/db_schema/*.sql`; do | ||
echo init mysql table $x ...; | ||
docker exec -i falcon-mysql mysql -uroot -ptest123456 < $x; | ||
done | ||
## Running mysql and redis container | ||
rm -rf /tmp/falcon-plus/ | ||
``` | ||
|
||
docker-compose -f init.yml up -d mysql redis | ||
##### 2. Start redis in container | ||
``` | ||
docker run --name falcon-redis -p6379:6379 -d redis:4-alpine3.8 | ||
``` | ||
|
||
## Stop and Remove containers | ||
##### 3. Start falcon-plus modules in one container | ||
|
||
``` | ||
## pull images from hub.docker.com/openfalcon | ||
docker pull openfalcon/falcon-plus:v0.2.1 | ||
## run falcon-plus container | ||
docker run -itd --name falcon-plus \ | ||
--link=falcon-mysql:db.falcon \ | ||
--link=falcon-redis:redis.falcon \ | ||
-p 8433:8433 \ | ||
-p 8080:8080 \ | ||
-e MYSQL_PORT=root:test123456@tcp\(db.falcon:3306\) \ | ||
-e REDIS_PORT=redis.falcon:6379 \ | ||
-v /home/work/open-falcon/data:/open-falcon/data \ | ||
-v /home/work/open-falcon/logs:/open-falcon/logs \ | ||
openfalcon/falcon-plus:v0.2.1 | ||
## start falcon backend modules, such as graph,api,etc. | ||
docker exec falcon-plus sh ctrl.sh start \ | ||
graph hbs judge transfer nodata aggregator agent gateway api alarm | ||
## or you can just start/stop/restart specific module as: | ||
docker exec falcon-plus sh ctrl.sh start/stop/restart xxx | ||
## check status of backend modules | ||
docker exec falcon-plus ./open-falcon check | ||
## or you can check logs at /home/work/open-falcon/logs/ in your host | ||
ls -l /home/work/open-falcon/logs/ | ||
``` | ||
|
||
##### 4. Start falcon-dashboard in container | ||
``` | ||
docker run -itd --name falcon-dashboard \ | ||
-p 8081:8081 \ | ||
--link=falcon-mysql:db.falcon \ | ||
--link=falcon-plus:api.falcon \ | ||
-e API_ADDR=http://api.falcon:8080/api/v1 \ | ||
-e PORTAL_DB_HOST=db.falcon \ | ||
-e PORTAL_DB_PORT=3306 \ | ||
-e PORTAL_DB_USER=root \ | ||
-e PORTAL_DB_PASS=test123456 \ | ||
-e PORTAL_DB_NAME=falcon_portal \ | ||
-e ALARM_DB_HOST=db.falcon \ | ||
-e ALARM_DB_PORT=3306 \ | ||
-e ALARM_DB_USER=root \ | ||
-e ALARM_DB_PASS=test123456 \ | ||
-e ALARM_DB_NAME=alarms \ | ||
-w /open-falcon/dashboard falcon-dashboard:v0.2.1 \ | ||
'./control startfg' | ||
``` | ||
|
||
---- | ||
|
||
## Building open-falcon images from source code | ||
|
||
##### Building falcon-plus | ||
|
||
``` | ||
cd /tmp && \ | ||
git clone https://github.com/open-falcon/falcon-plus && \ | ||
cd /tmp/falcon-plus/ && \ | ||
docker build -t falcon-plus:v0.2.1 . | ||
``` | ||
|
||
##### Building falcon-dashboard | ||
``` | ||
cd /tmp && \ | ||
git clone https://github.com/open-falcon/dashboard && \ | ||
cd /tmp/dashboard/ && \ | ||
docker build -t falcon-dashboard:v0.2.1 . | ||
``` | ||
|
||
docker-compose -f init.yml rm -f |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
confs=( | ||
'%%AGENT_HTTP%%=0.0.0.0:1988' | ||
'%%AGGREGATOR_HTTP%%=0.0.0.0:6055' | ||
'%%GRAPH_HTTP%%=0.0.0.0:6071' | ||
'%%GRAPH_RPC%%=0.0.0.0:6070' | ||
'%%HBS_HTTP%%=0.0.0.0:6031' | ||
'%%HBS_RPC%%=0.0.0.0:6030' | ||
'%%JUDGE_HTTP%%=0.0.0.0:6081' | ||
'%%JUDGE_RPC%%=0.0.0.0:6080' | ||
'%%NODATA_HTTP%%=0.0.0.0:6090' | ||
'%%TRANSFER_HTTP%%=0.0.0.0:6060' | ||
'%%TRANSFER_RPC%%=0.0.0.0:8433' | ||
'%%PLUS_API_DEFAULT_TOKEN%%=default-token-used-in-server-side' | ||
'%%PLUS_API_HTTP%%=0.0.0.0:8080' | ||
) | ||
|
||
configurer() { | ||
for i in "${confs[@]}" | ||
do | ||
search="${i%%=*}" | ||
replace="${i##*=}" | ||
|
||
uname=`uname` | ||
if [ "$uname" == "Darwin" ] ; then | ||
# Note the "" and -e after -i, needed in OS X | ||
find ./out/*/config/*.json -type f -exec sed -i .tpl -e "s/${search}/${replace}/g" {} \; | ||
else | ||
find ./out/*/config/*.json -type f -exec sed -i "s/${search}/${replace}/g" {} \; | ||
fi | ||
done | ||
} | ||
configurer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
DOCKER_DIR=/open-falcon | ||
of_bin=$DOCKER_DIR/open-falcon | ||
DOCKER_HOST_IP=$(route -n | awk '/UG[ \t]/{print $2}') | ||
|
||
if [ -z $MYSQL_PORT ]; then | ||
MYSQL_PORT=$DOCKER_HOST_IP:3306 | ||
fi | ||
find $DOCKER_DIR/*/config/*.json -type f -exec sed -i "s/%%MYSQL%%/$MYSQL_PORT/g" {} \; | ||
|
||
|
||
if [ -z $REDIS_PORT ]; then | ||
REDIS_PORT=$DOCKER_HOST_IP:6379 | ||
fi | ||
find $DOCKER_DIR/*/config/*.json -type f -exec sed -i "s/%%REDIS%%/$REDIS_PORT/g" {} \; | ||
|
||
supervisorctl $* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.