DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 27th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default Nextcloud Redis Config

Whenever I configure Nextcloud to use Redis caching, the server loads a white screen to http requests.

Pertinent /etc/redis/redis.conf:

Code:
# grep -E 'unixsocket|port 0' /etc/redis/redis.conf
# If port 0 is specified Redis will not listen on a TCP socket.
port 0
# unixsocket /var/run/redis/redis.sock
# unixsocketperm 770
unixsocket /var/run/redis/redis.sock
unixsocketperm 755
And /var/www/nexctloud/config/config.php:

Code:
# cat /var/www/nextcloud/config/config.php  
<?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxxxxx',
  'secret' => 'xxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'LAN',
    1 => 'domain.tld',
    2 => 'cloud.domain.tld',
  ),
  'datadirectory' => '/nextcloud/data',
  'overwrite.cli.url' => 'https://lan',
  'dbtype' => 'mysql',
  'version' => '12.0.2.0',
  'dbname' => '$DBNAME',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '$DBUSER',
  'dbpassword' => 'xxx',
  'installed' => true,
'memcache.local' => '\OC\Memcache\Redis',
'redis' => array(
     'host' => '/var/run/redis/redis.sock',
     'port' => 0,
     'timeout' => 1.5,
      ),
);
Redis is running and her log file contains no errors:

Code:
# ps -aux |grep redis
_redis   68489  0.0  0.2 13776  2200 ??  Ss    12:43AM    0:00.73 redis-server: /usr/local/sbin/redis-server 127.0.0.1:0 (redis-server)
root     18213  0.0  0.0    96   208 p0  R+/1   1:16AM    0:00.00 grep redis

Code:
# tail /var/redis/redis.log                                                                                                                                                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

68489:M 28 Feb 00:43:00.384 # Server initialized
68489:M 28 Feb 00:43:00.384 * DB loaded from disk: 0.000 seconds
68489:M 28 Feb 00:43:00.385 * The server is now ready to accept connections at /var/run/redis/redis.sock
httpd error log is lively:

Code:
# tail -f /var/www/logs/error.log  
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52

PHP message: PHP Warning:  Redis::connect(): connect() failed: No such file or directory in /nextcloud/lib/private/RedisFactory.php on line 82
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'RedisException:...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'RedisException:...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'RedisException:...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('RedisException:...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onException(Object(RedisException))
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52

PHP message: PHP Warning:  Redis::connect(): connect() failed: No such file or directory in /nextcloud/lib/private/RedisFactory.php on line 82
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'RedisException:...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'RedisException:...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'RedisException:...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('RedisException:...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onException(Object(RedisException))
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52

PHP message: PHP Warning:  Redis::connect(): connect() failed: No such file or directory in /nextcloud/lib/private/RedisFactory.php on line 82
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'RedisException:...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'RedisException:...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'RedisException:...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('RedisException:...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onException(Object(RedisException))
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52

PHP message: PHP Warning:  Redis::connect(): connect() failed: No such file or directory in /nextcloud/lib/private/RedisFactory.php on line 82
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'RedisException:...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'RedisException:...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'RedisException:...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('RedisException:...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onException(Object(RedisException))
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52

PHP message: PHP Warning:  Redis::connect(): connect() failed: No such file or directory in /nextcloud/lib/private/RedisFactory.php on line 82
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'RedisException:...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'RedisException:...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'RedisException:...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('RedisException:...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onException(Object(RedisException))
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52

PHP message: PHP Warning:  Redis::connect(): connect() failed: No such file or directory in /nextcloud/lib/private/RedisFactory.php on line 82
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'RedisException:...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'RedisException:...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'RedisException:...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('RedisException:...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onException(Object(RedisException))
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52

