Skip to content

Commit

Permalink
🔀 Merge pull request #19 from likesistemas/hotfix/fix-filebeat-build
Browse files Browse the repository at this point in the history
🚑️ Fix filebeat build
  • Loading branch information
ricardoapaes authored May 8, 2024
2 parents 0e338d7 + 2476564 commit b5e3191
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions Dockerfile.filebeat
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
RUN chmod +x /docker-entrypoint.d/100-start-filebeat.sh
RUN chmod go-w /etc/filebeat/filebeat.yml
8 changes: 6 additions & 2 deletions filebeat/start.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -8,5 +13,4 @@ if [ "${FILEBEAT_SETUP}" = "true" ]; then
filebeat setup
fi

service filebeat start
start
service filebeat start
2 changes: 1 addition & 1 deletion sh/98-configure-nginx.sh
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit b5e3191

Please sign in to comment.