pixelfed/support

Missing UNIX domain socket path for redis

Opened this issue · 5 comments

Running the command php artisan migrate --force as root user is failing on a fresh install.

  2021_08_30_050137_add_software_column_to_instances_table ............................................................................... 10ms FAIL

   InvalidArgumentException 

  Missing UNIX domain socket path.

  at vendor/predis/predis/src/Connection/StreamConnection.php:167
    163▕      */
    164▕     protected function unixStreamInitializer(ParametersInterface $parameters)
    165▕     {
    166▕         if (!isset($parameters->path)) {
  ➜ 167▕             throw new InvalidArgumentException('Missing UNIX domain socket path.');
    168▕         }
    169▕ 
    170▕         $flags = STREAM_CLIENT_CONNECT;
    171▕ 

      +17 vendor frames 
  18  [internal]:0
      Illuminate\Support\HigherOrderCollectionProxy::Illuminate\Support\{closure}()

      +27 vendor frames 
  46  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

My setup

  • Separate pixelfed user, owns the /usr/share/webapps/ directory
  • Database created with su - pixelfed, then createdb -T template0 pixelfed
  • /etc/redis/redis.conf contains
port 0
unixsocket /run/redis/redis.sock
unixsocketperm 770
  • .env contains
REDIS_CLIENT="predis"
REDIS_SCHEME="unix"
REDIS_HOST="/run/redis/redis.sock"
REDIS_PASSWORD="null"
REDIS_PORT="0"

I also tried setting a password with redis' requirepass parameter in the redis.conf.

Looking at pixelfed/docs#121 (comment) I then tried

REDIS_CLIENT="predis"
REDIS_SCHEME="unix"
REDIS_PATH="/run/redis/redis.sock"
REDIS_PASSWORD="<pw>"
REDIS_PORT="0"

And then

REDIS_CLIENT="phpredis"
REDIS_SCHEME="unix"
REDIS_HOST="/run/redis/redis.sock"
REDIS_PASSWORD="<pw>"
REDIS_PORT="0"

which gives me a different error message:

  2021_08_30_050137_add_software_column_to_instances_table ................................................................................ 9ms FAIL

   RedisException 

  No such file or directory

  at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:159
    155▕         if (version_compare(phpversion('redis'), '5.3.0', '>=') && ! is_null($context = Arr::get($config, 'context'))) {
    156▕             $parameters[] = $context;
    157▕         }
    158▕ 
  ➜ 159▕         $client->{$persistent ? 'pconnect' : 'connect'}(...$parameters);
    160▕     }
    161▕ 
    162▕     /**
    163▕      * Create a new redis cluster instance.

      +15 vendor frames 
  16  [internal]:0
      Illuminate\Support\HigherOrderCollectionProxy::Illuminate\Support\{closure}()

      +27 vendor frames 
  44  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

The usermod suggested in pixelfed/docs#121 (comment) did not fix this.

Operating system: Debian 12 bookworm
Pixelfed version v0.12.0
PHP version 8.2.18
Redis version 7.0.15

I had overlooked that I need to sudo usermod -a -G pixelfed redis

After doing that, I'm getting this error instead:

2021_08_30_050137_add_software_column_to_instances_table ................................................................................ 8ms FAIL

   RedisException 

  No such file or directory

  at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:159
    155▕         if (version_compare(phpversion('redis'), '5.3.0', '>=') && ! is_null($context = Arr::get($config, 'context'))) {
    156▕             $parameters[] = $context;
    157▕         }
    158▕ 
  ➜ 159▕         $client->{$persistent ? 'pconnect' : 'connect'}(...$parameters);
    160▕     }
    161▕ 
    162▕     /**
    163▕      * Create a new redis cluster instance.

      +15 vendor frames 
  16  [internal]:0
      Illuminate\Support\HigherOrderCollectionProxy::Illuminate\Support\{closure}()

      +27 vendor frames 
  44  artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

Giving up on the socket and switching to tcp fixed it. It would still be nice to get this working on the socket though.

Socket /var/run/redis/redis.sock seems to work. Note the added /var at the front.

Socket /var/run/redis/redis.sock seems to work. Note the added /var at the front.

that's weird, because defining unixsocket /run/redis/redis.sock in /etc/redis/redis.conf should make it work explicitly. what's even more strange is that debian has supported the /run directory since at least 2012: https://wiki.debian.org/ReleaseGoals/RunDirectory

I ran into all kinds of weirdness during this install. Also, using a custom "pixelfed" user won't work; I had to use nginx's default user, because the generated media file directories all lack the group read permission.

So, I started from scratch and everything's finally working now.