From 073e9a8939c7ef7ed8055dda638952e4f54ef435 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 26 Jan 2025 23:50:29 +0300 Subject: [PATCH 1/4] notes... Signed-off-by: Alex A. Naanou --- nextcloud/make.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nextcloud/make.sh b/nextcloud/make.sh index 931f9e4..17d0ef3 100755 --- a/nextcloud/make.sh +++ b/nextcloud/make.sh @@ -155,6 +155,8 @@ pctPushAssets $ID # Colabora... # XXX should this be a function/script, callable separately, usefull to # 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 echo "# Collabora office..." # see: From f6015311bb3a553c2defd64a077793702b2c6e27 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 27 Jan 2025 23:00:42 +0300 Subject: [PATCH 2/4] notes... Signed-off-by: Alex A. Naanou --- gitea/make.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gitea/make.sh b/gitea/make.sh index e8e8af3..f72c517 100755 --- a/gitea/make.sh +++ b/gitea/make.sh @@ -51,6 +51,10 @@ OPTS_STAGE_2="\ #---------------------------------------------------------------------- +# XXX do a version using alpune... +# see: +# https://wiki.alpinelinux.org/wiki/Gitea +# echo "# Building config..." buildAssets From 43f19810a14fdcd929826117818acba420370a67 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 27 Jan 2025 23:02:30 +0300 Subject: [PATCH 3/4] ... Signed-off-by: Alex A. Naanou --- gitea/make.sh | 188 +++++++++++++++++++++++++------------------------- 1 file changed, 94 insertions(+), 94 deletions(-) diff --git a/gitea/make.sh b/gitea/make.sh index f72c517..99af6d6 100755 --- a/gitea/make.sh +++ b/gitea/make.sh @@ -1,94 +1,94 @@ -#!/usr/bin/bash -#---------------------------------------------------------------------- - -cd $(dirname $0) -PATH=$PATH:$(dirname "$(pwd)") - - -#---------------------------------------------------------------------- - -source ../.pct-helpers - - -#---------------------------------------------------------------------- - -readConfig - - -#---------------------------------------------------------------------- - -webAppConfig gitea - -DFL_ID=${DFL_ID:=300} -DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=gitea} - -DFL_CORES=${DFL_CORES:=2} -DFL_RAM=${DFL_RAM:=1024} -DFL_SWAP=${DFL_SWAP:=${DFL_RAM}} -DFL_DRIVE=${DFL_DRIVE:=40} - -WAN_IP=SKIP -WAN_GATE=SKIP -ADMIN_IP=SKIP -ADMIN_GATE=SKIP -LAN_IP=SKIP -LAN_GATE=SKIP - -REBOOT=${REBOOT:=1} - -readVars - - -#---------------------------------------------------------------------- - -INTERFACES=( - "name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth" -) - -OPTS_STAGE_2="\ - --onboot 1 \ -" - - -#---------------------------------------------------------------------- -# XXX do a version using alpune... -# see: -# https://wiki.alpinelinux.org/wiki/Gitea -# - -echo "# Building config..." -buildAssets - -echo "# Creating CT..." -pctCreateTurnkey 'gitea' $ID "$PASS" - -echo "# Starting TKL UI..." -@ lxc-attach $ID -- bash -c "HUB_APIKEY=SKIP SEC_UPDATES=SKIP /usr/sbin/turnkey-init" - -echo "# Copying assets..." -pctPushAssets $ID - -echo "# Disabling fail2ban..." -# NOTE: we do not need this as we'll be running from behind a reverse proxy... -@ lxc-attach $ID systemctl stop fail2ban -@ lxc-attach $ID systemctl disable fail2ban - -echo "# Updating system..." -pctUpdateTurnkey $ID - -echo "# Post config..." -pctSet $ID "${OPTS_STAGE_2}" $REBOOT -pctSetNotes $ID - -saveLastRunConfig - -echo "# Traefik config..." -traefikPushConfig - -showNotes -echo "# Done." - - - -#---------------------------------------------------------------------- -# vim:set ts=4 sw=4 : +#!/usr/bin/bash +#---------------------------------------------------------------------- + +cd $(dirname $0) +PATH=$PATH:$(dirname "$(pwd)") + + +#---------------------------------------------------------------------- + +source ../.pct-helpers + + +#---------------------------------------------------------------------- + +readConfig + + +#---------------------------------------------------------------------- + +webAppConfig gitea + +DFL_ID=${DFL_ID:=300} +DFL_CTHOSTNAME=${DFL_CTHOSTNAME:=gitea} + +DFL_CORES=${DFL_CORES:=2} +DFL_RAM=${DFL_RAM:=1024} +DFL_SWAP=${DFL_SWAP:=${DFL_RAM}} +DFL_DRIVE=${DFL_DRIVE:=40} + +WAN_IP=SKIP +WAN_GATE=SKIP +ADMIN_IP=SKIP +ADMIN_GATE=SKIP +LAN_IP=SKIP +LAN_GATE=SKIP + +REBOOT=${REBOOT:=1} + +readVars + + +#---------------------------------------------------------------------- + +INTERFACES=( + "name=lan,bridge=vmbr${LAN_BRIDGE},firewall=1,ip=dhcp,type=veth" +) + +OPTS_STAGE_2="\ + --onboot 1 \ +" + + +#---------------------------------------------------------------------- +# XXX do a version using alpune... +# see: +# https://wiki.alpinelinux.org/wiki/Gitea +# + +echo "# Building config..." +buildAssets + +echo "# Creating CT..." +pctCreateTurnkey 'gitea' $ID "$PASS" + +echo "# Starting TKL UI..." +@ lxc-attach $ID -- bash -c "HUB_APIKEY=SKIP SEC_UPDATES=SKIP /usr/sbin/turnkey-init" + +echo "# Copying assets..." +pctPushAssets $ID + +echo "# Disabling fail2ban..." +# NOTE: we do not need this as we'll be running from behind a reverse proxy... +@ lxc-attach $ID systemctl stop fail2ban +@ lxc-attach $ID systemctl disable fail2ban + +echo "# Updating system..." +pctUpdateTurnkey $ID + +echo "# Post config..." +pctSet $ID "${OPTS_STAGE_2}" $REBOOT +pctSetNotes $ID + +saveLastRunConfig + +echo "# Traefik config..." +traefikPushConfig + +showNotes +echo "# Done." + + + +#---------------------------------------------------------------------- +# vim:set ts=4 sw=4 : From 345fc9147e065d8acd3c67570bbc9380bbd87be0 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 30 Jan 2025 20:21:07 +0300 Subject: [PATCH 4/4] ... Signed-off-by: Alex A. Naanou --- nextcloud/migrate.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nextcloud/migrate.sh b/nextcloud/migrate.sh index 31f3446..7f71acf 100755 --- a/nextcloud/migrate.sh +++ b/nextcloud/migrate.sh @@ -46,6 +46,8 @@ fi FROM=$1 TO=$2 +SLEEP=${SLEEP:-} + # XXX should we build TO if it's not there??? @@ -57,6 +59,9 @@ TO=$2 @ lxc-attach $TO -- turnkey-occ maintenance:mode --on # XXX should we sleep here for a minute or 6 as is recommended in the docs??? +[ -z "$SLEEP" ] \ + || [ $SLEEP <= 0 ] \ + || sleep $(( $SLEEP * 60 )) # sql @ lxc-attach $TO -- mysql -e "DROP DATABASE nextcloud"