This post is not relevant anymore. Gab has permanently removed (and will not be re-enabling) Federation in any capacity, so there's no point to even considering running your own Gab Social-based site.


These instructions cover the complete process, “all batteries included”, as I executed this on a VPS.

First, install Docker+Compose.

Then, grab the Gab source code and build it:

  • git clone -b develop https://code.gab.com/gab/social/gab-social.git
    (No; they do not have a stable branch…or versioned tags…)
  • pushd gab-social
  • cp -v .env.production.sample .env.production
  • Edit docker-compose.yml
    • add the following to the end of the db section:
          environment:
            - POSTGRES_HOST_AUTH_METHOD=trust
  • time docker-compose build

This last step took a little under an hour on the 2-core VPS I'm renting, so (unless you're not cheaping out) you'll want to take a break.

Also, mine died in Step 10/37; I ended up having to reboot the system before it'd work again and complete. (I'm not sure whether this was a problem with Docker, the Dockerfile, or just my hosting provider's images.)

You can punch the holes in your firewall while you're waiting:

  • systemctl start firewalld && systemctl enable firewalld
  • firewall-cmd --permanent --add-service=http --add-service=https

Then, set it up:

Install nginx:

  • dnf config-manager --add-repo http://nginx.org/packages/centos/8/$(arch)
  • echo 'gpgkey=https://nginx.org/keys/nginx_signing.key' >> /etc/yum.repos.d/nginx*.repo
  • dnf install nginx && systemctl enable nginx

Configure a proxying site:

  • mkdir -v /etc/nginx/sites-{enabled,available}
  • echo 'include sites-enabled/*;' >> /etc/nginx/conf.d/sites.conf
  • pushd /etc/nginx/sites-available
  • Edit (create) text file gabsocial
  • Paste this monster into it
  • Find-and-replace "example.com" and put in your web domain
    (in Nano, that's Ctrl_W, Ctrl_R)
  • Change the root values to something like /var/www/null (don't remove the semicolon at the end!)
  • Save-and-quit
  • ln -vs ../sites-available/gabsocial ../sites-enabled/
  • popd

Set up a TLS certificate (if you know what you're doing, obviously you can replace this part with what you're doing):

  • dnf install epel-release && dnf install letsencrypt
  • letsencrypt certonly -d example.com --standalone

Set the whole mess up:

  • sed -i s_/mnt/md0/assets_/var/gabsocial/assets_ docker-compose.yml
  • mkdir -vp /var/gabsocial/assets && chmod -Rv 991:991 /var/gabsocial/assets
  • sed 's/^\(SECRET_KEY_BASE=\).*$/\1'$(docker-compose run --rm web bundle exec rake secret)/ -i .env.production
  • sed 's/^\(OTP_SECRET=\).*$/\1'$(docker-compose run --rm web bundle exec rake secret)/ -i .env.production
  • /var/gabsocial/assets
  • docker-compose run --rm web bundle exec rails gabsocial:setup
  • Accept the defaults for everything except the domain and mail settings
    • I don't know what to tell you about the mail settings other than the fact that "send mail from localhost" and "don't send a test e-mail" are your best bet if you don't have an e-mail server
  • Replace ${local_domain} with your actual local domain, and run:
    sed 's/^\(LOCAL_DOMAIN=\).*$/\1'${local_domain}/ -i .env.production

    • If and only if you are running a separate WEB_DOMAIN, likewise run:
      sed 's/^#? ?\(WEB_DOMAIN=\).*$/\1'${web_domain}/ -i .env.production

And, finally, start it:

  • systemctl start nginx
  • docker-compose up -d

Leave a Reply

Your email address will not be published. Required fields are marked *

Warning: This site uses Akismet to filter spam. Until or unless I can find a suitable replacement anti-spam solution, this means that (per their indemnification document) all commenters' IP addresses will be sent to Automattic, Inc., who may choose to share such with 3rd parties.
If this is unacceptable to you, I highly recommend using an anonymous proxy or public Wi-Fi connection when commenting.