PHP message: PHP Warning:  Redis::connect(): connect() failed: No such file or directory in /nextcloud/lib/private/RedisFactory.php on line 82
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'RedisException:...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'RedisException:...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'RedisException:...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(81): OC\Log->critical('RedisException:...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onException(Object(RedisException))
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
PHP message: PHP Fatal error:  Uncaught exception 'RedisException' with message 'Redis server went away' in /nextcloud/lib/private/Memcache/Redis.php:52
Stack trace:
#0 /nextcloud/lib/private/Memcache/Redis.php(52): Redis->get('3ca47c2a60a81be...')
#1 /nextcloud/lib/autoloader.php(146): OC\Memcache\Redis->get('OC_User')
#2 [internal function]: OC\Autoloader->load('OC_User')
#3 /nextcloud/lib/private/Log/File.php(101): spl_autoload_call('OC_User')
#4 [internal function]: OC\Log\File::write('PHP', 'Uncaught except...', 3)
#5 /nextcloud/lib/private/Log.php(301): call_user_func(Array, 'PHP', 'Uncaught except...', 3)
#6 /nextcloud/lib/private/Log.php(159): OC\Log->log(3, 'Uncaught except...', Array)
#7 /nextcloud/lib/private/Log/ErrorHandler.php(68): OC\Log->critical('Uncaught except...', Array)
#8 [internal function]: OC\Log\ErrorHandler->onShutdown()
#9 {main}
  thrown in /nextcloud/lib/private/Memcache/Redis.php on line 52
But I'm not sure what to make of these errors.

Interestingly, Redis and Nextcloud work fine if configured to use a TCP and not a Unix socket with:

Code:
'memcache.local' => '\OC\Memcache\Redis',
'memcache.locking' => '\OC\Memcache\Redis',
'redis' => array(
     'host' => 'localhost',
     'port' => 6379,
      ),
In place of the configuration in Nextcloud's config.php file as shown above. This leads me to believe that it's something to do with httpd's chroot that is preventing Nextcloud from communicating with Redis through /var/run/redis/redis.sock but I'm not sure of the precise configuration required to enable a Redis and Nextcloud unix socket connection.

I tried, in /etc/redis/redis.conf:

Code:
unixsocket /var/www/var/run/redis/redis.sock
With concomitant reference to the unix socket at its relative[0] and absolute[1] paths in Nextcloud's config.php. But this, too, did not work.

[0]
Code:
'memcache.local' => '\OC\Memcache\Redis',
'redis' => array(
     'host' => '/var/run/redis/redis.sock',
     'port' => 0,
     'timeout' => 1.5,
      ),
[1]
Code:
'memcache.local' => '\OC\Memcache\Redis',
'redis' => array(
     'host' => '/var/www/var/run/redis/redis.sock',
     'port' => 0,
     'timeout' => 1.5,
      ),
I'm not sure where to go from here. Any ideas?

Redis and Nextcloud[2] configuration was taken from official documentation.

[2] https://docs.nextcloud.com/server/12...iguration.html

Last edited by toprank; 27th February 2018 at 04:27 PM.
Reply With Quote
  #2   (View Single Post)  
Old 27th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default

I'm thinking that Redis can't access (or, perhaps more aptly, find) the chroot'ed unix socket so I should create a link between /var/www/var/run/redis/redis.sock and /var/run/redis/redis.sock, yeah?

If so, what paths should be used in which configuration files?

I'm thinking the chroot'ed app uses the relative path in the chroot but Redis use the non-chroot'ed linked file at it's absolute path; that is, /etc/redis/redis.conf has:

Code:
unixsocket /var/run/redis/redis.sock
And /var/www/nextcloud/config/config.php has the relative chroot path:

Code:
     'host' => '/var/run/redis/redis.sock',
Which would be my original configuration except with a soft link.
Reply With Quote
  #3   (View Single Post)  
Old 28th February 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,232
Default

The two applications need to point to the same file, and have read/write permissions, typically by group. The redis.conf file must point to the "un-chrooted" actual location, the config.php file should point to the chrooted file. The php-fpm chroot is /var/www, matching the chroot of httpd(8).

The _redis user cannot create the socket in /var/www/run, that is root:daemon owned and operated. So I created a separate directory, /var/www/redis, which I set to be owned by _redis:_redis, with directory access mode set to 775 (rwxrwxr-x).

In /etc/redis/redis.conf I pointed to /var/www/redis/redis.sock, and in /var/www/nextcloud/config/config.php I pointed to the same file as /redis/redis.sock.

