Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚑️ Fix filebeat build #19

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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