A place where I keep some infrastructure tips.
Fixing memory issue
From the commandline, first check for proper dependencies:
sudo -u nginx php /var/www/digitalsurvival.us/occ check
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php The current PHP memory limit is below the recommended value of 512MB. Nextcloud is not installed - only a limited number of commands are available
In this instance, the current PHP memory limited is advised to be adjusted up, so make the correction for the currently selected PHP implementation:
eselect php list fpm
 php7.3  php7.4  php8.0 *
; Maximum amount of memory a script may consume ; http://php.net/memory-limit ; memory_limit = 128M memory_limit = 1024M
Restart PHP and then rerun the check above to verify the memory limit has been resolved.
rc-service php-fpm restart
Running the installer
Run the installer from the commandline:
sudo -u nginx php /var/www/digitalsurvival.us/occ maintenance:install
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php What is the password you like to use for the admin account <admin>? Nextcloud was successfully installed
Connecting to Nextcloud
Before connecting via HTTP on any host other than localhost, the trusted domain will need to be configured. This is located in the Nextcloud installation directory, followed by config/config.php. Edit the file to add additional trusted domains or IP addresses to the array of values.
array ( 0 => 'localhost', 1 => 'cloud.digitalsurvival.us', 2 => '192.168.0.*', ),
Modifying the production database location
Depending on the amount of users, a production database may grow quite large. By default, MySQL stories creates its data directory under the var/lib/mysql directory. This directory may be modified via the datadir variable in the /etc/mysql/mysql.d/50-distro-server.cnf file. Unless the var/lib/mysql is large enough to hold the database, consider modifying the the datadir path to a suitable location.
Configuring a production database
My default Nextcloud will use an SQLite database. While this database implementation may be good for single user testing purposes, it is not good if the system will be used in any level of production. MySQL will be the database used in this guide.
Install the dev-db/mysql package:
emerge --ask dev-db/mysql
Add SQL to the default runlevel (OpenRC):
rc-update add mysql default
Configure a new SQL database. Follow the prompts as necessary. Be sure to record the root user's password in a place where it will not be lost.
emerge --config dev-db/mysql
Start the SQL server:
rc-service mysql start
Configure PHP to use MySQL
mysql -u root -p -h localhost
Fill in the following as necessary, substituting
username with a new username and
password with a strong, random passwords. As stated above, be sure to record this information in a secure place.
CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS nextcloud CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
GRANT ALL PRIVILEGES on nextcloud.* to 'username'@'localhost';
Then, from the web root, run:
sudo -u nginx php occ db:convert-type --all-apps --clear-schema mysql nextcloud localhost nextcloud
What is the database password? Clearing schema in new database Creating schema in new database
Sadly a workaround is required for database conversion on Nextcloud 21.
hief image preview support
In order for Nextcloud to include render support for hief images in the web browser, Imagemagick must support the hief file format.
media-gfx/imagemagick djvu hdri heif jbig jpeg2k lcms lzma raw svg tiff webp xml