Added nextcloud installapp and uninstallapp configuration

This commit is contained in:
root 2024-05-31 15:15:52 +00:00
parent 8d1fd23f1a
commit 3a5c3c9759

View File

@ -16,7 +16,7 @@ config_nextcloud() {
mkdir -p /federated/apps/nextcloud/data/var/www/data &> /dev/null
mkdir -p /federated/apps/nextcloud/data/usr/local/etc/php/conf.d &> /dev/null
fi
get_externalip
get_appvars
cat > /federated/apps/nextcloud/docker-compose.yml <<EOF
version: '3.7'
@ -75,7 +75,6 @@ networks:
external: true
EOF
LDAP_SECRET=`cat /federated/apps/ldap/.ldap.secret`
NEXTCLOUD_SECRET=$(create_password)
echo "$NEXTCLOUD_SECRET" > /federated/apps/nextcloud/.postgresql.secret
echo "$ADMINPASS" > /federated/apps/nextcloud/.nextcloud.secret
@ -208,11 +207,11 @@ PATH=/var/www/html:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/bin
/var/www/html/occ app:enable user_ldap
/var/www/html/occ ldap:create-empty-config
/var/www/html/occ ldap:set-config s01 ldapHost 'ldaps://ldap.$DOMAIN'
/var/www/html/occ ldap:set-config s01 ldapAgentName cn=admin,dc=federatedcomputer,dc=cloud
/var/www/html/occ ldap:set-config s01 ldapAgentName cn=admin,dc=$LDAP_DOMAIN_FIRST,dc=$LDAP_DOMAIN_LAST
/var/www/html/occ ldap:set-config s01 ldapAgentPassword $LDAP_SECRET
/var/www/html/occ ldap:set-config s01 ldapBase ou=people,dc=federatedcomputer,dc=cloud
/var/www/html/occ ldap:set-config s01 ldapBaseGroups ou=groups,dc=federatedcomputer,dc=cloud
/var/www/html/occ ldap:set-config s01 ldapBaseUsers ou=people,dc=federatedcomputer,dc=cloud
/var/www/html/occ ldap:set-config s01 ldapBase ou=people,dc=$LDAP_DOMAIN_FIRST,dc=$LDAP_DOMAIN_LAST
/var/www/html/occ ldap:set-config s01 ldapBaseGroups ou=groups,dc=$LDAP_DOMAIN_FIRST,dc=$LDAP_DOMAIN_LAST
/var/www/html/occ ldap:set-config s01 ldapBaseUsers ou=people,dc=$LDAP_DOMAIN_FIRST,dc=$LDAP_DOMAIN_LAST
/var/www/html/occ ldap:set-config s01 ldapEmailAttribute mail
/var/www/html/occ ldap:set-config s01 ldapGidNumber gidNumber
/var/www/html/occ ldap:set-config s01 ldapGroupDisplayName cn
@ -274,7 +273,6 @@ chmod +x /federated/apps/nextcloud/data/config.sh
echo -ne "done."
}
start_nextcloud() {
# Start service with command to make sure it's up before proceeding
start_service "nextcloud" "nc -z 172.99.0.18 80 &> /dev/null" "60"
@ -309,3 +307,21 @@ start_nextcloud() {
echo -ne "done."
}
uninstall_nextcloud() {
echo -ne "* Uninstalling nextcloud container.."
spin &
SPINPID=$!
# First stop the service
cd /federated/apps/nextcloud && docker-compose -f docker-compose.yml -p nextcloud down &> /dev/null
# Delete database and user in postgresql
docker exec postgresql psql -U postgres -c "DROP DATABASE nextcloud" &> /dev/null
docker exec postgresql psql -U postgres -c "DROP USER nextcloud" &> /dev/null
# Delete the app directory
rm -rf /federated/apps/nextcloud
kill -9 $SPINPID &> /dev/null
echo -ne "done.\n"
}