504 Gateway Time-out - Reddit installation on Ubuntu 14.04

October 11, 2016 65 views
Networking Ubuntu


A few months ago I set up a 0.5gb droplet to get a small project of mine online. This was based off Reddit's open source software, and installed by simply running a script on Ubuntu 14.04 (https://github.com/reddit/reddit/wiki/reddit-install-script-for-Ubuntu). I had to give it a 4gb swap and increase swappiness to 90, but it worked. Now I'm trying the same (and with a 1gb droplet this time), but all I get is 504 gateway time-out errors. Absolutely nothing else. The favicon loads, but that's it. The script said the installation was a success (and it works when I ran it on a VM), all of Reddit's dependencies seem to be working, but I keep getting 504 errors (for 2 days now).

I have a 4gb swap with 90 swappiness, and this is just frustrating given that it worked a few months ago but won't now. Before running the script, I also installed apache2 and made sure that worked, but sadly that's all that did. Is there anything else I can do (other than trying a 2gb+ droplet)?

My droplet's ip:

1 Answer
ryanpq MOD October 11, 2016
Accepted Answer

Since it's been a while since I've played with Reddit's open source code I took a few minutes to try and duplicate this problem on a droplet of my own. I was not able to duplicate it but I have an idea of the cause of the issue. You mentioned having installed apache2 before running the install-reddit.sh script. My guess is that this prevented things from being configured properly.

Here are the steps I took to get a reddit install running:

1.) Created a new droplet (I used an 8GB droplet as recommended. A smaller one with swap should work just as well for testing but I would not recommend it for production).

2.) Created a user 'reddit'

adduser reddit

3.) Added that user to sudoers

adduser reddit sudo

4.) Switched to the new user, changed to their home directory and downloaded the script

cd /home/reddit/;
su reddit;
wget https://raw.github.com/reddit/reddit/master/install-reddit.sh;

5.) Then I ran the script with sudo, as the reddit user.

sudo ./install-reddit.sh

Once the script completed, I created an entry in the /etc/hosts file on my local computer (on Windows this file is in C:\Windows\system32\drivers\etc\ while on Linux/Mac it is /etc/hosts. The entry I created pointed the name reddit.local to my droplet's IP address. Then I could browse to reddit.local and see:

So, I would recommend doing a rebuild of your droplet with a fresh install of Ubuntu 14.04 and re-try the installation.

  • Thank you for your answer. I forgot to mention that I tried to configure a 1gb droplet 3 separate times, and it was only on the third time that I installed apache (and disabled it before running the script, otherwise it messes with haproxy) to make sure at least something worked. I also edited /etc/hosts to make sure the droplet's ip pointed to reddit.local. I guess it's a hardware issue and I'll just need a bigger droplet, which again, is sad considering ~3 months ago I got this working on a 5 dollar droplet. Oh well.

Have another answer? Share your knowledge.