Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing UNIX domain socket path for redis #192

Open
gunchleoc opened this issue May 2, 2024 · 6 comments
Open

Missing UNIX domain socket path for redis #192

gunchleoc opened this issue May 2, 2024 · 6 comments

Comments

@gunchleoc
Copy link

gunchleoc commented May 2, 2024

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

@gunchleoc
Copy link
Author

gunchleoc commented May 15, 2024

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
Copy link
Author

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
Copy link
Author

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

@trwnh
Copy link
Member

trwnh commented May 16, 2024

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
Copy link
Author

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
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants