mirror of
https://github.com/EV21/uberspace-helper.git
synced 2026-10-08 04:43:18 +02:00
Compare commits
7
Commits
f693a1517f
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c38a5ce166
|
||
|
|
6541a32fb9
|
||
|
|
ee5d32045c
|
||
|
|
6ff8b2edef
|
||
|
|
3e1292fb7a
|
||
|
|
95096f1507
|
||
|
|
459c736e9a
|
No files matched your search
+4
-4
@@ -202,9 +202,9 @@ DEFAULT_KEEP_EMAIL_PRIVATE = true
|
||||
NO_REPLY_ADDRESS = noreply.${USER}.uber.space
|
||||
|
||||
[mailer]
|
||||
ENABLED = true
|
||||
MAILER_TYPE = sendmail
|
||||
FROM = ${USER}@uber.space
|
||||
ENABLED = true
|
||||
PROTOCOL = sendmail
|
||||
FROM = ${USER}@uber.space
|
||||
|
||||
[other]
|
||||
SHOW_FOOTER_VERSION = false
|
||||
@@ -339,7 +339,7 @@ function verify_file
|
||||
fi
|
||||
}
|
||||
|
||||
# version_lower_than A B
|
||||
# is_version_lower_than A B
|
||||
# returns whether A < B
|
||||
function is_version_lower_than
|
||||
{
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ function verify_file
|
||||
fi
|
||||
}
|
||||
|
||||
# version_lower_than A B
|
||||
# is_version_lower_than A B
|
||||
# returns whether A < B
|
||||
function is_version_lower_than
|
||||
{
|
||||
|
||||
+16
-8
@@ -6,7 +6,8 @@ LOCAL_VERSION=$(jq --raw-output .version ~/hedgedoc/package.json)
|
||||
LATEST_VERSION=$(curl --silent https://api.github.com/repos/$ORG/$REPO/releases/latest |
|
||||
jq --raw-output .tag_name)
|
||||
|
||||
function do_upgrade() {
|
||||
function do_upgrade
|
||||
{
|
||||
supervisorctl stop hedgedoc
|
||||
echo "waiting 1 minute until all processes are stopped"
|
||||
sleep 1m
|
||||
@@ -26,7 +27,7 @@ function do_upgrade() {
|
||||
rm --recursive ~/hedgedoc_"$LOCAL_VERSION"
|
||||
}
|
||||
|
||||
function yes-no_question
|
||||
function yes_no_question
|
||||
{
|
||||
local question=$1
|
||||
while true
|
||||
@@ -45,9 +46,9 @@ function yes-no_question
|
||||
done
|
||||
}
|
||||
|
||||
## version_lower_than A B
|
||||
# is_version_lower_than A B
|
||||
# returns whether A < B
|
||||
function version_lower_than
|
||||
function is_version_lower_than
|
||||
{
|
||||
test "$(echo "$@" |
|
||||
tr " " "\n" |
|
||||
@@ -55,11 +56,17 @@ function version_lower_than
|
||||
head --lines=1)" != "$1"
|
||||
}
|
||||
|
||||
function is_update_available
|
||||
{
|
||||
if is_version_lower_than "$LOCAL_VERSION" "$LATEST_VERSION"
|
||||
then return 0
|
||||
else return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function main
|
||||
{
|
||||
if [ "$LOCAL_VERSION" = "$LATEST_VERSION" ]
|
||||
then echo "Your HedgeDoc is already up to date."
|
||||
elif version_lower_than "$LOCAL_VERSION" "$LATEST_VERSION"
|
||||
if is_update_available
|
||||
then
|
||||
echo "There is a new Version available of $APP_NAME"
|
||||
echo "The latest Version is $LATEST_VERSION"
|
||||
@@ -68,9 +75,10 @@ function main
|
||||
echo "Please read the release notes."
|
||||
echo "Also check if the upgrade instructions have changed."
|
||||
echo "Your instance might break."
|
||||
if yes-no_question "Do you wish to proceed with the upgrade?"
|
||||
if yes_no_question "Do you wish to proceed with the upgrade?"
|
||||
then do_upgrade
|
||||
fi
|
||||
else echo "Your HedgeDoc is already up to date."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
+50
-5
@@ -1,12 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
APP_NAME=Nextcloud
|
||||
PHP_VERSION=8.2
|
||||
|
||||
PGP_KEY_FINGERPRINT='28806A878AE423A28372792ED75899B9A724937A'
|
||||
|
||||
function install_nextcloud
|
||||
{
|
||||
echo "Please set your Nextcloud login credentials."
|
||||
read -r -p "Nextcloud admin user: " NEXTCLOUD_ADMIN_USER
|
||||
read -r -p "Nextcloud admin password: " NEXTCLOUD_ADMIN_PASS
|
||||
ask_for_password
|
||||
trusted_domain="$USER.uber.space"
|
||||
setup_php
|
||||
# simply get the first password string from ~/.my.cnf
|
||||
@@ -28,7 +31,6 @@ function install_nextcloud
|
||||
curl --silent --remote-name https://download.nextcloud.com/server/releases/"$signature_file"
|
||||
curl --silent --remote-name https://nextcloud.com/nextcloud.asc
|
||||
gpg --import nextcloud.asc
|
||||
PGP_KEY_FINGERPRINT='28806A878AE423A28372792ED75899B9A724937A'
|
||||
#gpg --keyserver pgp.mit.edu --recv-keys $PGP_KEY_FINGERPRINT
|
||||
echo "$PGP_KEY_FINGERPRINT:6:" | gpg --import-ownertrust
|
||||
if ! gpg --verify "$signature_file" "$release_archive"
|
||||
@@ -89,6 +91,7 @@ function uninstall_nextcloud
|
||||
fi
|
||||
if test -f ~/etc/services.d/notify_push.ini
|
||||
then
|
||||
uberspace web backend del /push
|
||||
supervisorctl stop notify_push
|
||||
rm ~/etc/services.d/notify_push.ini
|
||||
supervisorctl reread
|
||||
@@ -105,12 +108,27 @@ function uninstall_nextcloud
|
||||
rm -r ~/html/* ~/html/.htaccess ~/html/.user.ini ~/_nextcloud_completion
|
||||
mysql --verbose --execute="DROP DATABASE ${USER}_nextcloud"
|
||||
rm ~/bin/ncc ~/bin/nextcloud-update
|
||||
sed --in-place '/_nextcloud_completion/d' ~/.bash_profile
|
||||
unlink ~/bin/notify_push
|
||||
unlink ~/logs/nextcloud.log
|
||||
unlink ~/logs/nextcloud-updater.log
|
||||
set_critical_section
|
||||
}
|
||||
|
||||
function ask_for_password
|
||||
{
|
||||
echo "Note: Your password input will not be visible."
|
||||
read -s -r -p "$APP_NAME admin password: " NEXTCLOUD_ADMIN_PASS
|
||||
echo
|
||||
read -s -r -p "$APP_NAME admin password confirmation: " ADMIN_PASS_CONFIRMATION
|
||||
echo
|
||||
while [ -z "$NEXTCLOUD_ADMIN_PASS" ] || [ "$NEXTCLOUD_ADMIN_PASS" != "$ADMIN_PASS_CONFIRMATION" ]
|
||||
do
|
||||
echo That was not correct, try again
|
||||
ask_for_password
|
||||
done
|
||||
}
|
||||
|
||||
function process_parameters
|
||||
{
|
||||
while test $# -gt 0
|
||||
@@ -148,7 +166,7 @@ function get_version_name
|
||||
function setup_php
|
||||
{
|
||||
echo "Applying relevant PHP settings for Nextcloud"
|
||||
uberspace tools version use php 8.1
|
||||
uberspace tools version use php $PHP_VERSION
|
||||
touch ~/etc/php.d/opcache.ini
|
||||
cat << end_of_content > ~/etc/php.d/opcache.ini
|
||||
opcache.enable=1
|
||||
@@ -223,7 +241,10 @@ end_of_content
|
||||
supervisorctl update
|
||||
supervisorctl status
|
||||
uberspace web backend set /push --http --port 7867
|
||||
uberspace web backend list
|
||||
local fail_counter=0
|
||||
while (uberspace web backend list | grep "/push http:7867 => NOT OK") && test $fail_counter -lt 5
|
||||
do echo 'wait another 5 seconds for notify service'; sleep 5; ((fail_counter++))
|
||||
done
|
||||
local trusted_proxy
|
||||
trusted_proxy=$(ip route |
|
||||
tail --lines 1 | ## filter last line
|
||||
@@ -272,6 +293,8 @@ ncc db:add-missing-indices --no-interaction
|
||||
ncc db:convert-filecache-bigint --no-interaction
|
||||
|
||||
ncc app:update --all
|
||||
## App updates may require additional steps to be done by the `upgrade` command
|
||||
ncc upgrade
|
||||
/usr/sbin/restorecon -R $APP_LOCATION
|
||||
|
||||
if test -f ~/etc/services.d/notify_push.ini
|
||||
@@ -299,6 +322,27 @@ function yes_no_question
|
||||
done
|
||||
}
|
||||
|
||||
function echo_tree
|
||||
{
|
||||
cat << end_of_content
|
||||
/home/$USER
|
||||
├── _nextcloud_completion
|
||||
├── bin
|
||||
│ ├── ncc (wrapper shortcut for ~/html/occ)
|
||||
│ ├── nextcloud-update
|
||||
│ └── notify_push -> /home/$USER/html/apps/notify_push/bin/x86_64/notify_push
|
||||
├── nextcloud_data
|
||||
│ └── >> user files, etc. <<
|
||||
├── html -> /var/www/virtual/$USER/html
|
||||
│ └── >> Nextcloud installation <<
|
||||
├── logs
|
||||
│ ├── nextcloud-cron.log
|
||||
│ ├── nextcloud-updater.log -> /home/$USER/nextcloud_data/updater.log
|
||||
│ └── nextcloud.log -> /home/$USER/nextcloud_data/nextcloud.log
|
||||
└── ...
|
||||
end_of_content
|
||||
}
|
||||
|
||||
function set_critical_section { set -o pipefail -o errexit; }
|
||||
function unset_critical_section { set +o pipefail +o errexit; }
|
||||
|
||||
@@ -316,8 +360,9 @@ function main
|
||||
echo "This script installs the latest release of $APP_NAME"
|
||||
echo "and assumes a newly created Uberspace with default settings."
|
||||
fi
|
||||
echo 'This will be the basic file structure'
|
||||
echo_tree
|
||||
echo "Do not run this script if you already use your Uberspace for other apps!"
|
||||
|
||||
if yes_no_question "Do you want to execute this installer for $APP_NAME?"
|
||||
then install_nextcloud
|
||||
fi
|
||||
|
||||
@@ -98,6 +98,8 @@ function do_update_procedure
|
||||
ncc db:add-missing-indices --no-interaction
|
||||
ncc db:convert-filecache-bigint --no-interaction
|
||||
ncc app:update --all
|
||||
## App updates may require additional steps to be done by the `upgrade` command
|
||||
ncc upgrade
|
||||
/usr/sbin/restorecon -R "$APP_LOCATION"
|
||||
if test -f ~/etc/services.d/notify_push.ini
|
||||
then supervisorctl restart notify_push
|
||||
|
||||
@@ -21,6 +21,8 @@ ncc db:add-missing-indices --no-interaction
|
||||
ncc db:convert-filecache-bigint --no-interaction
|
||||
|
||||
ncc app:update --all
|
||||
## App updates may require additional steps to be done by the `upgrade` command
|
||||
ncc upgrade
|
||||
/usr/sbin/restorecon -R $APP_LOCATION
|
||||
|
||||
if test -f ~/etc/services.d/notify_push.ini
|
||||
|
||||
Reference in new issue
Block a user