Skip to content

Commit

Permalink
Add fluentbit wait on server availability
Browse files Browse the repository at this point in the history
  • Loading branch information
noboruma committed Nov 30, 2023
1 parent 0ea926a commit d810ed6
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions deepfence_agent/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ COPY plugins/compliance/scripts /usr/local/bin/compliance_check/scripts
COPY plugins/compliance/config.json /usr/local/bin/compliance_check/config.json
COPY supervisord.conf /home/deepfence/supervisord.conf
COPY run_discovery.sh /home/deepfence/
COPY plugins/etc/run_fluentbit.sh /home/deepfence/
COPY create_cgroups.sh /home/deepfence/create-cgroups.sh
RUN mkdir -p /home/deepfence/bin && mkdir -p /home/deepfence/bin/secret-scanner && mkdir -p /home/deepfence/bin/yara-hunter
COPY plugins/yara-rules /home/deepfence/bin/yara-hunter/yara-rules
Expand Down
2 changes: 1 addition & 1 deletion deepfence_agent/plugins/YaraHunter
10 changes: 10 additions & 0 deletions deepfence_agent/plugins/etc/run_fluentbit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
HEALTH_ENDPOINT=https://${MGMT_CONSOLE_URL}:${MGMT_CONSOLE_PORT}/deepfence/ping
echo "Wait for a pong on ${HEALTH_ENDPOINT}"

until $(curl -k --output /dev/null --silent --fail ${HEALTH_ENDPOINT}); do
echo '.'
sleep 5
done
echo 'Got a pong, executing fluentbit bin'

exec $DF_INSTALL_DIR/opt/td-agent-bit/bin/fluent-bit -c $DF_INSTALL_DIR/etc/td-agent-bit/fluentbit-agent.conf
2 changes: 1 addition & 1 deletion deepfence_agent/plugins/fluent-bit
2 changes: 1 addition & 1 deletion deepfence_bootstrapper/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ vendor: go.mod $(shell find ../deepfence_utils -path ../deepfence_utils/vendor -
go mod tidy -v
go mod vendor

deepfence_bootstrapper: vendor $(shell find . -path ./vendor -prune -o -name '*.go')
deepfence_bootstrapper: vendor $(shell find . -path ./vendor -prune -o -name '*.go') $(shell find ./assets/ -name '*.ini')
CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w -X main.Version=${VERSION} -extldflags=-static" -buildvcs=false
-upx ./deepfence_bootstrapper

Expand Down
2 changes: 1 addition & 1 deletion deepfence_bootstrapper/assets/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ maxcpu = 10
maxmem = 100000

[process:fluentbit]
command=/bin/bash -c "exec $DF_INSTALL_DIR/opt/td-agent-bit/bin/fluent-bit -c $DF_INSTALL_DIR/etc/td-agent-bit/fluentbit-agent.conf"
command=/home/deepfence/run_fluentbit.sh
path=$DF_INSTALL_DIR/opt/td-agent-bit/bin/fluent-bit
autostart=true
autorestart=true
Expand Down

0 comments on commit d810ed6

Please sign in to comment.