First round of alpine support

This commit is contained in:
root 2024-06-20 18:39:54 +00:00
parent 8598eba709
commit ac50d3de8e
2 changed files with 50 additions and 5 deletions

View File

@ -61,12 +61,19 @@ get_config
echo -ne "\nStarting Federated install for $DOMAIN\n"
# Check which OS.
# Check that we have docker installed. Check that
# we have all ports available and not in use
check_docker
check_os
#check_memory
check_ports
. /etc/os-release
if [[ "$NAME" = "Ubuntu" ]]; then
check_docker
check_os
#check_memory
check_ports
elif [[ "$NAME" = "Alpine Linux" ]]; then
update_alpine
install_packages
fi
# Configure docker private network
config_network

View File

@ -32,6 +32,32 @@ spin() {
done
done
}
update_alpine() {
apk update &> /dev/null
[ $? -ne 0 ] && fail "Failed running apk update"
apk upgrade &> /dev/null
[ $? -ne 0 ] && fail "Failed running apk upgrade"
}
install_packages_alpine() {
# Install docker packages
apk add docker docker-cli-compose &> /dev/null
[ $? -ne 0 ] && failcheck "Failed running apk add docker docker-cli-compose"
# Install extra packages
apk add duplicity apache2-utils pipx &> /dev/null
[ $? -ne 0 ] && failcheck "Failed running apk add duplicity apache2-utils pipx"
# Install b2 through pipx
pipx install b2 &> /dev/null
[ $? -ne 0 ] && failcheck "Failed running pipx install b2"
pipx ensurepath &> /dev/null
[ $? -ne 0 ] && failcheck "Failed running pipx ensurepath"
# Install Traefik certs dumper
curl -sfL https://raw.githubusercontent.com/ldez/traefik-certs-dumper/master/godownloader.sh | bash -s -- -b $(go env GOPATH 2>/dev/null)/bin v2.8.1 &> /dev/null
[ $? -ne 0 ] && failcheck "Failed running curl to get traefik certs dumper"
}
send_alert_backups() {
EXTERNALIP=`dig @resolver4.opendns.com myip.opendns.com +short 2> /dev/null`
echo "Generated by /federated/bin/backuptool" > /federated/apps/mail/data/root/certs/mailfile
@ -1398,7 +1424,19 @@ get_appvars() {
MYSQL_ROOTPASSWORD=`cat /federated/apps/pdnsmysql/.env | grep MYSQL_ROOT_PASSWORD | awk -F= '{ print $2 }'`
# If ADMINPASS doesn't exist in /etc/federated then use nextcloud to get it. Otherwise get it from /etc/federated
[[ ! $(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }') ]] && ADMINPASS=$(cat /federated/apps/nextcloud/.nextcloud.secret) || ADMINPASS=$(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }')
# [[ ! $(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }') ]] && ADMINPASS=$(cat /federated/apps/nextcloud/.nextcloud.secret) || ADMINPASS=$(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }')
# If ADMINPASS doesn't exist in /etc/federated then use nextcloud to get it. If Nextcloud secret isn't there then use panel.
# If ADMINPASS exists in /etc/federated then get it from /etc/federated
if [[ ! $(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }') ]]; then
if [[ -f "/federated/apps/nextcloud/.nextcloud.secret" ]]; then
ADMINPASS=$(cat /federated/apps/nextcloud/.nextcloud.secret)
else
ADMINPASS=$(grep SMTP_PASSWORD /federated/apps/panel/.env | awk -F= '{ print $2 }')
fi
else
ADMINPASS=$(grep ADMINPASS /etc/federated | awk -F\" '{ print $2 }')
fi
# If COTURN_MATRIX_SECRET exists in turnserver.conf then use it, otherwise create the password
[[ $(grep static-auth-secret /federated/apps/coturn/data/etc/turnserver.conf 2>/dev/null | awk -F= '{ print $2 }') ]] && COTURN_MATRIX_SECRET=$(grep static-auth-secret /federated/apps/coturn/data/etc/turnserver.conf 2>/dev/null | awk -F= '{ print $2 }') || COTURN_MATRIX_SECRET=$(create_password);