Merge branch 'master' into bugfix/missing-package

This commit is contained in:
Alexander Aleksandrovič Klimov 2021-05-26 16:51:53 +02:00 committed by GitHub
commit 1c00cf5d35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 68 additions and 2 deletions

19
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/entrypoint"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10
ignore:
- dependency-name: github.com/otiai10/copy
versions:
- 1.4.2
- 1.5.1
- package-ecosystem: docker
directory: "/"
schedule:
interval: daily
time: "10:00"
open-pull-requests-limit: 10

22
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,22 @@
name: Build
on:
push:
branches:
- master
pull_request: {}
jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Checkout HEAD
uses: actions/checkout@v1
- name: Icinga 2
run: git clone https://github.com/Icinga/icinga2.git
- name: Build
run: ./build.bash ./icinga2

View File

@ -65,6 +65,10 @@ To configure it, do one of the following:
on which configuration files there are.
* Provide environment variables as shown above.
To notify by e-mail, provide an [msmtp configuration] - either
by mounting the `/etc/msmtprc` file or by specifying the desired content
of `~icinga/.msmtprc` via the environment variable `MSMTPRC`.
### Environment variables
Most of the following variables correspond to
@ -107,7 +111,15 @@ git clone https://github.com/Icinga/icinga2.git
./build.bash ./icinga2
```
In order to run the script on macOS, [coreutils] must be installed:
* Install [Homebrew]
* Run `brew install coreutils`
[Icinga 2]: https://github.com/Icinga/icinga2
[Docker]: https://www.docker.com
[Icinga 2 configuration documentation]: https://icinga.com/docs/icinga2/latest/doc/04-configuration/
[msmtp configuration]: https://wiki.archlinux.org/index.php/Msmtp
[node setup command documentation]: https://icinga.com/docs/icinga2/latest/doc/06-distributed-monitoring/#node-setup
[Homebrew]: https://brew.sh/
[coreutils]: https://formulae.brew.sh/formula/coreutils

View File

@ -59,7 +59,7 @@ RUN cd /check_postgres ;\
FROM debian:buster-slim
RUN ["/bin/bash", "-exo", "pipefail", "-c", "export DEBIAN_FRONTEND=noninteractive; apt-get update; apt-get install --no-install-{recommends,suggests} -y dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 mailutils monitoring-plugins openssh-client openssl postfix libcap2-bin; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
RUN ["/bin/bash", "-exo", "pipefail", "-c", "apt-get update; DEBIAN_FRONTEND=noninteractive apt-get install --no-install-{recommends,suggests} -y ca-certificates curl dumb-init libboost-{context,coroutine,date-time,filesystem,program-options,regex,system,thread}1.67 libcap2-bin libedit2 libmariadb3 libmoosex-role-timer-perl libpq5 libssl1.1 mailutils monitoring-plugins msmtp{,-mta} openssh-client openssl; apt-get clean; rm -vrf /var/lib/apt/lists/*"]
COPY --from=entrypoint /entrypoint/entrypoint /entrypoint

View File

@ -3,6 +3,6 @@ module entrypoint
go 1.14
require (
github.com/otiai10/copy v1.4.0
github.com/otiai10/copy v1.5.1
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
)

View File

@ -4,6 +4,10 @@ github.com/otiai10/copy v1.3.0 h1:Z0OIFgj8hyI18YVzgPXpp652vv0NggCGWaNKSPN9KU8=
github.com/otiai10/copy v1.3.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E=
github.com/otiai10/copy v1.4.0 h1:S9XdWuTRJ54QDIrdbPEVl/1lMwF5xOjd5AvF9S866y8=
github.com/otiai10/copy v1.4.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E=
github.com/otiai10/copy v1.5.0 h1:SoXDGnlTUZoqB/wSuj/Y5L6T5i6iN4YRAcMCd+JnLNU=
github.com/otiai10/copy v1.5.0/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E=
github.com/otiai10/copy v1.5.1 h1:a/cs2E1/1V0az8K5nblbl+ymEa4E11AfaOLMar8V34w=
github.com/otiai10/copy v1.5.1/go.mod h1:XWfuS3CrI0R6IE0FbgHsEazaXO8G0LpMp9o8tos0x4E=
github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE=
github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI=
github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs=

View File

@ -19,6 +19,7 @@ import (
const ca = "/var/lib/icinga2/certs/ca.crt"
const crtMode = 0640
const mSmtpRc = "/var/lib/icinga2/.msmtprc"
func main() {
if err := entrypoint(); err != nil {
@ -122,6 +123,14 @@ func entrypoint() error {
}
}
if mSmtpCfg, ok := os.LookupEnv("MSMTPRC"); ok {
logf(info, "Writing %#v", mSmtpRc)
if errWF := ioutil.WriteFile(mSmtpRc, []byte(mSmtpCfg), 0644); errWF != nil {
return errWF
}
}
command = append([]string{"dumb-init", "-c", "--"}, command...)
}