fix(Makefile): add install target
This commit is contained in:
parent
003f740c2d
commit
099694c636
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@ -0,0 +1,15 @@
|
||||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = false
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
19
Makefile
19
Makefile
@ -1,3 +1,7 @@
|
||||
DESTDIR?=
|
||||
PREFIX?=/usr/local
|
||||
EXECUTABLE?=fail2ban_exporter
|
||||
|
||||
# List make commands
|
||||
.PHONY: ls
|
||||
ls:
|
||||
@ -47,10 +51,21 @@ build:
|
||||
-X main.builtBy=manual \
|
||||
" \
|
||||
-trimpath \
|
||||
-o fail2ban_exporter \
|
||||
-o ${EXECUTABLE} \
|
||||
exporter.go
|
||||
|
||||
# Build project docker container
|
||||
.PHONY: build/docker
|
||||
build/docker: build
|
||||
docker build -t fail2ban-prometheus-exporter .
|
||||
docker build -t ${EXECUTABLE} .
|
||||
|
||||
.PHONY: install
|
||||
install: build
|
||||
install -D --mode 0644 systemd/systemd.service ${DESTDIR}/usr/lib/systemd/system/${EXECUTABLE}.service
|
||||
|
||||
install -D --mode 0755 --target-directory ${DESTDIR}${PREFIX}/bin/${EXECUTABLE} ${EXECUTABLE}
|
||||
|
||||
# NOTE: Set restrict file permissions by default to protect optional basic auth credentials
|
||||
install -D --mode 0600 --target-directory ${DESTDIR}/etc/conf.d ${EXECUTABLE}
|
||||
|
||||
install -D --mode 0755 --target-directory ${DESTDIR}${PREFIX}/share/licenses/LICENSE LICENSE
|
6
prometheus-fail2ban-exporter
Normal file
6
prometheus-fail2ban-exporter
Normal file
@ -0,0 +1,6 @@
|
||||
# F2B_COLLECTOR_SOCKET=""
|
||||
# F2B_COLLECTOR_TEXT_PATH=""
|
||||
# F2B_WEB_LISTEN_ADDRESS=""
|
||||
# F2B_WEB_BASICAUTH_USER=""
|
||||
# F2B_WEB_BASICAUTH_PASS=""
|
||||
# F2B_EXIT_ON_SOCKET_CONN_ERROR=""
|
22
systemd/systemd.service
Normal file
22
systemd/systemd.service
Normal file
@ -0,0 +1,22 @@
|
||||
[Unit]
|
||||
Description=Prometheus exporter for fail2ban metrics
|
||||
Requires=network-online.target
|
||||
After=network-online.target
|
||||
|
||||
[Service]
|
||||
EnvironmentFile=/etc/conf.d/prometheus-fail2ban-exporter
|
||||
ExecStart=/usr/bin/prometheus-fail2ban-exporter
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
RestartSec=5s
|
||||
|
||||
NoNewPrivileges=true
|
||||
|
||||
# NOTE: Would be great to create and use a dedicated user/group via
|
||||
# sysusers.conf to access the fail2ban socket, but currently it is no possible
|
||||
# without manual configuration of the fail2ban daemon.
|
||||
User=root
|
||||
Group=root
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
x
Reference in New Issue
Block a user