some updates to code.
This commit is contained in:
parent
89adf2251e
commit
0560d10b41
|
@ -5,11 +5,11 @@ sysrc -f /etc/rc.conf nginx_enable="YES"
|
||||||
sysrc -f /etc/rc.conf mysql_enable="YES"
|
sysrc -f /etc/rc.conf mysql_enable="YES"
|
||||||
sysrc -f /etc/rc.conf php_fpm_enable="YES"
|
sysrc -f /etc/rc.conf php_fpm_enable="YES"
|
||||||
|
|
||||||
# Install fresh nextcloud.conf if user hasn't upgraded
|
# Install fresh wordpress.conf if user hasn't upgraded
|
||||||
CPCONFIG=0
|
CPCONFIG=0
|
||||||
if [ -e "/usr/local/etc/nginx/conf.d/nextcloud.conf" ] ; then
|
if [ -e "/usr/local/etc/nginx/conf.d/wordpress.conf" ] ; then
|
||||||
# Confirm the config doesn't have user-changes. Update if not
|
# Confirm the config doesn't have user-changes. Update if not
|
||||||
if [ "$(md5 -q /usr/local/etc/nginx/conf.d/nextcloud.conf)" = "$(cat /usr/local/etc/nginx/conf.d/nextcloud.conf.checksum)" ] ; then
|
if [ "$(md5 -q /usr/local/etc/nginx/conf.d/wordpress.conf)" = "$(cat /usr/local/etc/nginx/conf.d/wordpress.conf.checksum)" ] ; then
|
||||||
CPCONFIG=1
|
CPCONFIG=1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
@ -18,26 +18,26 @@ fi
|
||||||
|
|
||||||
# Copy over the nginx config template
|
# Copy over the nginx config template
|
||||||
if [ "$CPCONFIG" = "1" ] ; then
|
if [ "$CPCONFIG" = "1" ] ; then
|
||||||
cp /usr/local/etc/nginx/conf.d/nextcloud.conf.template /usr/local/etc/nginx/conf.d/nextcloud.conf
|
cp /usr/local/etc/nginx/conf.d/wordpress.conf.template /usr/local/etc/nginx/conf.d/wordpress.conf
|
||||||
md5 -q /usr/local/etc/nginx/conf.d/nextcloud.conf > /usr/local/etc/nginx/conf.d/nextcloud.conf.checksum
|
md5 -q /usr/local/etc/nginx/conf.d/wordpress.conf > /usr/local/etc/nginx/conf.d/wordpress.conf.checksum
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
|
cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini
|
||||||
# Modify opcache settings in php.ini according to Nextcloud documentation (remove comment and set recommended value)
|
# Modify opcache settings in php.ini according to Wordpress documentation (remove comment and set recommended value)
|
||||||
# https://docs.nextcloud.com/server/15/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
|
# https://docs.nextcloud.com/server/15/admin_manual/configuration_server/server_tuning.html#enable-php-opcache
|
||||||
sed -i '' 's/.*opcache.enable=.*/opcache.enable=1/' /usr/local/etc/php.ini
|
sed -i '' 's/.*opcache.enable=.*/opcache.enable=1/' /usr/local/etc/php.ini
|
||||||
sed -i '' 's/.*opcache.enable_cli=.*/opcache.enable_cli=1/' /usr/local/etc/php.ini
|
sed -i '' 's/.*opcache.enable_cli=.*/opcache.enable_cli=1/' /usr/local/etc/php.ini
|
||||||
sed -i '' 's/.*opcache.interned_strings_buffer=.*/opcache.interned_strings_buffer=8/' /usr/local/etc/php.ini
|
sed -i '' 's/.*opcache.interned_strings_buffer=.*/opcache.interned_strings_buffer=8/' /usr/local/etc/php.ini
|
||||||
sed -i '' 's/.*opcache.max_accelerated_files=.*/opcache.max_accelerated_files=10000/' /usr/local/etc/php.ini
|
sed -i '' 's/.*opcache.max_accelerated_files=.*/opcache.max_accelerated_files=4000/' /usr/local/etc/php.ini
|
||||||
sed -i '' 's/.*opcache.memory_consumption=.*/opcache.memory_consumption=128/' /usr/local/etc/php.ini
|
sed -i '' 's/.*opcache.memory_consumption=.*/opcache.memory_consumption=128/' /usr/local/etc/php.ini
|
||||||
sed -i '' 's/.*opcache.save_comments=.*/opcache.save_comments=1/' /usr/local/etc/php.ini
|
sed -i '' 's/.*opcache.save_comments=.*/opcache.save_comments=1/' /usr/local/etc/php.ini
|
||||||
sed -i '' 's/.*opcache.revalidate_freq=.*/opcache.revalidate_freq=1/' /usr/local/etc/php.ini
|
sed -i '' 's/.*opcache.revalidate_freq=.*/opcache.revalidate_freq=60/' /usr/local/etc/php.ini
|
||||||
# recommended value of 512MB for php memory limit (avoid warning when running occ)
|
# recommended value of 512MB for php memory limit (avoid warning when running occ)
|
||||||
sed -i '' 's/.*memory_limit.*/memory_limit=512M/' /usr/local/etc/php.ini
|
sed -i '' 's/.*memory_limit.*/memory_limit=512M/' /usr/local/etc/php.ini
|
||||||
# recommended value of 10 (instead of 5) to avoid timeout
|
# recommended value of 10 (instead of 5) to avoid timeout
|
||||||
sed -i '' 's/.*pm.max_children.*/pm.max_children=10/' /usr/local/etc/php-fpm.d/nextcloud.conf
|
sed -i '' 's/.*pm.max_children.*/pm.max_children=10/' /usr/local/etc/php-fpm.d/wordpress.conf
|
||||||
# Nextcloud wants PATH environment variable set.
|
# Nextcloud wants PATH environment variable set.
|
||||||
echo "env[PATH] = $PATH" >> /usr/local/etc/php-fpm.d/nextcloud.conf
|
echo "env[PATH] = $PATH" >> /usr/local/etc/php-fpm.d/wordpress.conf
|
||||||
|
|
||||||
# Start the service
|
# Start the service
|
||||||
service nginx start 2>/dev/null
|
service nginx start 2>/dev/null
|
||||||
|
@ -46,18 +46,18 @@ service mysql-server start 2>/dev/null
|
||||||
|
|
||||||
#https://docs.nextcloud.com/server/13/admin_manual/installation/installation_wizard.html do not use the same name for user and db
|
#https://docs.nextcloud.com/server/13/admin_manual/installation/installation_wizard.html do not use the same name for user and db
|
||||||
USER="dbadmin"
|
USER="dbadmin"
|
||||||
DB="nextcloud"
|
DB="wordpress"
|
||||||
NCUSER="ncadmin"
|
WPUSER="wpadmin"
|
||||||
|
|
||||||
# Save the config values
|
# Save the config values
|
||||||
echo "$DB" > /root/dbname
|
echo "$DB" > /root/dbname
|
||||||
echo "$USER" > /root/dbuser
|
echo "$USER" > /root/dbuser
|
||||||
echo "$NCUSER" > /root/ncuser
|
echo "$WPUSER" > /root/wpuser
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1 > /root/dbpassword
|
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1 > /root/dbpassword
|
||||||
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1 > /root/ncpassword
|
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 16 | head -n 1 > /root/wppassword
|
||||||
PASS=`cat /root/dbpassword`
|
PASS=`cat /root/dbpassword`
|
||||||
NCPASS=`cat /root/ncpassword`
|
WPPASS=`cat /root/wppassword`
|
||||||
|
|
||||||
if [ -e "/root/.mysql_secret" ] ; then
|
if [ -e "/root/.mysql_secret" ] ; then
|
||||||
# Mysql > 57 sets a default PW on root
|
# Mysql > 57 sets a default PW on root
|
||||||
|
@ -109,19 +109,15 @@ echo alias occ ./occ.sh >> .cshrc
|
||||||
echo 'su -m www -c php\ ``/usr/local/www/nextcloud/occ\ "$*"``' > ~/occ.sh
|
echo 'su -m www -c php\ ``/usr/local/www/nextcloud/occ\ "$*"``' > ~/occ.sh
|
||||||
chmod u+x ~/occ.sh
|
chmod u+x ~/occ.sh
|
||||||
|
|
||||||
#workaround for app-pkg
|
|
||||||
sed -i '' "s|false|true|g" /usr/local/www/nextcloud/config/config.php
|
|
||||||
|
|
||||||
# create sessions tmp dir outside nextcloud installation
|
# create sessions tmp dir outside nextcloud installation
|
||||||
mkdir -p /usr/local/www/nextcloud-sessions-tmp >/dev/null 2>/dev/null
|
mkdir -p /usr/local/www/wordpress-sessions-tmp >/dev/null 2>/dev/null
|
||||||
chmod o-rwx /usr/local/www/nextcloud-sessions-tmp
|
chmod o-rwx /usr/local/www/wordpress-sessions-tmp
|
||||||
chown -R www:www /usr/local/www/nextcloud-sessions-tmp
|
chown -R www:www /usr/local/www/wordpress-sessions-tmp
|
||||||
chown -R www:www /usr/local/www/nextcloud/app-pkgs
|
|
||||||
|
|
||||||
chmod -R o-rwx /usr/local/www/nextcloud
|
chmod -R o-rwx /usr/local/www/wordpress
|
||||||
|
|
||||||
#updater needs this
|
#updater needs this
|
||||||
chown -R www:www /usr/local/www/nextcloud
|
chown -R www:www /usr/local/www/wordpress
|
||||||
|
|
||||||
#restart the services to make sure we have pick up the new permission
|
#restart the services to make sure we have pick up the new permission
|
||||||
service php-fpm restart 2>/dev/null
|
service php-fpm restart 2>/dev/null
|
||||||
|
@ -133,6 +129,6 @@ echo "Database Name: $DB" > /root/PLUGIN_INFO
|
||||||
echo "Database User: $USER" >> /root/PLUGIN_INFO
|
echo "Database User: $USER" >> /root/PLUGIN_INFO
|
||||||
echo "Database Password: $PASS" >> /root/PLUGIN_INFO
|
echo "Database Password: $PASS" >> /root/PLUGIN_INFO
|
||||||
|
|
||||||
echo "Nextcloud Admin User: $NCUSER" >> /root/PLUGIN_INFO
|
echo "Wordpress Admin User: $WPUSER" >> /root/PLUGIN_INFO
|
||||||
echo "Nextcloud Admin Password: $NCPASS" >> /root/PLUGIN_INFO
|
echo "Wordpress Admin Password: $WPPASS" >> /root/PLUGIN_INFO
|
||||||
|
|
||||||
|
|
|
@ -6,31 +6,31 @@
|
||||||
"dbname": {
|
"dbname": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "Database Name",
|
"name": "Database Name",
|
||||||
"description": "Database to use for NextCloud setup",
|
"description": "Database to use for Wordpress setup",
|
||||||
"readonly": true
|
"readonly": true
|
||||||
},
|
},
|
||||||
"dbuser": {
|
"dbuser": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "Database Username",
|
"name": "Database Username",
|
||||||
"description": "Username to use for NextCloud Database setup",
|
"description": "Username to use for Wordpress Database setup",
|
||||||
"readonly": true
|
"readonly": true
|
||||||
},
|
},
|
||||||
"dbpassword": {
|
"dbpassword": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "Database Password",
|
"name": "Database Password",
|
||||||
"description": "Password to use for NextCloud Database setup",
|
"description": "Password to use for Wordpress Database setup",
|
||||||
"readonly": true
|
"readonly": true
|
||||||
}
|
}
|
||||||
"ncuser": {
|
"ncuser": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "Nextcloud Username",
|
"name": "Nextcloud Username",
|
||||||
"description": "Username of Nextcloud administrator",
|
"description": "Username of Wordpress administrator",
|
||||||
"readonly": true
|
"readonly": true
|
||||||
},
|
},
|
||||||
"ncpassword": {
|
"ncpassword": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"name": "Nextcloud Admin Password",
|
"name": "Nextcloud Admin Password",
|
||||||
"description": "Default Nextcloud administrator password",
|
"description": "Default Wordpress administrator password",
|
||||||
"readonly": true
|
"readonly": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue