Using Redis cache/session via UNIX Socket


#1

I’m trying to configure Gogs on a local server, and our Redis uses a UNIX socket for connections, instead of a TCP Port. We would like Gogs to use Redis for the Cache and Session stores.

Is there any way to specify this in the configuration, to get Gogs to connect via the socket?

Something like:

PROVIDER = redis
PROVIDER_CONFIG = network=socket,addr=/opt/var/redis/gogs.sock;db=0

Server is Gogs 0.9.13 on Debian 8.4, with MySQL 5.5.47 and Redis 2.8.17


#2

Hi, based on the documentation of underlying redis driver, I think you give addr a unix socket path works out of box.


#3

Hi,

For anyone looking for it, this is the right line :
PROVIDER_CONFIG = network=unix,addr=/tmp/redis.sock

Tested on FreeBSD, Gogs 0.11.53.0603

Maybe https://gogs.io/docs/advanced/configuration_cheat_sheet.html#cache-(-cache-) and https://gogs.io/docs/advanced/configuration_cheat_sheet.html#session-(-session-) could link to some documentation about this ?

Regards,