Merge branch 'antifascista' of https://gitea.nulo.in/Sutty/containers-monit into antifascista

This commit is contained in:
f 2022-04-02 11:24:59 -03:00
commit e003944711
5 changed files with 56 additions and 26 deletions

View file

@ -1,34 +1,32 @@
pipeline: pipeline:
publish: publish:
image: plugins/docker image: plugins/docker
registry: registry.nulo.in settings:
repo: registry.nulo.in/sutty/ruby registry: registry.nulo.in
tags: username: sutty
- ${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH} repo: registry.nulo.in/sutty/ruby
- latest tags:
build_args: - ${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}
- RUBY_VERSION=${RUBY_VERSION} - latest
- RUBY_PATCH=${RUBY_PATCH} build_args:
- ALPINE_VERSION=${ALPINE_VERSION} - RUBY_VERSION=${RUBY_VERSION}
- BASE_IMAGE=registry.nulo.in/sutty/monit - RUBY_PATCH=${RUBY_PATCH}
username: sutty - ALPINE_VERSION=${ALPINE_VERSION}
- BASE_IMAGE=registry.nulo.in/sutty/monit
purge: false
secrets: secrets:
- docker_password - docker_password
cache_from: registry.nulo.in/sutty/ruby:${ALPINE_VERSION}-${RUBY_VERSION}.${RUBY_PATCH}
when: when:
branch: antifascista branch: antifascista
event: push event: push
matrix: matrix:
include: include:
- ALPINE_VERSION: 3.13.6 - ALPINE_VERSION: 3.13.9
RUBY_VERSION: 2.7 RUBY_VERSION: 2.7
RUBY_PATCH: 5 RUBY_PATCH: 5
- ALPINE_VERSION: 3.13.7 - ALPINE_VERSION: 3.14.5
RUBY_VERSION: 2.7 RUBY_VERSION: 2.7
RUBY_PATCH: 5 RUBY_PATCH: 5
- ALPINE_VERSION: 3.14.3 - ALPINE_VERSION: 3.15.3
RUBY_VERSION: 2.7
RUBY_PATCH: 5
- ALPINE_VERSION: 3.15.0
RUBY_VERSION: 3.0 RUBY_VERSION: 3.0
RUBY_PATCH: 3 RUBY_PATCH: 3

View file

@ -1,10 +1,8 @@
ARG ALPINE_VERSION=3.13.6 ARG ALPINE_VERSION=3.13.6
ARG BASE_IMAGE=alpine ARG BASE_IMAGE=alpine
ARG EMAIL=monit@sutty.nl
FROM ${BASE_IMAGE}:${ALPINE_VERSION} as build FROM ${BASE_IMAGE}:${ALPINE_VERSION} as build
ARG RUBY_VERSION=2.7 ARG RUBY_VERSION=2.7
ARG RUBY_PATCH=5 ARG RUBY_PATCH=5
ENV EMAIL ${EMAIL:-monit@sutty.nl}
RUN apk add --no-cache ruby~${RUBY_VERSION}.${RUBY_PATCH} patch RUN apk add --no-cache ruby~${RUBY_VERSION}.${RUBY_PATCH} patch

11
monitrc
View file

@ -5,17 +5,16 @@ set pidfile /run/monit.pid
set idfile /var/lib/monit/id set idfile /var/lib/monit/id
set statefile /var/lib/monit/state set statefile /var/lib/monit/state
set eventqueue basedir /var/lib/monit/events slots 100 set eventqueue basedir /var/lib/monit/events slots 100
set mailserver postfix
set limits { programoutput: 1 MB } set limits { programoutput: 1 MB }
set alert @@EMAIL@@
set httpd port 2812
allow localhost
allow 172.0.0.0/8
check program nsupdate check program nsupdate
with path "/usr/local/bin/nsupdate" with path "/usr/local/bin/nsupdate"
every 1 cycle every 1 cycle
if status = 0 then unmonitor if status = 0 then unmonitor
check program zeroconf
with path "/usr/local/bin/zeroconf"
every 1 cycle
if status = 0 then unmonitor
include /etc/monit.d/*.conf include /etc/monit.d/*.conf

16
zeroconf.conf Normal file
View file

@ -0,0 +1,16 @@
set mmonit http://@@MMONIT@@/collector
set mailserver postfix port 25 using hostname @@HOSTNAME@@
set alert @@EMAIL@@
set mail-format {
from: Monit <@@EMAIL_FROM@@>
subject: $HOST
message: $ACTION $SERVICE -- $DATE: $DESCRIPTION.
}
set httpd port 2812
allow localhost
allow 172.0.0.0/8
allow "fd00:acab::/32"
allow @@CREDENTIALS@@

19
zeroconf.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
set -e
test ! -f /etc/monit.d/zeroconf.conf || exit 0
test -n "${EMAIL}"
test -n "${EMAIL_FROM}"
test -n "${MMONIT}"
test -n "${CREDENTIALS}"
sed -re "s/@@EMAIL@@/${EMAIL}/" \
-e "s/@@EMAIL_FROM@@/${EMAIL_FROM}/" \
-e "s/@@HOSTNAME@@/${EMAIL_FROM#*@}/" \
-e "s/@@MMONIT@@/${MMONIT}/" \
-e "s/@@CREDENTIALS@@/${CREDENTIALS}/" \
/etc/zeroconf.conf > /etc/monit.d/zeroconf.conf
monit -t
monit reload