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: add notification delay #67

Merged
merged 2 commits into from
Jun 25, 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
14 changes: 2 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.9-slim-buster as production-stage
FROM python:3.12-slim
WORKDIR /


Expand Down Expand Up @@ -59,21 +59,11 @@ RUN curl -fsSL https://nginx.org/keys/nginx_signing.key | apt-key add - && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

# hadolint ignore=DL3008
RUN curl -fsSL https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add - && \
echo "deb https://repo.mongodb.org/apt/debian buster/mongodb-org/4.2 main" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list && \
apt-get update && \
apt-get install -y --no-install-recommends \
mongodb-org-shell && \
apt-get -y clean && \
apt-get -y autoremove && \
rm -rf /var/lib/apt/lists/*

COPY requirements*.txt /app/

# hadolint ignore=DL3013
RUN pip install --no-cache-dir pip virtualenv jinja2 && \
python3 -m venv /venv && \
python3.12 -m venv /venv && \
/venv/bin/pip install --no-cache-dir --upgrade setuptools && \
/venv/bin/pip install --no-cache-dir --requirement /app/requirements.txt && \
/venv/bin/pip install --no-cache-dir --requirement /app/requirements-docker.txt
Expand Down
6 changes: 6 additions & 0 deletions config/templates/app/supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ autostart=true
autorestart=true
redirect_stderr=true

[program:delayNR]
command= bash -c "sleep 10 && alerta notfication_delay"
autostart=true
autorestart=true
redirect_stderr=true

{% if env.HEARTBEAT_SEVERITY -%}
[program:heartbeats]
command=sh -c "sleep 60 && alerta heartbeats --alert --severity {{ env.HEARTBEAT_SEVERITY }}"
Expand Down
5 changes: 2 additions & 3 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ if [ -n "${ADMIN_USERS}" ]; then
if [ $INIT_LOG = true ]; then echo "# Create admin users."; fi
if [ $INIT_LOG = true ]; then alertad user --all --password "${ADMIN_PASSWORD}" || true; else alertad user --all --password "${ADMIN_PASSWORD}" > /dev/null || true; fi
if [ $INIT_LOG = true ]; then echo "# Create admin API keys."; fi
if [ $INIT_LOG = true ]; then alertad key --all else alertad key --all > /dev/null; fi
if [ $INIT_LOG = true ]; then alertad key --all; else alertad key --all > /dev/null; fi

# Create user-defined API key, if required
if [ -n "${ADMIN_KEY}" ]; then
Expand All @@ -43,7 +43,7 @@ if [ ! -f "${ALERTA_CONF_FILE}" ]; then
# Add API key to client config, if required
if [ "${AUTH_REQUIRED,,}" == "true" ]; then
if [ $INIT_LOG = true ]; then echo "# Auth enabled; add admin API key to client configuration."; fi
HOUSEKEEPING_SCOPES="--scope read --scope write:alerts --scope admin:management"
HOUSEKEEPING_SCOPES="--scope read --scope write:alerts --scope admin:management --scope write:notification_rules"
if grep -qE 'CUSTOMER_VIEWS.*=.*True' ${ALERTA_SVR_CONF_FILE};then
HOUSEKEEPING_SCOPES="--scope admin:alerts ${HOUSEKEEPING_SCOPES}"
fi
Expand Down Expand Up @@ -91,7 +91,6 @@ if [ $INIT_LOG = true ]; then

nginx -v
echo uwsgi $(uwsgi --version)
mongo --version | grep MongoDB
psql --version
python3 --version
/venv/bin/pip list
Expand Down
2 changes: 1 addition & 1 deletion requirements-docker.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
lxml==5.2.1
pysaml2==7.2.1
python-ldap==3.4.4
uWSGI==2.0.21
uWSGI==2.0.26
Loading