pixelfed / support

Issue tracker for installations of Pixelfed, before a bug is identified.
https://docs.pixelfed.org/running-pixelfed/troubleshooting.html
8 stars 3 forks source link

Missing UNIX domain socket path for redis #192

Open gunchleoc opened 6 months ago

gunchleoc commented 6 months ago

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

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 https://github.com/pixelfed/docs/issues/121#issuecomment-1782338134 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 https://github.com/pixelfed/docs/issues/121#issuecomment-1782338144 did not fix this.

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

gunchleoc commented 6 months ago

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()
gunchleoc commented 6 months ago

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

gunchleoc commented 6 months ago

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

trwnh commented 6 months ago

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

gunchleoc commented 6 months ago

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.

sorcer1122 commented 3 days ago

Also faced with this issue during clean install. Switched to default nginx user and Redis tcp and it worked.