# Redis Unix Socket, Ubuntu Install

**URL:** https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732
**Category:** Self-hosting
**Tags:** unsupported-install
**Created:** [November 30, 2020, 1:11pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732 "2020-11-30T13:11:27Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![jieiku](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jieiku/32/201699_2.png) [@jieiku](https://meta.discourse.org/u/jieiku)
#### Post date: [November 30, 2020, 1:11pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/1 "2020-11-30T13:11:28Z")

</div>

I am trying to install Discourse, I configured my db, redis, and smtp. For the Postgresql DB it had no problem with the unix socket, but for redis it seems to be complaining.

redis settings:

```
sudo sed -i 's/^# unixsocket /unixsocket /' /etc/redis/redis.conf
sudo sed -i 's/^# unixsocketp.*/unixsocketperm 770/' /etc/redis/redis.conf
sudo sed -i 's/^# maxmemory <bytes>/maxmemory 1024mb/' /etc/redis/redis.conf
sudo sed -i 's/^# maxmemory-policy noeviction/maxmemory-policy allkeys-lru/' /etc/redis/redis.conf
sudo cat /etc/redis/redis.conf | grep "^maxmemory\|^unixsocket"

```

configure redis socket:  
`nano /var/www/discourse/config/discourse.conf`  
`redis_host = "/var/run/redis/redis-server.sock"`

During Discourse Install:

`RAILS_ENV=production /root/.rbenv/versions/2.7.2/bin/bundle exec rake db:migrate`

```
Failed to report error: Error connecting to Redis on localhost:///var/run/redis/redis-server.sock:6379 (SocketError) 2 Error connecting to Redis on localhost:///var/run/redis/redis-server.sock:6379 (SocketError
) subscribe failed, reconnecting in 1 second. Call stack ["/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:362:in `rescue in establish_connection'", "/var/www/discourse/vendor/b
undle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:343:in `establish_connection'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:107:in `block in connect'", "/var/www/disc
ourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:308:in `with_reconnect'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:106:in `connect'", "/var/www/disco
urse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:289:in `with_socket_timeout'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:139:in `call_loop'", "/var/www
/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/subscribe.rb:44:in `subscription'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/subscribe.rb:14:in `subscribe'", "/var/
www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:3506:in `_subscription'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:2326:in `block in subscribe'", "/var/www
/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:69:in `block in synchronize'", "/root/.rbenv/versions/2.7.2/lib/ruby/2.7.0/monitor.rb:202:in `synchronize'", "/root/.rbenv/versions/2.7.2/lib/ru
by/2.7.0/monitor.rb:202:in `mon_synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:69:in `synchronize'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/
redis.rb:2325:in `subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/message_bus-3.3.1/lib/message_bus/backends/redis.rb:287:in `global_subscribe'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems
/message_bus-3.3.1/lib/message_bus.rb:754:in `global_subscribe_thread'", "/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/message_bus-3.3.1/lib/message_bus.rb:702:in `block in new_subscriber_thread'"]
rake aborted!
Redis::CannotConnectError: Error connecting to Redis on localhost:///var/run/redis/redis-server.sock:6379 (SocketError)
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:362:in `rescue in establish_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:343:in `establish_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:107:in `block in connect'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:308:in `with_reconnect'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:106:in `connect'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:381:in `ensure_connected'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:233:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:320:in `logging'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:232:in `process'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis/client.rb:126:in `call'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:557:in `block in del'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:69:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:69:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/redis-4.2.1/lib/redis.rb:556:in `del'
/var/www/discourse/lib/discourse_redis.rb:81:in `block in del'
/var/www/discourse/lib/discourse_redis.rb:29:in `ignore_readonly'
/var/www/discourse/lib/discourse_redis.rb:79:in `del'
/var/www/discourse/lib/cache.rb:73:in `delete'

```

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 30, 2020, 2:46pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/2 "2020-11-30T14:46:03Z")

</div>

If you want to install Discourse for production you should use the [Discourse official Standard Installation](https://meta.discourse.org/t/discourse-official-standard-installation/142537). If you want to install a development environment, there are topics for each os.

---

<div class="post-metadata">

### Author: ![jieiku](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jieiku/32/201699_2.png) [@jieiku](https://meta.discourse.org/u/jieiku)
#### Post date: [November 30, 2020, 3:15pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/3 "2020-11-30T15:15:51Z")

</div>

Thank you for the reply.

Just to clarify, I am completely up and running and everything working, but I had to set redis host to “localhost” because connecting to redis via unix socket would not work.

I followed this guide: [Install Discourse Forum on Ubuntu 18.04 Without Docker](https://www.linuxbabe.com/ubuntu/install-discourse-ubuntu-18-04-server-without-docker)  
because the guide is somewhat dated I did have to make a couple adjustments here and there, but I am very familiar with Linux so I was able to work through it just fine.

My install is on a Proxmox LXC container running Ubuntu 20.04

I don’t find many references online about using Redis via UnixSocket, I am wondering if that might be somewhat new for redis, I did find a link but it appears they are using docker and I am not so its not directly applicable: [Discourse PR for redis.socketed.template.yml - Discourse System Administration - Unix Linux Community](https://community.unix.com/t/discourse-pr-for-redis-socketed-template-yml/378771)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 30, 2020, 6:18pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/4 "2020-11-30T18:18:28Z")

</div>

> [@jieiku](#):
>
> it appears they are using docker and I am not

Then you’ll mostly be on your own, as only the [Discourse official Standard Installation](https://meta.discourse.org/t/discourse-official-standard-installation/142537) is supported here.

I think that it’ll be rather difficult to install or maintain a production instance that does not use Docker. There are a number of tricky bits with the interaction between nginx and Discourse that will be complicated to maintain withtout the docker container that they provide, but anything’s possible, I suppose.

---

<div class="post-metadata">

### Author: ![jieiku](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jieiku/32/201699_2.png) [@jieiku](https://meta.discourse.org/u/jieiku)
#### Post date: [November 30, 2020, 6:21pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/5 "2020-11-30T18:21:34Z")

</div>

yes, luckily they provide a sample nginx config

`/var/www/discourse/config/nginx.sample.conf`

From what I am reading not even the docker image supports redis through unix socket yet.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 30, 2020, 6:54pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/6 "2020-11-30T18:54:44Z")

</div>

That’s not likely to change. If the current template doesn’t support using a socket than that means CDCK doesn’t use a redis socket in their hosting or their supported docker installation.

I’m not sure what problem you’re solving by not using the supported `./launcher` & `docker` configuration, but you’re likely going to find a bunch of other issues as well.

---

<div class="post-metadata">

### Author: ![jieiku](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jieiku/32/201699_2.png) [@jieiku](https://meta.discourse.org/u/jieiku)
#### Post date: [November 30, 2020, 7:10pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/7 "2020-11-30T19:10:55Z")

</div>

I am not sure if you have ever used Proxmox, but in my opinion it is Fantastic! I can log into the web interface and with a single click create a backup, I can then make changes and if something goes wrong I just select the backup and click restore.

Then on top of that you get much better performance from an LXC container than you will from a docker image, there is no comparison.

I am not saying docker is bad because as you have pointed out it makes it VERY easy to get setup.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 30, 2020, 8:40pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/8 "2020-11-30T20:40:48Z")

</div>

> [@jieiku](#):
>
> I am not sure if you have ever used Proxmox, but in my opinion it is Fantastic!

I bet for the things you’ve used it for it’s been great!

> [@jieiku](#):
>
> you get much better performance from an LXC container than you will from a docker image, there is no comparison

I’m pretty sure that people have made that comparison and that 100-1000X as many images are running on Docker than on LXC (which I did use, once upon a time).

> [@jieiku](#):
>
> I am not saying docker is bad because as you have pointed out it makes it VERY easy to get setup.

I’m not saying that Proxmox is bad, but if you want Discourse to be easy to set up and maintain, you’ll use Docker. For a frame of reference, if you were to ask for help on #Marketplace with a budget of under $1,000 I wouldn’t respond.

---

<div class="post-metadata">

### Author: ![jieiku](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jieiku/32/201699_2.png) [@jieiku](https://meta.discourse.org/u/jieiku)
#### Post date: [November 30, 2020, 9:01pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/9 "2020-11-30T21:01:33Z")

</div>

The point of the thread was to ask about the current status of Redis Unix Socket. Not to debate if LXC or docker is better suited for Discourse. I only mentioned why I was not using Docker because you seemed like you might be curious about it. For the average person docker will win every time, because its simple. That is also the reason that for the longest time so many applications used mysql instead of postgresql. But I absolutely love postgresql.

Until I run into some kind of devastating problems I will definitely be sticking with LXC, it just performs great! Also I couldn’t agree more that if you think you might need external support that you should probably stick with whatever the recommended defaults are. I myself have 20 different services all in their own LXC containers, running in a single Proxmox node, and they are all running great, and that is just a single Node in a Proxmox Cluster. Automated backups, Monitoring, Migration between Nodes in the cluster, these are all great things 🙂

Did I mention that my install went smoothly? So far I love Discourse, other than having to use localhost for redis instead of unix socket I had zero issues, will try and remember to post back in a few months to let you know if that is still the case 😉

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 30, 2020, 10:08pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/10 "2020-11-30T22:08:02Z")

</div>

> [@jieiku](#):
>
> Did I mention that my install went smoothly?

Ha! NO! Awesome! Glad you got it worked out! It sounds like if you’re willing to live with localhost for redis you’ll be trouble free going forward.

---

<div class="post-metadata">

### Author: ![MichaIng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaing/32/251089_2.png) [@MichaIng](https://meta.discourse.org/u/MichaIng)
#### Post date: [November 29, 2022, 6:05pm UTC](https://meta.discourse.org/t/redis-unix-socket-ubuntu-install/171732/11 "2022-11-29T18:05:45Z")

</div>

I guess it’s `usermod -aG redis discourse` or alternatively `unixsocketperm 777` so that unicorn has permissions to access the socket. Also assure that the directory where the socket is to be created exists and has `redis` user as owner. However, the common systemd-service based `redis-server` package on Ubuntu assures that.
