Skip to content

Commit 0845c10

Browse files
authored
feat: ability to disable internal tugtainer-agent (#83)
+ added env var AGENT_ENABLED that can be used to disable internal tugtainer-agent in main image + added entrypoint script Closes #45
1 parent fbab42a commit 0845c10

4 files changed

Lines changed: 16 additions & 1 deletion

File tree

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
# Possible values: critical, error, warning, info, debug, trace.
77
# Default is warning
88
LOG_LEVEL=
9+
# This variable can be used to disable internal tugtainer-agent,
10+
# for instance, if you cannot use docker.sock on this host, but want to monitor other remote hosts
11+
# Default is true (agent enabled)
12+
AGENT_ENABLED=
913
# Secret for backend-agent requests signature.
1014
# Better to set it if agent is on the other network.
1115
# Default is empty, because agent is used internally in the main image.

Dockerfile.app

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ ENV PATH="/app/.venv/bin:$PATH"
4242
COPY nginx.conf /etc/nginx/nginx.conf
4343
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
4444

45+
# Entrypoint script
46+
COPY entrypoint.sh /app/entrypoint.sh
47+
RUN chmod +x /app/entrypoint.sh
48+
4549
# Environment
4650
COPY .env* /app/
4751
RUN echo "$VERSION" > /app/version
@@ -54,4 +58,4 @@ EXPOSE 80
5458
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
5559
CMD curl -f http://localhost:8000/api/public/health || exit 1
5660

57-
ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
61+
ENTRYPOINT ["/app/entrypoint.sh"]

entrypoint.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
AGENT_ENABLED="${AGENT_ENABLED:-true}"
4+
AGENT_ENABLED=$(echo "$AGENT_ENABLED" | tr '[:upper:]' '[:lower:]')
5+
export AGENT_ENABLED
6+
exec /usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf

supervisord.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ priority=10
1212
[program:agent]
1313
command=python -m agent.start
1414
directory=/app
15+
autostart=%(ENV_AGENT_ENABLED)s
1516
autorestart=true
1617
priority=20
1718
stdout_logfile=/dev/stdout

0 commit comments

Comments
 (0)