I was able to get them to communicate via the socket. But for some (as yet unknown to me) failure I had a permission denied error logged in the httpd error.log file. I had added www to the _redis group, but I may not have restarted enough daemons. Setting the unixsocketperm to 777 allowed them to connect. I will continue to review and find the source of the permission error I introduced.
Reply With Quote
  #4   (View Single Post)  
Old 28th February 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,232
Default

I fixed my group permission error. It was easier to change the group for _redis with chpass(1), leave /etc/group unedited, and change the ownership of the /var/www/redis directory to www:www, leaving it 775.
Code:
$ pwd ; ls -l
/var/www
total 52
drwxr-xr-x   2 root  daemon   512 Oct  3 23:13 acme
drwxr-xr-x   2 root  daemon   512 Feb 27 17:24 bin
drwx-----T   2 www   daemon   512 Oct  3 23:13 cache
drwxr-xr-x   2 root  daemon   512 Oct  3 23:13 cgi-bin
drwxr-xr-x   3 root  daemon   512 Feb 27 17:24 conf
drwxr-xr-x   2 root  daemon   512 Feb 27 18:02 etc
drwxr-xr-x   4 root  daemon   512 Feb 27 17:40 htdocs
drwxr-xr-x   2 root  daemon   512 Feb 27 21:08 logs
drwxr-xr-x  15 root  daemon  1024 Feb 27 21:24 nextcloud
drwxrwxr-x   2 www   www      512 Feb 27 21:31 redis
drwxr-xr-x   2 root  daemon   512 Feb 27 21:26 run
drwx-----T   2 www   www     1024 Feb 27 21:31 tmp
drwxr-xr-x   5 root  daemon   512 Feb 27 17:26 usr
The socket file is _redis:www, permission 770:
Code:
$ ls -l redis/
total 0
srwxrwx---  1 _redis  www  0 Feb 27 21:31 redis.sock
Here is a diff of my redis.conf against the example:
Code:
$  diff -u /usr/local/share/examples/redis/redis.conf /etc/redis/redis.conf                                                                           
--- /usr/local/share/examples/redis/redis.conf  Mon Oct  2 15:15:46 2017
+++ /etc/redis/redis.conf       Tue Feb 27 21:23:14 2018
@@ -106,8 +106,8 @@
 # incoming connections. There is no default, so Redis will not listen
 # on a unix socket when not specified.
 #
-# unixsocket /var/run/redis/redis.sock
-# unixsocketperm 770
+ unixsocket /var/www/redis/redis.sock
+ unixsocketperm 770
 
 # Close the connection after a client is idle for N seconds (0 to disable)
 timeout 0

Last edited by jggimi; 28th February 2018 at 03:34 AM. Reason: typo
Reply With Quote
  #5   (View Single Post)  
Old 28th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default

Thanks, jggimi.

So, to clarify, your final working setup:

- change _redis GID to www with chpass
- mkdir /var/www/redis and chown www:www with chmod 0775
- point Nextcloud to /redis/redis.sock (relative path in chroot)
- point Redis to /var/www/redis/redis.sock (absolute path within chroot)
- rcctl restart redis php56_fpm httpd
- and let Redis create redis.sock with mode 0770
Reply With Quote
  #6   (View Single Post)  
Old 28th February 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,232
Default

Correct. But I used the example redis.conf as my base, as your smaller configuration in this thread didn't work on the test system (6.2-release, amd64, in a vmm(4) virtual machine). Redis would timeout when starting rather than start correctly.

I'll keep the virtual machine's disk drive for a day or two in the event additional questions arise.
Reply With Quote
  #7   (View Single Post)  
Old 28th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default

Okay, cool. Thanks, jggimi.

Did you happen to set port 0 in redis.conf too?

Code:
# If port 0 is specified Redis will not listen on a TCP socket.
port 0
Reply With Quote
  #8   (View Single Post)  
Old 28th February 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,232
Default

Yes, I ran two tests, one with your configuration above (which included the port 0 directive), and the configuration I diffed.
Reply With Quote
  #9   (View Single Post)  
Old 28th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default

And the configuration with port 0 set timed out? So the only successful config was with just unixsocket and unixsocketperm set?

Code:
unixsocket /var/www/redis/redis.sock
unixsocketperm 770
Reply With Quote
Old 28th February 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,232
Default

