NextCloud Update: Difference between revisions
From WikiMLT
m Стадий: 4 [Фаза:Авторизиране, Статус:Разработен]; Категория:Linux Server |
|||
(10 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
<syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | <syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | ||
NC_ROOT="/var/www/cloud.metalevel.tech" | NC_ROOT="/var/www/cloud.metalevel.tech" | ||
</syntaxhighlight> | |||
<syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | |||
NC_OWNER="www-data" | NC_OWNER="www-data" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 20: | Line 22: | ||
sudo -u "${NC_OWNER}" \ | sudo -u "${NC_OWNER}" \ | ||
php --define apc.enable_cli=1 "${NC_ROOT}/occ" db:add-missing-indices | php --define apc.enable_cli=1 "${NC_ROOT}/occ" db:add-missing-indices | ||
</syntaxhighlight> | |||
=== Bring all together === | |||
<syntaxhighlight lang="shell" class="code-continue mlw-shell-gray"> | |||
/usr/local/bin/cloud-update-platform.sh | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="bash" line="1" class="code-continue mlw-shell-gray"> | |||
#!/bin/bash | |||
: ${NC_ROOT:="/var/www/cloud.metalevel.tech"} # The DocumentRoot directory of the wiki | |||
: ${NC_OWNER:="www-data"} # The user that owns the $IP directory | |||
LOG_FILE=$(cat "${NC_ROOT}/config/config.php" | grep -0 logfile | sed -r 's/^.*=>\s+['\''"](.*)['\''"].*$/\1/') | |||
# Update the NextCloud platform itself | |||
sudo -u "${NC_OWNER}" \ | |||
php --define apc.enable_cli=1 "${NC_ROOT}/updater/updater.phar" | |||
# Update all apps | |||
sudo -u "${NC_OWNER}" \ | |||
php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:update --all | |||
# Add the missing database indexes: | |||
sudo -u "${NC_OWNER}" \ | |||
php --define apc.enable_cli=1 "${NC_ROOT}/occ" db:add-missing-indices | |||
sudo -u "${NC_OWNER}" rm "$LOG_FILE" | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 27: | Line 56: | ||
* NextCloud Docs: [https://docs.nextcloud.com/server/latest/admin_manual/maintenance/update.html#using-the-command-line-based-updater Using the command line based updater] | * NextCloud Docs: [https://docs.nextcloud.com/server/latest/admin_manual/maintenance/update.html#using-the-command-line-based-updater Using the command line based updater] | ||
* NextCloud Docs: [https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#apps-commands-label Using the <code>occ</code> command] | * NextCloud Docs: [https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html#apps-commands-label Using the <code>occ</code> command] | ||
== Handle some issues == | |||
=== Helper scripts to debug a broken application === | |||
Output the enabled applications to a file.<syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | |||
sudo -u "${NC_OWNER}" \ | |||
php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:list | \ | |||
sed '/^Disabled:/,$d' | sed -E 's/^\s+-\s(.*):.*$/\1/' | sed '/^Enabled/d' \ | |||
> ~/tmp/nc.enabled-apps.txt | |||
</syntaxhighlight> | |||
Disable (or attempt to) the enabled apps. | |||
<syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | |||
while IFS= read -r EXT; \ | |||
do \ | |||
sudo -u "${NC_OWNER}" php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:disable "$EXT"; \ | |||
done < ~/tmp/nc.enabled-apps.txt | |||
</syntaxhighlight> | |||
Enable (or attempt to) the previously enabled apps. | |||
<syntaxhighlight lang="shell" line="1" class="code-continue mlw-shell-gray"> | |||
#!/usr/bin/zsh | |||
while IFS= read -r EXT; \ | |||
do \ | |||
read -s -k "?Press Enter to enable: ${EXT}"; echo; \ | |||
sudo -u "${NC_OWNER}" php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:enable "$EXT"; \ | |||
done < ~/tmp/nc.enabled-apps.txt | |||
</syntaxhighlight> | |||
=== Web worker issue temporary solution === | |||
* NC 27.1.1: https://github.com/nextcloud/server/issues/39849#issuecomment-1677883083 : Currently I've added <code>$policy->add­Allow­ed­Worker­Src­Domain('\'self\<nowiki>''</nowiki>);</code> on line '''323''' in <code>apps/­files/­lib/­Controller/­View­Controller­.­php</code>. | |||
Line 34: | Line 93: | ||
| Прндл = Linux Server | | Прндл = Linux Server | ||
| Прндл1 = Web Servers | | Прндл1 = Web Servers | ||
| Стадий = | | Стадий = 6 | ||
| Фаза = | | Фаза = Утвърждаване | ||
| Статус = | | Статус = Утвърден | ||
| ИдтПт = Spas | | ИдтПт = Spas | ||
| РзбПт = Spas | | РзбПт = Spas | ||
| АвтПт = | | АвтПт = Spas | ||
| УтвПт = | | УтвПт = {{REVISIONUSER}} | ||
| ИдтДт = 24.09.2022 | | ИдтДт = 24.09.2022 | ||
| РзбДт = 25.02.2023 | | РзбДт = 25.02.2023 | ||
| АвтДт = | | АвтДт = 25.02.2023 | ||
| УтвДт = | | УтвДт = {{Today}} | ||
| ИдтРв = [[Special:Permalink/31783|31783]] | | ИдтРв = [[Special:Permalink/31783|31783]] | ||
| РзбРв = [[Special:Permalink/32330|32330]] | | РзбРв = [[Special:Permalink/32330|32330]] | ||
| АвтРв = | | АвтРв = [[Special:Permalink/32331|32331]] | ||
| РзАРв = [[Special:Permalink/31789|31789]] | | РзАРв = [[Special:Permalink/31789|31789]] | ||
| УтвРв = {{REVISIONID}} | |||
| РзУРв = [[Special:Permalink/32163|32163]] | | РзУРв = [[Special:Permalink/32163|32163]] | ||
}} | }} | ||
</div> | </div> | ||
</noinclude> | </noinclude> |
Latest revision as of 11:21, 24 February 2024
Using the command line based updater
Update the NextCloud app itself – the command can also be used to complete a stuck web update.
NC_ROOT="/var/www/cloud.metalevel.tech"
NC_OWNER="www-data"
sudo -u "${NC_OWNER}" \
php --define apc.enable_cli=1 "${NC_ROOT}/updater/updater.phar"
In order to update all apps from CLI use:
sudo -u "${NC_OWNER}" \
php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:update --all
Further you may need to add the missing database indexes:
sudo -u "${NC_OWNER}" \
php --define apc.enable_cli=1 "${NC_ROOT}/occ" db:add-missing-indices
Bring all together
/usr/local/bin/cloud-update-platform.sh
#!/bin/bash
: ${NC_ROOT:="/var/www/cloud.metalevel.tech"} # The DocumentRoot directory of the wiki
: ${NC_OWNER:="www-data"} # The user that owns the $IP directory
LOG_FILE=$(cat "${NC_ROOT}/config/config.php" | grep -0 logfile | sed -r 's/^.*=>\s+['\''"](.*)['\''"].*$/\1/')
# Update the NextCloud platform itself
sudo -u "${NC_OWNER}" \
php --define apc.enable_cli=1 "${NC_ROOT}/updater/updater.phar"
# Update all apps
sudo -u "${NC_OWNER}" \
php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:update --all
# Add the missing database indexes:
sudo -u "${NC_OWNER}" \
php --define apc.enable_cli=1 "${NC_ROOT}/occ" db:add-missing-indices
sudo -u "${NC_OWNER}" rm "$LOG_FILE"
References
- NextCloud Docs: Using the web based updater | Finish via command line based upgrade
- NextCloud Docs: Using the command line based updater
- NextCloud Docs: Using the
occ
command
Handle some issues
Helper scripts to debug a broken application
Output the enabled applications to a file.
sudo -u "${NC_OWNER}" \
php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:list | \
sed '/^Disabled:/,$d' | sed -E 's/^\s+-\s(.*):.*$/\1/' | sed '/^Enabled/d' \
> ~/tmp/nc.enabled-apps.txt
Disable (or attempt to) the enabled apps.
while IFS= read -r EXT; \
do \
sudo -u "${NC_OWNER}" php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:disable "$EXT"; \
done < ~/tmp/nc.enabled-apps.txt
Enable (or attempt to) the previously enabled apps.
#!/usr/bin/zsh
while IFS= read -r EXT; \
do \
read -s -k "?Press Enter to enable: ${EXT}"; echo; \
sudo -u "${NC_OWNER}" php --define apc.enable_cli=1 "${NC_ROOT}/occ" app:enable "$EXT"; \
done < ~/tmp/nc.enabled-apps.txt
Web worker issue temporary solution
- NC 27.1.1: https://github.com/nextcloud/server/issues/39849#issuecomment–1677883083 : Currently I've added
$policy->addAllowedWorkerSrcDomain('\'self\'');
on line 323 inapps/files/lib/Controller/ViewController.php
.