added redis

This commit is contained in:
nachoparker 2017-11-06 19:55:44 +01:00
parent 9fbdb3e357
commit 7e2abc9133
5 changed files with 83 additions and 20 deletions

View File

@ -1,7 +1,11 @@
[v0.32.7](https://github.com/nextcloud/nextcloudpi/commit/ae1c47a) (2017-11-09) nc-notify-updates: fixes
[v0.34.0](https://github.com/nextcloud/nextcloudpi/commit/d2f8ce2) (2017-11-06) added redis
[v0.32.6](https://github.com/nextcloud/nextcloudpi/commit/455cb73) (2017-11-08) noip: manage many interfaces and fix return value
[v0.33.0](https://github.com/nextcloud/nextcloudpi/commit/c3b35e1) (2017-11-07) added NCP custom theme with new logo
[v0.32.7 ](https://github.com/nextcloud/nextcloudpi/commit/555d86b) (2017-11-09) nc-notify-updates: fixes
[v0.32.6 ](https://github.com/nextcloud/nextcloudpi/commit/455cb73) (2017-11-08) noip: manage many interfaces and fix return value
[v0.32.5 ](https://github.com/nextcloud/nextcloudpi/commit/3147047) (2017-11-08) update: wait running apt processes

View File

@ -67,8 +67,19 @@ EOF
# cron jobs
sudo -u www-data php occ background:cron
# ACPu cache
sed -i '$i\ \ '\''memcache.local'\'' => '\''\\\\OC\\\\Memcache\\\\APCu'\'',' /var/www/nextcloud/config/config.php
# redis cache
sed -i '$d' config/config.php
cat >> config/config.php <<'EOF'
'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' =>
array (
'host' => '/var/run/redis/redis.sock',
'port' => 0,
'timeout' => 0.0,
),
);
EOF
# 4 Byte UTF8 support
sudo -u www-data php occ config:system:set mysql.utf8mb4 --type boolean --value="true"

View File

@ -19,6 +19,7 @@ MAXFILESIZE_=2G
MEMORYLIMIT_=768M
MAXTRANSFERTIME_=3600
DBADMIN=ncadmin
REDIS_MEM=3gb
DESCRIPTION="Install any NextCloud version"
APTINSTALL="apt-get install -y --no-install-recommends"
@ -42,11 +43,25 @@ install()
apt-get update
$APTINSTALL -o "Dpkg::Options::=--force-confold" php-smbclient
$APTINSTALL postfix lbzip2 iputils-ping
# REDIS
$APTINSTALL redis-server php7.0-redis
local REDIS_CONF=/etc/redis/redis.conf
sed -i "s|# unixsocket.*|unixsocket /var/run/redis/redis.sock|" $REDIS_CONF
sed -i "s|# unixsocketperm.*|unixsocketperm 777|" $REDIS_CONF
sed -i "s|port.*|port 0|" $REDIS_CONF
echo "maxmemory ${REDIS_MEM}" >> $REDIS_CONF
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
sudo usermod -a -G redis www-data
systemctl enable redis-server
}
configure()
{
ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; return 1; }
ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; return 1; }
## RE-CREATE DATABASE TABLE
echo "Starting mariaDB"

13
lamp.sh
View File

@ -32,7 +32,7 @@ install()
$APTINSTALL apt-utils
$APTINSTALL cron
$APTINSTALL apache2
$APTINSTALL php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip php7.0-APC php7.0-fileinfo php7.0-mcrypt
$APTINSTALL php7.0 php7.0-curl php7.0-gd php7.0-fpm php7.0-cli php7.0-opcache php7.0-mbstring php7.0-xml php7.0-zip php7.0-fileinfo php7.0-mcrypt
mkdir -p /run/php
# Randomize mariaDB password
@ -74,17 +74,6 @@ EOF
# CONFIGURE PHP7
##########################################
cat > /etc/php/7.0/mods-available/apcu.ini <<EOF
extension=apcu.so
apc.enable_cli=0
apc.shm_size=256M
apc.ttl=7200
apc.gc_ttl=3600
apc.entries_hint=4096
apc.slam_defense=1
apc.serializer=igbinary
EOF
cat > /etc/php/7.0/mods-available/opcache.ini <<EOF
zend_extension=opcache.so
opcache.enable=1

View File

@ -230,10 +230,54 @@ EOF
grep -q TimeOut /etc/apache2/sites-enabled/ncp.conf || \
sed -i '/SSLCertificateKeyFile/aTimeOut 172800' /etc/apache2/sites-enabled/ncp.conf
# relocate noip2 config
mkdir -p /usr/local/etc/noip2
# relocate noip2 config
mkdir -p /usr/local/etc/noip2
# fix unattended
# redis
grep -q APCu /var/www/nextcloud/config/config.php && {
echo "installing redis..."
apt-get update
apt-get install -y --no-install-recommends redis-server php7.0-redis
sed -i '/memcache/d' /var/www/nextcloud/config/config.php
sed -i '$d' /var/www/nextcloud/config/config.php
cat >> /var/www/nextcloud/config/config.php <<'EOF'
'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' =>
array (
'host' => '/var/run/redis/redis.sock',
'port' => 0,
'timeout' => 0.0,
),
);
EOF
REDIS_CONF=/etc/redis/redis.conf
REDIS_MEM=3gb
sed -i "s|# unixsocket.*|unixsocket /var/run/redis/redis.sock|" $REDIS_CONF
sed -i "s|# unixsocketperm.*|unixsocketperm 777|" $REDIS_CONF
sed -i "s|port.*|port 0|" $REDIS_CONF
echo "maxmemory ${REDIS_MEM}" >> $REDIS_CONF
echo 'vm.overcommit_memory = 1' >> /etc/sysctl.conf
sudo usermod -a -G redis www-data
systemctl restart redis-server
systemctl enable redis-server
# need to restart php
bash -c " sleep 3
systemctl stop php7.0-fpm
systemctl stop mysqld
sleep 0.5
systemctl start php7.0-fpm
systemctl start mysqld
" &>/dev/null &
}
# fix unattended
NUSER=$( grep USER_ /usr/local/etc/nextcloudpi-config.d/nc-notify-updates.sh | head -1 | cut -f2 -d= )
cat > /usr/local/bin/ncp-notify-unattended-upgrade <<EOF
#!/bin/bash