Initial commit

This commit is contained in:
nemunaire 2023-03-15 18:13:31 +01:00
commit c30d65b16e
14 changed files with 301 additions and 0 deletions

View file

@ -0,0 +1,7 @@
#!/sbin/openrc-run
description="Maatma interface, API and more"
command="/usr/sbin/checker"
command_args="-dsn '{{ mysql_maatma.username }}:{{ mysql_maatma.password }}@tcp({{ mysql_endpoint.host }}:{{ mysql_endpoint.port}})/{{ mysql_maatma.database }}'"
start_stop_daemon_args="--background --quiet"
pidfile="/var/run/$SVCNAME.pid"

View file

@ -0,0 +1,6 @@
#!/sbin/openrc-run
description="Maatma interface, API and more"
command="/usr/sbin/clean-wg.sh"
start_stop_daemon_args="--background --quiet"
pidfile="/var/run/$SVCNAME.pid"

5
templates/networking.j2 Normal file
View file

@ -0,0 +1,5 @@
auto wg-adlin
iface wg-adlin inet static
requires eth0
use wireguard
address {{ maatma_network.gateway6 }}/{{ maatma_network.netmask6 }}

View file

@ -0,0 +1,7 @@
#!/sbin/openrc-run
description="Maatma interface, API and more"
command="/usr/sbin/token-validator"
command_args="-baseurl /maatma/ -dsn '{{ mysql_maatma.username }}:{{ mysql_maatma.password }}@tcp({{ mysql_endpoint.host }}:{{ mysql_endpoint.port}})/{{ mysql_maatma.database }}' -oidc-clientid {{ oidc.clientid }} -oidc-secret {{ oidc.client_secret }}"
start_stop_daemon_args="--background --quiet"
pidfile="/var/run/$SVCNAME.pid"

47
templates/update-adlin Normal file
View file

@ -0,0 +1,47 @@
#!/bin/sh
usage() {
echo -e "Usage: $0 [OPTION...]\n"
echo -e " -?, --help\tgive this help list"
echo -e " -R\trollback to the last binary backup"
}
while getopts "R" opt; do
case $opt in
R|r)
ROLLBACK=1
;;
\?)
usage
exit 1
;;
esac
done
/etc/init.d/lxc.{{ ctr_name }}-final status > /dev/null 2> /dev/null
FINAL_UP=$?
[ "$FINAL_UP" = 0 ] && /etc/init.d/lxc.{{ ctr_name }}-final stop
/etc/init.d/lxc.{{ ctr_name }} stop
for b in checker token-validator
do
echo -n " * Updating $b ..."
if [ -n "$ROLLBACK" ]
then
[ -f "/var/lib/lxc/{{ ctr_name }}/rootfs/home/backups/$b" ] || echo " Doesn't exists"
[ -f "/var/lib/lxc/{{ ctr_name }}/rootfs/home/backups/$b" ] && {
mv "/var/lib/lxc/{{ ctr_name }}/rootfs/usr/sbin/$b" /var/lib/lxc/{{ ctr_name }}/rootfs/home/newbuilds/
cp "/var/lib/lxc/{{ ctr_name }}/rootfs/home/backups/$b" /var/lib/lxc/{{ ctr_name }}/rootfs/usr/sbin/
} && echo " DONE"
else
[ -f "/var/lib/lxc/{{ ctr_name }}/rootfs/home/newbuilds/$b" ] || echo " Doesn't exists"
[ -f "/var/lib/lxc/{{ ctr_name }}/rootfs/home/newbuilds/$b" ] && {
cp "/var/lib/lxc/{{ ctr_name }}/rootfs/usr/sbin/$b" /var/lib/lxc/{{ ctr_name }}/rootfs/home/backups/
mv "/var/lib/lxc/{{ ctr_name }}/rootfs/home/newbuilds/$b" /var/lib/lxc/{{ ctr_name }}/rootfs/usr/sbin/
} && echo " DONE"
fi
done
/etc/init.d/lxc.{{ ctr_name }} start
[ "$FINAL_UP" = 0 ] && /etc/init.d/lxc.{{ ctr_name }}-final start

3
templates/wg.conf.j2 Normal file
View file

@ -0,0 +1,3 @@
[Interface]
PrivateKey = {{ wg_adlin_private_key }}
ListenPort = {{ wg_adlin_port }}