Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DietPi-Software | ownCloud/Nextcloud: Improve installation and configuration - Phase II #1261

Merged
merged 18 commits into from
Dec 5, 2017

Conversation

MichaIng
Copy link
Owner

@MichaIng MichaIng commented Nov 27, 2017

https://github.com/Fourdee/DietPi/issues/1067

  • Installation and setup of redis-server + PHP module for transactional file locking
  • Setting up cron for background jobs
  • Create occ command (will be "ncc", while "occ" will be used by ownCloud) shortcut
  • Put Nextcloud/ownCloud into maintenance mode during several DietPi maintenance tasks, updates etc.
  • Add database 4-bit character support
  • Do whole installation and configuration sensitive to already existing/possibly manually changed files.
  • Add database dump to owncloud/nextcloud-data directory on uninstallation to preserve all information of the instances.

…e locking

and:
+ Cleaned Nextcloud configuration by providing variable to config.php.
+ Added php module installation for rare cases, where in past DietPi versions first PHP was installed (==2), then Redis (==2) and now ownCloud/Nextcloud. In that cases php(5)-redis would have been not installed.
@MichaIng MichaIng changed the title DietPi-Software | ownCloud/Nextcloud: Improve installation and configuration DietPi-Software | ownCloud/Nextcloud: Improve installation and configuration - Phase II Nov 27, 2017
@MichaIng
Copy link
Owner Author

MichaIng commented Nov 27, 2017

Decided to give Redis priority, since it produces warnings on admin panel of ownCloud and the benefit is obvious: I see quite often questions/reports about wrong locked files on help.nextcloud.com where file locking is left to database.

Do we want this also on dietpi-update? We could do the whole procedure, or "simply" reinstall Nextcloud and ownCloud. At the moment webserver configs would be overwritten and, more problematic, beta versions of Nextcloud/ownCloud, that got installed from zip or internal updater (on beta branch) would be overwritten. The latter could least to problems, as downgrading is not supported because of possibly changed database table structure. I could/should do the installation case sensitive, based on existence of ownCloud/Nextcloud folder. For a clean reinstallation, user would need to uninstall first.
All other config files etc. are changed case sensitive already.

@Fourdee
Copy link
Collaborator

Fourdee commented Nov 27, 2017

@MichaIng

At the moment webserver configs would be overwritten and, more problematic, beta versions of Nextcloud/ownCloud, that got installed from zip or internal updater (on beta branch) would be overwritten.
For a clean reinstallation, user would need to uninstall first.

In these cases, where stable patching existing installations is too risky (outside of our control, too many possibilities that we simply cant test all of them for), the only thing we can do is mention it in the changelog eg:

  • DietPi-Software | NextCloud: Resolved an issue with X. This applies to fresh installations only, as patching existing installations poses risk factors. Existing installations of this software title, will need to uninstall the software, then install again, to benefit from this fix.

@MichaIng
Copy link
Owner Author

MichaIng commented Dec 2, 2017

@Fourdee
Is there a way to include sudo and arguments into alias in /etc/bash.bashrc to shorten ownCloud/Nextcloud occ command execution?
Otherwise I realized it on my machine by:
echo -e '#!/bin/bash\nsudo -u www-data php /var/www/nextcloud/occ $*' > /usr/local/bin/occ && chmod +x /usr/local/bin/occ

€: Answered it by myself:
echo "alias occ='sudo -u www-data /var/www/nextcloud/occ'" >> /etc/bash.bashrc && source /etc/bash.bashrc works well 🙂.

@MichaIng
Copy link
Owner Author

MichaIng commented Dec 5, 2017

Added:
MySQL 4-byte support. But especially on Nextcloud + MariaDB secure database conversion of existing installations is a step by step procedure with unknown outcome: https://docs.nextcloud.com/server/12/admin_manual/configuration_database/mysql_4byte_support.html

We will adjust MySQL settings to be prepared for potential 4-byte support in every case. At least ownCloud will then enable 4-byte support via config.php automatically on occ installation/first run. If installation was really fresh (no ownCloud/Nextcloud database existed) before occ installation, we will ensure use of 4-byte support afterwards.

To check: Might there be any other application that has problems with MySQL barracuda table format? But I am pretty sure, that this is just an internal thing that does not influence 'external' database requests.

@MichaIng
Copy link
Owner Author

MichaIng commented Dec 5, 2017

Added:
Respect and do not overwrite existing instance or configuration files, in case user installed beta/daily versions or copied manual changed files from old instance. This also allows dietpi-software reinstall without producing potential table version incompatibilities or destroying manual adjustments.

  • On the other hand this prevents some installation/configuration improvements for existing installations. User needs to uninstall first, to completely remove the existing instance, including all configuration files, and install again.

@MichaIng
Copy link
Owner Author

MichaIng commented Dec 5, 2017

Added:
mysqldump to userdata dir, before uninstall. That way the old instance will be totally recoverable.

@Fourdee Fourdee added this to the v160 milestone Dec 5, 2017
@MichaIng
Copy link
Owner Author

MichaIng commented Dec 5, 2017

Added:
Put ownCloud/Nextcloud into maintenance mode during DietPi maintenance tasks. As DietPi already controls services accordingly, we just need to enable maintenance before dietpi-services stop/restart and disable it after dietpi-services restart/start.

@MichaIng
Copy link
Owner Author

MichaIng commented Dec 5, 2017

@Fourdee
If you find time and agree to the changes, please add the PR for testing. Everything I thought of is done.
Could be finished for v159, I could intensively test everything again after merge.

@Fourdee
Copy link
Collaborator

Fourdee commented Dec 5, 2017

@MichaIng

If you find time and agree to the changes, please add the PR for testing. Everything I thought of is done.
Could be finished for v159, I could intensively test everything again after merge.

I'am going to focus/finish up v159 this week (Stretch RPi), aim for release Sunday. If you can confirm your able to do all required testing for this PR, before Sunday, let me know and i'll merge?

@MichaIng
Copy link
Owner Author

MichaIng commented Dec 5, 2017

@Fourdee:
Jep will do until at latest thursday. Have a bid time tomorrow :).

@Fourdee
Copy link
Collaborator

Fourdee commented Dec 5, 2017

@MichaIng

Legend 👍

@Fourdee Fourdee modified the milestones: v160, v159 Dec 5, 2017
@Fourdee Fourdee merged commit 7daa5c0 into MichaIng:testing Dec 5, 2017
@Fourdee Fourdee self-requested a review December 5, 2017 23:01
@MichaIng MichaIng deleted the patch-2 branch December 5, 2017 23:30
@Fourdee
Copy link
Collaborator

Fourdee commented Dec 7, 2017

@MichaIng

We need to check for file exist before running grep:

if [ -f /var/www/owncloud/config/config.php ] || [ -f /var/www/nextcloud/config/config.php ]; then

    grep xxxxxxxxxx

fi
root@DietPi:~# dietpi-services stop

 DietPi-Services
─────────────────────────────────────────────────────
 Mode: stop
 Please wait...

grep: /var/www/owncloud/config/config.php: No such file or directory
grep: /var/www/nextcloud/config/config.php: No such file or directory
 [Ok] stop : cron

root@DietPi:~#

@MichaIng
Copy link
Owner Author

MichaIng commented Dec 7, 2017

@Fourdee
Fixed in https://github.com/Fourdee/DietPi/pull/1272

Check is included in grep there but with &> /dev/null:
If maintenance=true pattern is found (and therefore file exists), we do occ command now. Same other way round for service starts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants