Skip to content
andrewsFL edited this page Dec 21, 2022 · 15 revisions

Common Issues. This is for people who have installed the reddit/paleocons.com code locally.

What operating systems can this run on?

This has only been tested as working with the desktop image of Ubuntu 14.04, although it should work on Ubuntu 14.04 server image. However, a newer/older version of Ubuntu, or another Debian-based distribution will likely result in errors and not work. Using a non-Debian-based distribution will not work at all unless you figure out a way to install the correct version of all of the dependencies with that distribution.

How do I set up a custom domain name?

First:

Go to where your DNS records are managed, whether that's a DNS hosting service like Cloudflare or your domain registrar's DNS hosting service. Remove any existing A records with the value @, and setup a new A record pointing the value @ to the IP address where your paleocons.com instance is being hosted.

Second:

  1. Type sudo nano /etc/hosts
  2. Remove the line stating 127.0.0.1 reddit.local if such a line is present.
  3. Add a line stating 127.0.0.1 hit TAB and then add YOURDOMAIN.TLD

Replace YOURDOMAIN.TLD with whatever your domain name is.

Third:

  1. Go to the reddit/r2 directory. You can get here by running cd $REDDIT_HOME/src/reddit/r2
  2. Type nano development.update
  3. There should be a line stating domain = reddit.local replace this with your domain name.
  4. There should also be a line stating oauth_domain = reddit.local replace this with your domain name.
  5. Click Ctrl+X and then Y.
  6. After you have completed these steps, run either make all or make ini from the r2 directory.

When I try to log in or sign up, I get a status 0 error code.

The most likely culprit for this is that your https_endpoint value is pointing to reddit.local while you are trying to access the website from a real domain name.

An easy way to verify this is the problem is to open your web browser's console and see if the login/register link being shown with the error begins with reddit.local.

If you have verified this is the problem, or at least suspect it is, fixing it is very simple. Go through the following steps.

  1. Go to the project's /r2 directory. This can be done by executing cd $REDDIT_HOME/src/reddit/r2/
  2. Type nano development.update
  3. Under [DEFAULT] add a line stating https_endpoint = YOURDOMAIN.TLD replace YOURDOMAIN.TLD with whatever your domain name is.
  4. Click Ctrl+X and then Y.
  5. Remaining in the reddit/r2 directory, type make all and wait for that process to complete.
  6. The issue should now be resolved.

When I try to log in or sign up, I get a 500 error.

This generally means that your default subreddit, the default_sr value, is not pointing to a subreddit which exists. Generally, default_sr is set to frontpage. If this is the case, either create the appropriate subreddit manually, add a default_sr = EXISTINGSUBREDDIT line to $REDDITHOME/src/reddit/r2/development.update and run make all or create a subreddit named 'frontpage.' It is shown in the install guide how to create subreddits/spaces.

Replace EXISTINGSUBREDDIT with an existing subreddit.

How do I set default subreddits? (These are the subreddits that display in the top bar, and ones users automatically are subscribed to.)

Make sure to replace name1, name2, and name3 with appropriate subreddit names. You can add more or less than 3 default subreddits as well.

  1. Type reddit-shell and then the following...
  2. from r2.models import Subreddit, LocalizedDefaultSubreddits click ENTER
  3. srs = [Subreddit._by_name(name) for name in ["name1", "name2", "name3"]] click ENTER
  4. LocalizedDefaultSubreddits.set_global_srs(srs) click ENTER
  5. Type exit() click ENTER
  6. Execute sudo start reddit-job-update_reddits

How do I add users as admins? (NOTE: This is a site-wide admin, not a subreddit-wide moderator)

  1. Run cd $REDDIT_HOME/src/reddit/r2.
  2. Type nano development.update
  3. Go to the very end of the file and hit enter a few times.
  4. Add [live_config] like how there is a section labeled as [DEFAULT]
  5. Directly below [live_config] add employees = %(system_user)s:admin, user1:admin, user2:admin

Replace user1 and user2 with the appropriate account names. Again, you may add more or less than 2 accounts.

When I type in the domain name for my website, it redirects to reddit.local.

There are two things you should do if this is the case.

First:

  1. Type sudo nano /etc/hosts
  2. Remove the line stating 127.0.0.1 reddit.local if such a line is present.
  3. Add a line stating 127.0.0.1 hit TAB and then add YOURDOMAIN.TLD

Replace YOURDOMAIN.TLD with whatever your domain name is.

Second:

  1. Go to the reddit/r2 directory. You can get here by running cd $REDDIT_HOME/src/reddit/r2
  2. Type nano development.update
  3. There should be a line stating domain = reddit.local replace this with your domain name.
  4. There should also be a line stating oauth_domain = reddit.local replace this with your domain name.
  5. After you have completed these steps, run cd $REDDIT_HOME/src/reddit/r2 and then run either make all or make ini

Why can't I log in to my website?

Make sure that you have the domain set up as a real domain name or reddit.local. http://localhost will never work for cookies and http://127.0.0.1 can have problems as well.

I've added new default subreddits, but they are not updating

Run sudo start reddit-job-update_reddits to automatically run the necessary cron job. If this doesn't work, clear cache on your web browser and also run sudo reddit-restart from your server.

The top bar is not showing at all.

By default, paleocons.com removes the html file for the top bar from the base code. This can be re-added by downloading the reddit open source project, navigating to r2/r2/templates and copying the infobar.html file over to the corresponding directory

If you've done this and it is still not showing up...

The domain value in the development.update file may not match the domain name that you're accessing your website with. If you update this, make sure to then run make all from the $REDDIT_HOME/src/reddit/r2 directory, same as any time you update a file.

I updated a file and the changes are not applying.

Run make all from the reddit/r2 directory. You can access this directory by running cd $REDDIT_HOME/src/reddit/r2

I changed the header image, and it's either not working or showing up glitchy.

For whatever reason, you have to upload your new header image under a new name in order for the changes to apply correctly. Once you've added the picture to $REDDIT_HOME/src/reddit/r2/r2/public/static then open $REDDIT_HOME/src/reddit/r2/r2/public/static/css/reddit.less, go to #header-img.default-header typically on line 269, and then modify the name of the image to match the one you just uploaded on the background-image line. Make sure not to remove the preceding ../ if you put your new header image in $REDDIT_HOME/src/reddit/r2/r2/public/static. As usual, go back to $REDDIT_HOME/src/reddit/r2 and run make all after applying these changes.

How do I populate the database with test data?

  1. cd $REDDIT_HOME/src/reddit/r2
  2. Run reddit-run scripts/inject_test_data.py -c 'inject_test_data()'

I'm Getting This Error Or A Similar One:

docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

This typically means that docker isn't running, to fix this, run the following commands

  1. systemctl enable docker
  2. systemctl start docker