Merge branch 'master' of github.com:flynx/proxmox-utils

This commit is contained in:
Alex A. Naanou 2025-02-04 22:49:11 +03:00
commit d62bf16831
3 changed files with 101 additions and 90 deletions

View File

@ -1,90 +1,94 @@
#!/usr/bin/bash #!/usr/bin/bash
#---------------------------------------------------------------------- #----------------------------------------------------------------------
cd $(dirname $0) cd $(dirname $0)
PATH=$PATH:$(dirname "$(pwd)") PATH=$PATH:$(dirname "$(pwd)")
#---------------------------------------------------------------------- #----------------------------------------------------------------------
source ../.pct-helpers source ../.pct-helpers
#---------------------------------------------------------------------- #----------------------------------------------------------------------
readConfig readConfig
#---------------------------------------------------------------------- #----------------------------------------------------------------------
webAppConfig gitea webAppConfig gitea
DFL_ID=${DFL_ID:=300} DFL_ID=${DFL_ID:=300}
DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=gitea} DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=gitea}
DFL_CORES=${DFL_CORES:=2} DFL_CORES=${DFL_CORES:=2}
DFL_RAM=${DFL_RAM:=1024} DFL_RAM=${DFL_RAM:=1024}
DFL_SWAP=${DFL_SWAP:=${DFL_RAM}} DFL_SWAP=${DFL_SWAP:=${DFL_RAM}}
DFL_DRIVE=${DFL_DRIVE:=40} DFL_DRIVE=${DFL_DRIVE:=40}
WAN_IP=SKIP WAN_IP=SKIP
WAN_GATE=SKIP WAN_GATE=SKIP
ADMIN_IP=SKIP ADMIN_IP=SKIP
ADMIN_GATE=SKIP ADMIN_GATE=SKIP
LAN_IP=SKIP LAN_IP=SKIP
LAN_GATE=SKIP LAN_GATE=SKIP
REBOOT=${REBOOT:=1} REBOOT=${REBOOT:=1}
readVars readVars
#---------------------------------------------------------------------- #----------------------------------------------------------------------
INTERFACES=( INTERFACES=(
"name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth" "name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth"
) )
OPTS_STAGE_2="\ OPTS_STAGE_2="\
--onboot 1 \ --onboot 1 \
" "
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# XXX do a version using alpune...
echo "# Building config..." # see:
buildAssets # https://wiki.alpinelinux.org/wiki/Gitea
#
echo "# Creating CT..."
pctCreateTurnkey 'gitea' $ID "$PASS" echo "# Building config..."
buildAssets
echo "# Starting TKL UI..."
@ lxc-attach $ID -- bash -c "HUB_APIKEY=SKIP SEC_UPDATES=SKIP /usr/sbin/turnkey-init" echo "# Creating CT..."
pctCreateTurnkey 'gitea' $ID "$PASS"
echo "# Copying assets..."
pctPushAssets $ID echo "# Starting TKL UI..."
@ lxc-attach $ID -- bash -c "HUB_APIKEY=SKIP SEC_UPDATES=SKIP /usr/sbin/turnkey-init"
echo "# Disabling fail2ban..."
# NOTE: we do not need this as we'll be running from behind a reverse proxy... echo "# Copying assets..."
@ lxc-attach $ID systemctl stop fail2ban pctPushAssets $ID
@ lxc-attach $ID systemctl disable fail2ban
echo "# Disabling fail2ban..."
echo "# Updating system..." # NOTE: we do not need this as we'll be running from behind a reverse proxy...
pctUpdateTurnkey $ID @ lxc-attach $ID systemctl stop fail2ban
@ lxc-attach $ID systemctl disable fail2ban
echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT echo "# Updating system..."
pctSetNotes $ID pctUpdateTurnkey $ID
saveLastRunConfig echo "# Post config..."
pctSet $ID "${OPTS_STAGE_2}" $REBOOT
echo "# Traefik config..." pctSetNotes $ID
traefikPushConfig
saveLastRunConfig
showNotes
echo "# Done." echo "# Traefik config..."
traefikPushConfig
showNotes
#---------------------------------------------------------------------- echo "# Done."
# vim:set ts=4 sw=4 :
#----------------------------------------------------------------------
# vim:set ts=4 sw=4 :

View File

@ -155,6 +155,8 @@ pctPushAssets $ID
# Colabora... # Colabora...
# XXX should this be a function/script, callable separately, usefull to # XXX should this be a function/script, callable separately, usefull to
# update existing installations??? # update existing installations???
# XXX can we make the backup/restore/migrate scripts generic and simply adapt
# them for running in lxc, over ssh or locally???
if ! [ -z $COLLABORA_OFFICE ] ; then if ! [ -z $COLLABORA_OFFICE ] ; then
echo "# Collabora office..." echo "# Collabora office..."
# see: # see:

View File

@ -49,6 +49,8 @@ fi
FROM=$1 FROM=$1
TO=$2 TO=$2
SLEEP=${SLEEP:-}
# XXX should we build TO if it's not there??? # XXX should we build TO if it's not there???
@ -60,6 +62,9 @@ TO=$2
@ lxc-attach $TO -- turnkey-occ maintenance:mode --on @ lxc-attach $TO -- turnkey-occ maintenance:mode --on
# XXX should we sleep here for a minute or 6 as is recommended in the docs??? # XXX should we sleep here for a minute or 6 as is recommended in the docs???
[ -z "$SLEEP" ] \
|| [ $SLEEP <= 0 ] \
|| sleep $(( $SLEEP * 60 ))
# sql # sql
@ lxc-attach $TO -- mysql -e "DROP DATABASE nextcloud" @ lxc-attach $TO -- mysql -e "DROP DATABASE nextcloud"