How to deploy an sbot pub (in three different configurations)

By Ev Bogue - December 16th 2016

Secure Scuttlebutt uses pubs for two purposes:

  1. Pubs are always on
  2. Pubs help local nodes punch through NAT (which is a big problem for p2p applications)

They are called pubs in the same vernacular as 'public houses' which are also known as bars. Pubs are where people get together to get sbot messages via the Internet.

sbot pub configurations

There are three different useful configurations for sbot pubs. They are:

  • sbot pub
  • sbot pub + lite client
  • sbot pub + altnet + lite client

I've deployed all three. In this article I'll explain the differences between the three, as well as how to deploy them yourself.

If you want me to deploy any one of these combinations for you, be in touch via email or on sbot.

sbot pub

Setting up an sbot pub is fairly simple. You need a VPS, you need to install Node.js, and then you need to install and run sbot.

First log into your vps

ssh you@yourvps.com

Next install scuttlebot

sudo npm install -g scuttlebot

And start sbot

sbot server

Sbot will automatically detect that it is running on a VPS and will set itself up as a pub. Next you'll need an invite from your pub to another pub to get on the network. Here's an invite to my pub:

sbot invite.accept evbogue.com:8008:@J2VKbbf69rK38vXIRLOCwaZdEm+0vzv/LMeaxmJks3k=.ed25519~o3tXeaSAGzogHRSSwqHJj2QdgSSpY2yzHt3l0fOSmr8=

Once you have a pub set up, you can generate your own invites on your command line with

sbot invite.create 1

That's it! You're running a pub now. Use Tmux to run the pub in the background on your VPS, so that you can do other things.

sbot pub + lite client

The next configuration you may want to try is an sbot pub with lite client functionality. This allows you to send one-click lite client invites such as the ones available on my website here: http://evbogue.com/100invites.

There are many ways you can build lite clients, but I suggest that you either use Micropub or my pre-built Lite Client repo.

The lite client is just a static website. All you need to do is build and serve the index.html file to the public web.

Next you need to configure your sbot pub to handle lite clients. To do this you need to install three plugins that are required by Micropub and Patchbay

sbot plugins.install ssb-ws
sbot plugins.install ssb-query
sbot plugins.install ssb-links

And restart sbot.

Next you need to configure a web server to use https, because using a lite client over http wouldn't be secure so it won't work.

I use Caddy to configure an always-on https connection with Letsencrypt.

Here's the part of my Caddyfile that I use to configure the webserver to accept websocket connections over https.

evbogue.com {
 proxy /ws :8989 {
    without /ws
  proxy /img :8989
  proxy /blobs :8989

And I serve the lite client using Caddy too. I just throw the lite client index.html into my home folder on my VPS...

ssb.gitmx.com, ssb.evbogue.com {
  root /home/ev/

Once you have the lite client served, all you have to do is generate --modern invites using your sbot pub

sbot invite.create --modern

This invite isn't quite right, so you have to edit it to


And to make a one-click invite, just tack it onto the end of your liteclient url


The above link will work (once) with only one click.

sbot pub + altnet + lite client

Another cool thing you can do with sbot is create a network that is seperate from the main network. I've done this with pub.evbogue.com

To create an sbot altnet, you need to pass a different shs cap to sbot. You can do this in your .ssb/config.

First, generate a new shs cap using your node REPL

> crypto.randomBytes(32).toString('base64')

Copy that shs key into your .ssb/config

  "caps": {
    "shs": "aqQ72Zr1QdmH17PMVDksaeLi10hYXytv59RLY/hovD4="

And when you fire up sbot again, it should be using a different network key. Keep in mind, when you're starting a new network you need to start a new database. Be sure to toast your .ssh/db folder and other associated files.

And now you're running your own social network on your own website with your own lite client! You are the master of your own distributed social destiny. Yes, it takes a little work, but I think it's worth it. And I'm sure it will get easier over time.

Xmas 2016 →

← 100 invites to Micropub

Hi! I'm Ev Bogue. I serve at a restaurant in Fayetteville, NC.

I no longer use email. Please use Decent to contact me.

about | ev@evbogue.com | gitmx