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

feat: enforce env vars with run.sh to start promtail #103

Merged
merged 1 commit into from
Jan 30, 2025
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
7 changes: 5 additions & 2 deletions logging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ services:

promtail:
image: grafana/promtail:${PROMTAIL_VERSION:-2.8.2}
environment:
CHARON_LOKI_ADDRESSES: ${CHARON_LOKI_ADDRESSES}
command: -config.file=/etc/promtail/config.yml
volumes:
- ./promtail/config.yml:/etc/promtail/config.yml
- ./promtail:/etc/promtail
- /var/run/docker.sock:/var/run/docker.sock
networks: [dvnode]
entrypoint: /etc/promtail/run.sh
restart: unless-stopped

networks:
dvnode:
dvnode:
File renamed without changes.
13 changes: 13 additions & 0 deletions promtail/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

if [ -z "$CHARON_LOKI_ADDRESSES" ]; then
echo "Error: \$CHARON_LOKI_ADDRESSES variable is empty" >&2
exit 1
fi

sed "s|\$CHARON_LOKI_ADDRESSES|${CHARON_LOKI_ADDRESSES}|g" \
/etc/promtail/config.yml.example > /etc/promtail/config.yml

# Start Promtail with the generated config
/usr/bin/promtail \
-config.file=/etc/promtail/config.yml