Commit 4db1d3b4 authored by w4t's avatar w4t

wtserver 0.25

parent adda3a5c
......@@ -5,16 +5,16 @@
InstallLetsEncrypt() {
local START_TIME=$SECONDS
echo -n -e "$IDENTATION_LVL_0 ${BWhite}Installing LetsEncrypt Certbot${NC}\n"
echo -n -e "$IDENTATION_LVL_1 ${BWhite}Installing LetsEncrypt Certbot${NC}\n"
if [ $CFG_CERTBOT_VERSION == "Certbot" ]; then
if [ $CFG_WEBSERVER == "apache" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing certbot for Apache... "
echo -n -e "$IDENTATION_LVL_2 Installing certbot for Apache... "
apt_install certbot python3-certbot-apache
certbot --apache >>$PROGRAMS_INSTALL_LOG_FILES 2>&1
echo -e "[${green}DONE${NC}]"
elif [ $CFG_WEBSERVER == "nginx" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing certbot for Nginx... "
echo -n -e "$IDENTATION_LVL_2 Installing certbot for Nginx... "
apt_install certbot python3-certbot-nginx
echo -e "[${green}DONE${NC}]"
fi
......@@ -26,7 +26,7 @@ InstallLetsEncrypt() {
#certbot renew --dry-run
elif [ $CFG_CERTBOT_VERSION == "Acme.sh" ]; then
echo -n -e "$IDENTATION_LVL_1 Installing acme.sh... "
echo -n -e "$IDENTATION_LVL_2 Installing acme.sh... "
#Advanced installation
#git clone https://github.com/Neilpang/acme.sh.git
#git clone https://github.com/acmesh-official/acme.sh.git
......
......@@ -66,24 +66,25 @@ InstallMTA() {
-e "/^#default_login_user =/a log_path = /var/log/mail.log" \
"/etc/dovecot/conf.d/10-master.conf"
sed -i "s/ #user =/ user = postfix/" /etc/dovecot/conf.d/10-master.conf
sed -i "s/ #group =/ group = postfix/" /etc/dovecot/conf.d/10-master.conf
sed -i "s/ #user =.*/ user = postfix/" /etc/dovecot/conf.d/10-master.conf
sed -i "s/ #group =.*/ group = postfix/" /etc/dovecot/conf.d/10-master.conf
# The inotify `max_user_instances` default is 128, which constrains
# the total number of watched (IMAP IDLE push) folders by open connections.
# See http://www.dovecot.org/pipermail/dovecot/2013-March/088834.html.
# A reboot is required for this to take effect (which we don't do as
# as a part of setup). Test with `cat /proc/sys/fs/inotify/max_user_instances`.
sed -i "/^#*\s*fs\.inotify\.max_user_instances\s*=/d; $a\fs.inotify.max_user_instances=1024" /etc/sysctl.conf
#sed -i "/^#*\s*fs\.inotify\.max_user_instances\s*=/d; $a\fs.inotify.max_user_instances=1024" /etc/sysctl.conf
echo "fs.inotify.max_user_instances=1024" | sudo tee -a /etc/sysctl.conf
# Set the location where we'll store user mailboxes. '%d' is the domain name and '%n' is the
# username part of the user's email address. We'll ensure that no bad domains or email addresses
# are created within the management daemon.
sed -i -E \
-e "s/^mail_location\s*=\s*.*/mail_location = maildir:$STORAGE_ROOT\/mail\/mailboxes\/%d\/%n/" \
-e "s/^mail_privileged_group\s*=\s*.*/mail_privileged_group = mail/" \
-e "s/^#first_valid_uid\s*=\s*.*/first_valid_uid = 0/" \
/etc/dovecot/conf.d/10-mail.conf
#sed -i -E \
#-e "s/^mail_location\s*=\s*.*/mail_location = maildir:$STORAGE_ROOT\/mail\/mailboxes\/%d\/%n/" \
#-e "s/^mail_privileged_group\s*=\s*.*/mail_privileged_group = mail/" \
#-e "s/^#first_valid_uid\s*=\s*.*/first_valid_uid = 0/" \
#/etc/dovecot/conf.d/10-mail.conf
# Create, subscribe, and mark as special folders: INBOX, Drafts, Sent, Trash, Spam and Archive.
cp $APWD/conf/dovecot-mailboxes.conf /etc/dovecot/conf.d/15-mailboxes.conf
......
......@@ -56,377 +56,6 @@ InstallNextcloud() {
echo -n -e "$IDENTATION_LVL_0 ${BWhite}Installing Nextcloud${NC}"
echo -n -e "$IDENTATION_LVL_1 Installing required packages... "
# Install required PHP packages
apt_install php8.2 php8.2-fpm php8.2-cli php8.2-sqlite php8.2-gd php8.2-imap php8.2-curl php-pear curl \
php8.2-dev memcached php-memcached php8.2-xml php8.2-mbstring php8.2-zip php8.2-apcu \
php8.2-fpm php8.2-mysql php8.2-xsl php8.2-gmp php8.2-bcmath php8.2-cgi php-gettext libxml2-dev \
php8.2-json php8.2-intl php8.2-imagick php8.2-common php8.2-opcache php8.2-readline php8.2
# Enable APC before Nextcloud tools are run
sed -i '1i apc.enabled=1\napc.enable_cli=1' /etc/php/8.2/mods-available/apcu.ini
# Get current Nextcloud version if config.php exists
if [ -f "$CLOUD_DIR/config.php" ]; then
CURRENT_NEXTCLOUD_VER=$(php8.2 -r "include(\"$CLOUD_DIR/config.php\"); echo(\$CONFIG['version']);")
else
CURRENT_NEXTCLOUD_VER=""
fi
# Install or upgrade Nextcloud if necessary
if [ ! -d $CLOUD_DIR ] || [[ ! ${CURRENT_NEXTCLOUD_VER} =~ ^$nextcloud_ver ]]; then
# Stop php-fpm if running. If theyre not running (which happens on a previously failed install), dont bail
systemctl restart php8.2-fpm stop &> /dev/null || /bin/true
# Backup existing Nextcloud installation
# Create a backup directory to store the current installation and database to
BACKUP_DIRECTORY=$CLOUD_DIR-backup/`date +"%Y-%m-%d-%T"`
mkdir -p "$BACKUP_DIRECTORY"
if [ -d $CLOUD_DIR/ ]; then
echo "Upgrading Nextcloud --- backing up existing installation, configuration, and database to $BACKUP_DIRECTORY..."
cp -r $CLOUD_DIR "$BACKUP_DIRECTORY/nextcloud-install"
fi
if [ -e "$STORAGE_ROOT/nextcloud/nextcloud.db" ]; then
cp "$STORAGE_ROOT/nextcloud/owncloud.db" "$BACKUP_DIRECTORY"
fi
if [ -e "$STORAGE_ROOT/nextcloud/config.php" ]; then
cp "$STORAGE_ROOT/nextcloud/config.php" "$BACKUP_DIRECTORY"
fi
# Perform version-specific upgrades
if [ -n "${CURRENT_NEXTCLOUD_VER}" ]; then
if [ -e "$CLOUD_DIR/config.php" ]; then
# Remove the read-onlyness of the config, which is needed for migrations, especially for v24
sed -i -e '/config_is_read_only/d' "$CLOUD_DIR/config.php"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^27 ]]; then
InstallNextcloudVer 28.0.14 8a9edcfd26d318eb7d1cfa44d69796f2d1098a80
CURRENT_NEXTCLOUD_VER="28.0.14"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^28 ]]; then
InstallNextcloudVer 29.0.12 6cd53db7a8d730ebd5972081344db41eb2b174a8
CURRENT_NEXTCLOUD_VER="29.0.12"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^29 ]]; then
InstallNextcloudVer 30.0.6 c7171b03f9904a2051e765fe09ab3e95e2e564e6
CURRENT_NEXTCLOUD_VER="30.0.6"
fi
if [[ ${CURRENT_NEXTCLOUD_VER} =~ ^30 ]]; then
InstallNextcloudVer 31.0.0 545584d128e3242337548ac2cdf31e6019b738f4
CURRENT_NEXTCLOUD_VER="31.0.0"
fi
fi
else
InstallNextcloudVer $owncloud_ver $owncloud_hash
fi
# Configure Nextcloud permissions
cat >> ./nextcloud_permissions.sh <<EOF
#!/bin/bash
ocpath='$CLOUD_DIR'
htuser='www-data'
htgroup='www-data'
rootuser='root'
printf "Creating possible missing Directories\n"
mkdir -p \$ocpath/data
mkdir -p \$ocpath/assets
mkdir -p \$ocpath/updater
printf "chmod Files and Directories\n"
find \${ocpath}/ -type f -print0 | xargs -0 chmod 0640
find \${ocpath}/ -type d -print0 | xargs -0 chmod 0770
printf "Setting directory ownership\n"
chown -R \${rootuser}:\${htgroup} \${ocpath}/
chown -R \${htuser}:\${htgroup} \${ocpath}/apps/
chown -R \${htuser}:\${htgroup} \${ocpath}/assets/
chown -R \${htuser}:\${htgroup} \${ocpath}/config/
chown -R \${htuser}:\${htgroup} \${ocpath}/data/
chown -R \${htuser}:\${htgroup} \${ocpath}/themes/
chown -R \${htuser}:\${htgroup} \${ocpath}/updater/
chmod +x \${ocpath}/occ
printf "Setting .htaccess permissions\n"
if [ -f \${ocpath}/.htaccess ]; then
chmod 0644 \${ocpath}/.htaccess
chown \${rootuser}:\${htgroup} \${ocpath}/.htaccess
fi
if [ -f \${ocpath}/data/.htaccess ]; then
chmod 0644 \${ocpath}/data/.htaccess
chown \${rootuser}:\${htgroup} \${ocpath}/data/.htaccess
fi
EOF
chmod +x ./nextcloud_permissions.sh
#./nextcloud_permissions.sh
# Create initial configuration
instanceid=oc$(echo $CFG_HOSTNAME_DOMAIN | sha1sum | fold -w 10 | head -n 1)
echo -n "Creating Nextcloud settings and database..."
CFG_CLOUDDBNAME=nextcloud
CFG_CLOUDDBUSER=nextcloud
CFG_CLOUDDBPWD=$(dd if=/dev/urandom bs=1 count=64 2>/dev/null | sha256sum | fold -w 40 | head -n 1)
dbruser=root
CFG_CLOUDADMINUSER=root
CFG_CLOUDADMINPWD=$(dd if=/dev/urandom bs=1 count=64 2>/dev/null | sha256sum | fold -w 40 | head -n 1)
case $CFG_CLOUDDBTYPE in
"mysql")
if [ $CFG_CLOUDDBHOST == "localhost" ]; then
mariadb -u $dbruser -p$CFG_MYSQL_ROOT_PWD -e "CREATE DATABASE $CFG_CLOUDDBNAME" > /dev/null 2>&1
#mysql -u $dbruser -p$CFG_MYSQL_ROOT_PWD -e "CREATE DATABASE $CFG_CLOUDDBNAME CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci" > /dev/null 2>&1
mariadb -u $dbruser -p$CFG_MYSQL_ROOT_PWD -e "USE $CFG_CLOUDDBNAME" > /dev/null 2>&1
mariadb -u $dbruser -p$CFG_MYSQL_ROOT_PWD -e "GRANT ALL PRIVILEGES ON $CFG_CLOUDDBNAME.* TO '$CFG_CLOUDDBUSER'@'localhost' IDENTIFIED BY '$CFG_CLOUDDBPWD'" > /dev/null 2>&1
mysql -u $dbruser -p$CFG_MYSQL_ROOT_PWD -e "flush privileges;" > /dev/null 2>&1
else
mysql -u $dbruser -p$CFG_MYSQL_ROOT_PWD -h $CFG_CLOUDDBHOST -e "CREATE DATABASE $CFG_CLOUDDBNAME" > /dev/null 2>&1
mysql -u $dbruser -p$CFG_MYSQL_ROOT_PWD -h $CFG_CLOUDDBHOST -e "USE $CFG_CLOUDDBNAME" > /dev/null 2>&1
mysql -u $dbruser -p$CFG_MYSQL_ROOT_PWD -h $CFG_CLOUDDBHOST -e "GRANT ALL PRIVILEGES ON $CFG_CLOUDDBNAME.* TO '$CFG_CLOUDDBUSER'@'%' IDENTIFIED BY '$CFG_CLOUDDBPWD'" > /dev/null 2>&1
mysql -u $dbruser -p$CFG_MYSQL_ROOT_PWD -e "flush privileges;" > /dev/null 2>&1
fi
# Enable UTF8mb4 (4-byte support)
#databases=$(mysql -u root -p"$CFG_MYSQL_ROOT_PWD" -e "SHOW DATABASES;" | tr -d "| " | grep -v Database)
#for db in $databases; do
# if [[ "$db" != "performance_schema" ]] && [[ "$db" != _* ]] && [[ "$db" != "information_schema" ]];
# then
# echo "Changing to UTF8mb4 on: $db"
# mysql -u root -p"$CFG_MYSQL_ROOT_PWD" -e "ALTER DATABASE $db CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
# fi
#done
# Repair and set Nextcloud config values
#mysqlcheck -u root -p"$CFG_MYSQL_ROOT_PWD" --auto-repair --optimize --all-databases
#sudo -u www-data "$STORAGE_ROOT"/owncloud/occ config:system:set mysql.utf8mb4 --type boolean --value="true"
#sudo -u www-data "$STORAGE_ROOT"/owncloud/occ maintenance:repair
sudo -u www-data php8.2 "$CLOUD_DIR"/occ maintenance:install \
--database "mysql" \
--database-name "$CFG_CLOUDDBNAME" \
--database-user "$CFG_CLOUDDBUSER" \
--database-pass "$CFG_CLOUDDBPWD" \
--database-host="$CFG_CLOUDDBHOST" \
--database-port="3306" \
--admin-user "$CFG_CLOUDADMINUSER" \
--admin-pass "$CFG_CLOUDADMINPWD" \
--data-dir "$STORAGE_ROOT/nextcloud" \
--admin-email "cloud@$CFG_HOSTNAME_DOMAIN" \
--instanceid "$instanceid"
# Set SMTP mail
#sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtpmode --value="smtp"
# Set logrotate
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set log_rotate_size --value="10485760"
# Added trusted domains
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set trusted_domains 1 --value=$IP_ADDRESS
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set trusted_domains 2 --value=cloud.$CFG_HOSTNAME_DOMAIN
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set memcache.local --value '\OC\Memcache\APCu'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_from_address --value 'cloud_administrator'
TIMEZONE=$(cat /etc/timezone)
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set logtimezone --value=$TIMEZONE
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set logdateformat --value 'Y-m-d H:i:s'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_domain --value=$CFG_HOSTNAME_DOMAIN
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set overwrite.cli.url --value 'https://$CFG_HOSTNAME_DOMAIN/cloud'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set log_type --value 'syslog'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set syslog_tag --value 'Nextcloud'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set system_addressbook_exposed --value 'no'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtpmode --value 'sendmail'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtpauth --type boolean --value true
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtphost --value '127.0.0.1'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtpport --value '587'
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtpsecure --value ''
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtpname --value ''
sudo -u www-data php "$CLOUD_DIR"/occ config:system:set mail_smtppassword --value ''
CONFIG_FILE="$CLOUD_DIR/config/config.php"
if ! grep -q "'config_is_read_only'" "$CONFIG_FILE"; then
sed -i "/);/i \$CONFIG['config_is_read_only'] = false;" "$CONFIG_FILE"
fi
if ! grep -q "'user_backends'" "$CONFIG_FILE"; then
sed -i "/);/i \$CONFIG['user_backends'] = array(\n array(\n 'class' => '\\\\OCA\\\\UserExternal\\\\IMAP',\n 'arguments' => array(\n '127.0.0.1', 143, null, null, false, false\n ),\n ),\n);" "$CONFIG_FILE"
fi
chown www-data.www-data $CLOUD_DIR/config.php
# Enable/disable apps. Note that this must be done after the Nextcloud setup.
# The firstrunwizard gave Josh all sorts of problems, so disabling that.
# user_external is what allows Nextcloud to use IMAP for login. The contacts
# and calendar apps are the extensions we really care about here.
hide_output sudo -u www-data php8.2 $CLOUD_DIR/console.php app:disable firstrunwizard
hide_output sudo -u www-data php8.2 $CLOUD_DIR/console.php app:enable user_external
hide_output sudo -u www-data php8.2 $CLOUD_DIR/console.php app:enable contacts
hide_output sudo -u www-data php8.2 $CLOUD_DIR/console.php app:enable calendar
# When upgrading, run the upgrade script again now that apps are enabled. It seems like
# the first upgrade at the top won't work because apps may be disabled during upgrade?
# Check for success (0=ok, 3=no upgrade needed).
sudo -u www-data php8.2 $CLOUD_DIR/occ upgrade
E=$?
if [ $E -ne 0 ] && [ $E -ne 3 ]; then exit 1; fi
# Disable default apps that are not needed
sudo -u www-data php8.2 $CLOUD_DIR/occ app:disable photos dashboard activity weather_status logreader | (grep -v "No such app enabled" || /bin/true)
# Install additional apps
(sudo -u www-data php8.2 $CLOUD_DIR/occ app:install notes) || true
hide_output sudo -u www-data php8.2 $CLOUD_DIR/console.php app:enable notes
(sudo -u www-data php8.2 $CLOUD_DIR/occ app:install twofactor_totp) || true
hide_output sudo -u www-data php8.2 $CLOUD_DIR/console.php app:enable twofactor_totp
# Upgrade all apps
sudo -u www-data php $CLOUD_DIR/occ app:update --all
echo
echo "Nextcloud version:"
sudo -u www-data php8.2 "$CLOUD_DIR"/occ status
sleep 3
echo
;;
"sqlite")
# Setup Nextcloud if the Nextcloud database does not yet exist. Running setup when
# the database does exist wipes the database and user data.
if [ ! -f $STORAGE_ROOT/owncloud/owncloud.db ]; then
# Create user data directory
#mkdir -p $STORAGE_ROOT/owncloud
# Set permissions
#chown -R www-data.www-data $STORAGE_ROOT/owncloud $STORAGE_ROOT/owncloud
# Execute Nextcloud's setup step, which creates the Nextcloud sqlite database.
# It also wipes it if it exists. And it updates config.php with database
# settings and deletes the autoconfig.php file.
# (cd $STORAGE_ROOT/owncloud; sudo -u www-data php $STORAGE_ROOT/owncloud/index.php;)
fi
# Migrate users_external data from <0.6.0 to version 3.0.0
# (see https://github.com/nextcloud/user_external).
# This version was probably in use in Mail-in-a-Box v0.41 (February 26, 2019) and earlier.
# We moved to v0.6.3 in 193763f8. Ignore errors - maybe there are duplicated users with the
# correct backend already.
sqlite3 "$STORAGE_ROOT/owncloud/owncloud.db" "UPDATE oc_users_external SET backend='127.0.0.1';" || /bin/true
;;
esac
# Set PHP FPM values to support large file uploads
# (semicolon is the comment character in this file, hashes produce deprecation warnings)
#sed -i "s/upload_max_filesize =.*/upload_max_filesize = 16G/g" /etc/php/8.2/fpm/php.ini
sed -i "s/upload_max_filesize =.*/upload_max_filesize = 1G/g" /etc/php/8.2/fpm/php.ini
#sed -i "s/post_max_size =.*/post_max_size = 16G/g" /etc/php/8.2/fpm/php.ini
sed -i "s/post_max_size =.*/post_max_size = 1G/g" /etc/php/8.2/fpm/php.ini
sed -i "s/output_buffering =.*/output_buffering = 16384/g" /etc/php/8.2/fpm/php.ini
sed -i "s/memory_limit =.*/memory_limit = 512M/g" /etc/php/8.2/fpm/php.ini
sed -i "s/max_execution_time =.*/max_execution_time = 600/g" /etc/php/8.2/fpm/php.ini
sed -i "s/short_open_tag =.*/short_open_tag = On/g" /etc/php/8.2/fpm/php.ini
#management/editconf.py /etc/php/8.2/fpm/php.ini -c ';' \
# upload_max_filesize=16G \
# post_max_size=16G \
# output_buffering=16384 \
# memory_limit=512M \
# max_execution_time=600 \
# short_open_tag=On
# Set Nextcloud recommended opcache settings
#if grep -q opcache.enable=0 /etc/php/7.3/mods-available/apcu.ini; then
# sed -i "s/;opcache.enable=.*/opcache.enable=1/g" /etc/php/7.3/fpm/php.ini
#fi
sed -i "s/;opcache.enable.*/opcache.enable=1/g" /etc/php/8.2/cli/conf.d/10-opcache.ini
sed -i "s/;opcache.enable_cli.*/opcache.enable_cli=1/g" /etc/php/8.2/cli/conf.d/10-opcache.ini
sed -i "s/;opcache.interned_strings_buffer.*/opcache.interned_strings_buffer=16/g" /etc/php/8.2/cli/conf.d/10-opcache.ini
sed -i "s/max_accelerated_files=.*/max_accelerated_files=10000/g" /etc/php/8.2/cli/conf.d/10-opcache.ini
sed -i "s/opcache.memory_consumption=.*/opcache.memory_consumption=128/g" /etc/php/8.2/cli/conf.d/10-opcache.ini
sed -i "s/;opcache.save_comments=.*/opcache.save_comments=1/g" /etc/php/8.2/cli/conf.d/10-opcache.ini
sed -i "s/opcache.revalidate_freq=.*/opcache.revalidate_freq=1/g" /etc/php/8.2/cli/conf.d/10-opcache.ini
#management/editconf.py /etc/php/8.2/cli/conf.d/10-opcache.ini -c ';' \
# opcache.enable=1 \
# opcache.enable_cli=1 \
# opcache.interned_strings_buffer=16 \
# opcache.max_accelerated_files=10000 \
# opcache.memory_consumption=128 \
# opcache.save_comments=1 \
# opcache.revalidate_freq=1
# Configure the path environment for php-fpm
sed -i '/env\[PATH/s/;//g' /etc/php/8.2/fpm/pool.d/www.conf
# If apc is explicitly disabled we need to enable it
#if grep -q apc.enabled=0 /etc/php/8.2/mods-available/apcu.ini; then
#if grep -q apc.enabled=1 /etc/php/8.2/mods-available/apcu.ini; then
# echo "apc.enabled=1" >> /etc/php/8.2/mods-available/apcu.ini
#fi
# Set up a general cron job for Nextcloud.
# Also add another job for Calendar updates, per advice in the Nextcloud docs
# https://docs.nextcloud.com/server/24/admin_manual/groupware/calendar.html#background-jobs
cat > /etc/cron.d/cron-nextcloud << EOF;
#!/bin/bash
# Wolftronics server setup script
*/5 * * * * root sudo -u www-data php8.2 -f $CLOUD_DIR/cron.php
*/5 * * * * root sudo -u www-data php8.2 -f $CLOUD_DIR/occ dav:send-event-reminders
EOF
chmod +x /etc/cron.d/cron-nextcloud
# We also need to change the sending mode from background-job to occ
# Or else the reminders will just be sent as soon as possible when the background jobs run
hide_output sudo -u www-data php8.2 -f $CLOUD_DIR/occ config:app:set dav sendEventRemindersMode --value occ
# Run the maintenance command
hide_output sudo -u www-data php8.2 $CLOUD_DIR/occ maintenance:repair --include-expensive
# Set the config to read-only
sed -i'' "s/'config_is_read_only'\s*=>\s*false/'config_is_read_only' => true/" "$STORAGE_ROOT/owncloud/config.php"
# Create nextcloud log in /var/log
hide_output install -m 644 conf/rsyslog/20-nextcloud.conf /etc/rsyslog.d/
# There's nothing much of interest that a user could do as an admin for Nextcloud,
# and there's a lot they could mess up, so we don't make any users admins of Nextcloud.
# But if we wanted to, we would do this:
# ```
# for user in $(management/cli.py user admins); do
# sqlite3 $STORAGE_ROOT/owncloud/owncloud.db "INSERT OR IGNORE INTO oc_group_user VALUES ('admin', '$user')"
# done
# ```
# Enable PHP modules and restart PHP.
restart_service php8.2-fpm
#echo -n "Configuring Redis Cache for nextCloud..."
#hide_output add-apt-repository -y ppa:chris-lea/redis-server
#hide_output apt-get update
#apt_get_quiet upgrade
#apt_install redis-server
#systemctl restart apache2
#systemctl restart nginx
#phpenmod redis
#hide_output systemctl start redis-server
#hide_output systemctl enable redis-server
#apt_install php-redis
#cat >> $STORAGE_ROOT/owncloud/config/config.php <<EOF
#'memcache.distributed' => '\OC\Memcache\Redis',
#'memcache.local' => '\OC\Memcache\Redis',
#'memcache.locking' => '\OC\Memcache\Redis',
#'redis' => array(
# 'host' => 'localhost',
# 'port' => 6379,
# ),
#EOF
}
#---------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment