Skip to content

Commit d229c76

Browse files
committed
more .gitignore work
added NFS support and cleaned up db-backup compose file updated upsd compose file
1 parent 38e3b0b commit d229c76

6 files changed

Lines changed: 106 additions & 13 deletions

File tree

apps/db-backup/docker-compose.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
services:
2-
db-backup:
3-
image: ghcr.io/romkey/hackstack-db-backup:${IMAGE_VERSION:-latest}
4-
container_name: db-backup
5-
hostname: db-backup
2+
dbbackup:
3+
image: ghcr.io/romkey/hackstack-db-backup:latest
4+
hostname: dbbackup
5+
container_name: dbbackup
66
restart: unless-stopped
77
volumes:
8-
- ${DBBACKUP_PARENT_HOST_PATH:-/opt}:/opt
9-
- ${DBBACKUP_DEST_PATH}:/dest
10-
env_file:
11-
- .env
8+
- /opt:/opt:ro
9+
- backup_nfs:/dest
1210
networks:
13-
- db
11+
- postgresql
1412
- mariadb
13+
env_file:
14+
- .env
15+
16+
volumes:
17+
backup_nfs:
18+
driver: local
19+
driver_opts:
20+
type: nfs
21+
o: addr=${NFS_SERVER},${NFS_OPTIONS:-nfsvers=4,soft,rw}
22+
device: ":${NFS_PATH}"
1523

1624
networks:
17-
db:
25+
postgresql:
1826
external: true
1927
name: postgres-net
2028
mariadb:

apps/upsd/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
config/entrypoint.sh
2+
config/ups.conf
3+
config/upsd.conf
4+
config/upsd.users
5+
config/upsmon.conf

apps/upsd/config/.gitkeep

Whitespace-only changes.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#! /bin/sh -e
2+
3+
if [ -d /run/secrets ] && [ -s /run/secrets/$SECRETNAME ]; then
4+
API_PASSWORD=$(cat /run/secrets/$SECRETNAME)
5+
fi
6+
7+
if [ ! -e /etc/nut/.setup ]; then
8+
if [ -e /etc/nut/local/ups.conf ]; then
9+
cp /etc/nut/local/ups.conf /etc/nut/ups.conf
10+
else
11+
if [ -z "$SERIAL" ] && [ $DRIVER = usbhid-ups ] ; then
12+
echo "** This container may not work without setting for SERIAL **"
13+
fi
14+
cat <<EOF >>/etc/nut/ups.conf
15+
[$NAME]
16+
driver = $DRIVER
17+
port = $PORT
18+
desc = "$DESCRIPTION"
19+
EOF
20+
if [ ! -z "$SERIAL" ]; then
21+
echo " serial = \"$SERIAL\"" >> /etc/nut/ups.conf
22+
fi
23+
if [ ! -z "$POLLINTERVAL" ]; then
24+
echo " pollinterval = $POLLINTERVAL" >> /etc/nut/ups.conf
25+
fi
26+
if [ ! -z "$VENDORID" ]; then
27+
echo " vendorid = $VENDORID" >> /etc/nut/ups.conf
28+
fi
29+
if [ ! -z "$SDORDER" ]; then
30+
echo " sdorder = $SDORDER" >> /etc/nut/ups.conf
31+
fi
32+
fi
33+
if [ "$MAXAGE" -ne 15 ]; then
34+
sed -i -e "s/^[# ]*MAXAGE [0-9]\+/MAXAGE $MAXAGE/" /etc/nut/upsd.conf
35+
fi
36+
if [ -e /etc/nut/local/upsd.conf ]; then
37+
cp /etc/nut/local/upsd.conf /etc/nut/upsd.conf
38+
else
39+
cat <<EOF >>/etc/nut/upsd.conf
40+
LISTEN 0.0.0.0
41+
EOF
42+
fi
43+
if [ -e /etc/nut/local/upsd.users ]; then
44+
cp /etc/nut/local/upsd.users /etc/nut/upsd.users
45+
else
46+
cat <<EOF >>/etc/nut/upsd.users
47+
[$API_USER]
48+
password = $API_PASSWORD
49+
upsmon $SERVER
50+
EOF
51+
fi
52+
if [ -e /etc/nut/local/upsmon.conf ]; then
53+
cp /etc/nut/local/upsmon.conf /etc/nut/upsmon.conf
54+
else
55+
cat <<EOF >>/etc/nut/upsmon.conf
56+
MONITOR $NAME@localhost 1 $API_USER $API_PASSWORD $SERVER
57+
RUN_AS_USER $USER
58+
EOF
59+
fi
60+
touch /etc/nut/.setup
61+
fi
62+
63+
chgrp $GROUP /etc/nut/*
64+
chmod 640 /etc/nut/*
65+
mkdir -p -m 2750 /dev/shm/nut
66+
chown $USER:$GROUP /dev/shm/nut
67+
[ -e /var/run/nut ] || ln -s /dev/shm/nut /var/run
68+
# Issue #15 - change pid warning message from "No such file" to "Ignoring"
69+
echo 0 > /var/run/nut/upsd.pid && chown $USER:$GROUP /var/run/nut/upsd.pid
70+
echo 0 > /var/run/upsmon.pid
71+
72+
echo "upsmon.conf"
73+
cat /etc/nut/upsmon.conf
74+
75+
/usr/sbin/upsdrvctl -u root start
76+
/usr/sbin/upsd -u $USER
77+
exec /usr/sbin/upsmon -D

apps/upsd/docker-compose.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
services:
22
upsd:
3-
image: gpdm/nut-upsd:${IMAGE_VERSION:-latest}
3+
image: instantlinux/nut-upsd
44
container_name: upsd
55
hostname: upsd
66
restart: unless-stopped
77
privileged: true
8+
entrypoint: /etc/nut/local/entrypoint.sh
89
devices:
9-
- "${UPS_DEVICE}:/dev/ups0:rw"
10+
# - "${UPS_DEVICE}:/dev/ups0:rw"
11+
- /dev/bus/usb:/dev/bus/usb
1012
volumes:
11-
- ./config:/etc/nut
13+
- ./config:/etc/nut/local
14+
# - /dev/bus/usb:/dev/bus/usb
1215
ports:
1316
- 3493:3493
1417
env_file:

0 commit comments

Comments
 (0)