From 2476564290894c17c65e7b55fe2ed7d5898d16e1 Mon Sep 17 00:00:00 2001 From: Ricardo Paes Date: Wed, 8 May 2024 09:06:53 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=91=EF=B8=8F=20Fix=20filebeat=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-publish.yml | 10 ++++++++++ Dockerfile | 4 ++-- Dockerfile.filebeat | 7 +++---- filebeat/start.sh | 8 ++++++-- sh/98-configure-nginx.sh | 2 +- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index c7be1df..b2cd274 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -80,6 +80,16 @@ jobs: exit 1; fi + - name: Test Filebeat + run: | + CONTENT=$(curl -s "http://127.0.0.1:85/"); + echo "CHAMADA HTTP TRYFILES: ${CONTENT}"; + + if [ "${CONTENT}" != "tryfiles" ]; then + echo "Chamada HTTP TRYFILES retornou errado: ${CONTENT}" + exit 1; + fi + push: needs: test diff --git a/Dockerfile b/Dockerfile index db4aebd..82998b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,11 +17,11 @@ RUN apt-get update && apt-get install -y wget \ && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz ENV PUBLIC_HTML="/var/www/public" -ENV SRC_TEMPLATES="/etc/nginx-templetes/" +ENV SRC_CONFIG_TEMPLATES="/etc/nginx-templetes/" ENV SRC_CONFIG="/etc/nginx/" RUN rm -Rf /etc/nginx/conf.d/ -COPY config/ ${SRC_TEMPLATES} +COPY config/ ${SRC_CONFIG_TEMPLATES} COPY --from=htpasswd /fpm_passwd /etc/nginx/fpm_passwd COPY www/fpm_status.html /var/php/status.html diff --git a/Dockerfile.filebeat b/Dockerfile.filebeat index 5c06e2f..1bb8d66 100644 --- a/Dockerfile.filebeat +++ b/Dockerfile.filebeat @@ -12,9 +12,8 @@ RUN curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-${ dpkg -i filebeat-${FILEBEAT_VERSION}-amd64.deb COPY filebeat/config.yml /etc/filebeat/filebeat.yml -COPY filebeat/start.sh /usr/local/bin/start-filebeat +COPY filebeat/start.sh /docker-entrypoint.d/100-start-filebeat.sh COPY filebeat/logs.conf ${SRC_CONFIG_TEMPLATES}conf.d/logs.conf -RUN chmod +x /usr/local/bin/start-filebeat -RUN chmod go-w /etc/filebeat/filebeat.yml -ENTRYPOINT ["start-filebeat"] \ No newline at end of file +RUN chmod +x /docker-entrypoint.d/100-start-filebeat.sh +RUN chmod go-w /etc/filebeat/filebeat.yml \ No newline at end of file diff --git a/filebeat/start.sh b/filebeat/start.sh index ee1237e..8a24ffa 100644 --- a/filebeat/start.sh +++ b/filebeat/start.sh @@ -1,5 +1,10 @@ #!/bin/bash +if [ -z "${FILEBEAT_CLOUD_ID}" ] || [ -z "${FILEBEAT_CLOUD_AUTH}" ]; then + echo "FILEBEAT_CLOUD_ID ou FILEBEAT_CLOUD_AUTH não configurado. Abortando..." + exit 0 +fi + dockerize -template /etc/filebeat/filebeat.yml:/etc/filebeat/filebeat.yml filebeat modules enable nginx @@ -8,5 +13,4 @@ if [ "${FILEBEAT_SETUP}" = "true" ]; then filebeat setup fi -service filebeat start -start \ No newline at end of file +service filebeat start \ No newline at end of file diff --git a/sh/98-configure-nginx.sh b/sh/98-configure-nginx.sh index 55e8036..2b7436f 100644 --- a/sh/98-configure-nginx.sh +++ b/sh/98-configure-nginx.sh @@ -1,7 +1,7 @@ #!/bin/bash mkdir -p ${SRC_CONFIG} -cp -R ${SRC_TEMPLATES}/. ${SRC_CONFIG} +cp -R ${SRC_CONFIG_TEMPLATES}/. ${SRC_CONFIG} PASTA_NGINX_SITE=${SRC_CONFIG}/site.d; PASTA_NGINX_CONF=${SRC_CONFIG}/conf.d;