No. I used the included example, and changed two lines. If I remove all commented and blank lines from the file, THIS was my redis.conf:
Code:
bind 127.0.0.1
protected-mode yes
port 6379
tcp-backlog 511
 unixsocket /var/www/redis/redis.sock
 unixsocketperm 770
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/redis/redis_6379.pid
loglevel notice
syslog-enabled yes
syslog-ident redis
syslog-facility daemon
databases 16
always-show-logo yes
save 900 1
save 300 10
save 60 10000
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename dump.rdb
dir /var/redis
slave-serve-stale-data yes
slave-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-disable-tcp-nodelay no
slave-priority 100
maxclients 96
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
slave-lazy-flush no
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble no
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit slave 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
aof-rewrite-incremental-fsync yes
Reply With Quote
Old 28th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default

I only ask because I have a successful configuration with the only changes to the default redis.conf being:

Code:
unixsocket /var/www/redis/redis.sock
unixsocketperm 770
And /var/www/nextcloud/config/config.php with:

Code:
 <?php
$CONFIG = array (
  'instanceid' => 'xxx',
  'passwordsalt' => 'xxxxxx',
  'secret' => 'xxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'LAN',
    1 => 'domain.tld',
    2 => 'cloud.domain.tld',
  ),
  'datadirectory' => '/nextcloud/data',
  'overwrite.cli.url' => 'https://lan',
  'dbtype' => 'mysql',
  'version' => '12.0.2.0',
  'dbname' => '$DBNAME',
  'dbhost' => 'localhost:3306',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '$DBUSER',
  'dbpassword' => 'xxx',
  'installed' => true,
'memcache.local' => '\OC\Memcache\Redis',
'redis' => array(
     'host' => '/redis/redis.sock',
     'port' => 0,
     'timeout' => 1.5,
      ),
);

But ps shows Redis listening on port 6379:

Code:
# ps -aux |grep redis
_redis   33261  0.0  0.3 14296  2720 ??  Ss    10:11PM    0:01.05 redis-server: /usr/local/sbin/redis-server 127.0.0.1:6379 (redis-server)
root     15955  0.0  0.0   116   252 p0  R+/1  10:35PM    0:00.00 grep redis
However, the unix socket file exists (and was created by Redis) and Nextcloud config explicitly sets connection via unix socket so the connection must not be TCP, yeah?

Code:
# ls -l /var/www/redis/                                                                                                                                                                          
total 0
srwxrwx---  1 _redis  www  0 Feb 28 22:11 redis.sock

Last edited by toprank; 9th March 2018 at 01:47 PM.
Reply With Quote
Old 28th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default

Quote:
Originally Posted by jggimi View Post
No. I used the included example, and changed two lines. If I remove all commented and blank lines from the file, THIS was my redis.conf:
Sorry. That's what I meant: the only user changes from the default redis.conf being the unixsocket and unixsocket perm and all else remaining as default (including port setting).
Reply With Quote
Old 28th February 2018
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 6,232
Default

Under my successful test, it would be listening on that port for additional connections. I have not gone back to try to debug the configuration that was not working for me.

Keep in mind, my goal was to get a successful redis execution in order to test a functioning Unix socket connection in a test lab. Nextcloud was the system-under-test, with Redis being an adjunct connection.
Reply With Quote
Old 28th February 2018
toprank toprank is offline
Fdisk Soldier
 
Join Date: Feb 2018
Posts: 52
Default

Okay, well, I can confirm it works either way. I just set port 0 in redis.conf then restart Redis and we still have an accessible Nextcloud.

So thanks, jggimi, you've been a great help!
Reply With Quote
Reply

Tags
httpd, nextcloud, php, redis

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
www/nextcloud and httpd.conf subdomain config toprank OpenBSD Packages and Ports 31 2nd March 2018 10:50 AM
Redis 2.6 "is near" and now feature frozen J65nko News 0 29th February 2012 04:09 AM
Redis 2.4.0 (and 2.4.1) finally released J65nko News 0 17th October 2011 01:28 PM
Final version of optimised Redis released J65nko News 0 23rd February 2011 12:08 PM
VMware hires key Redis developer J65nko News 0 16th March 2010 11:19 PM


All times are GMT. The time now is 03:26 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick