var page = require('../../page.part') var com = require('../../com.part') module.exports = () => page({ title: 'Create a Pub', section: 'docs', tab: 'docs-config', path :'/docs/config/create-a-pub.html', content: `

1. Get a public server

Pub servers need a static, publicly-reachable IP address. The easiest way to get a public server is by renting a virtual server from businesses such as Amazon, Linode, or Digital Ocean.

After renting the server, follow the guides provided by your host to configure the software and install nodejs. We recommend using a common Linux distribution, such as Ubuntu.

2. Install Scuttlebot

Install Scuttlebot using NPM.

${ com.code({ bash: `npm install -g ssb-server` }) }

To update scuttlebot in the future, simply run the global install again.

3. Configure Scuttlebot

${ com.code({ bash: ` EXTERNAL=<hostname.yourdomain.tld> mkdir -p ~/.ssb cat > ~/.ssb/config <<EOF { "connections": { "incoming": { "net": [ { "scope": "public", "host": "0.0.0.0", "external": ["$EXTERNAL"], "transform": "shs", "port": 8008 } ] }, "outgoing": { "net": [ { "transform": "shs" } ] } } } ` }) }

4. Create a run-sbotserver.sh script

Save the following script somewhere easy to find, such as ~/run-sbotserver.sh. This script will help ensure uptime, even if scuttlebot experiences a crash:

${ com.code({ bash: ` #!/bin/bash while true; do ssb-server start --host {your-hostname} done ` }) }

Be sure to replace {your-hostname} with the actual hostname of your server For instance, if your server is foobar.com, then you should enter ssb-server start --host foobar.com.

5. Run the server script

Use a session-manager such as screen or tmux to create a detachable session. Start the session and run the script:

${ com.code({ bash: `sh ~/run-sbotserver.sh` }) }

Then, detach the session.

6. Confirm Scuttlebot server is running

To check if the server is running, use the following command:

${ com.code({ bash: `sbot whoami` }) }

If all is well, your Pub's ID will be logged to the console. If this fails, check that the server-script is still active, and isn't failing during startup.

7. Create the Pub's profile

It's a good idea to give your Pub a name, by publishing one on its feed. To do this, first get the Pub's ID, with sbot whoami. Then, publish a name with the following command:

${ com.code({ bash: `sbot publish --type about --about {pub-id} --name {name}` }) }

It's a good idea to use your Pub's hostname. Also, don't use spaces, or include the @ symbol. Here's an example usage (dont copy this!):

${ com.code({ bash: `sbot publish --type about \\ --about "@2mIg4e/GO...GEHoQp3U=.ed25519" \\ --name "foobar.com"` }) }

8. Create invites

For a last step, you should create invite codes, which you can send to other users to let them join the pub. The command to create an invite code is:

${ com.code({ bash: `sbot invite.create 1` }) }

This may now be given out to friends, to command your pub to follow them. If you want to let a single code be used more than once, you can provide a number larger than 1.

9. Backup your data directory (optional)

It's a good idea to regularly backup the Pub's data directory, in case of failures. The data-directory will include the Pub's keypair, messages, and files. It can be found at ~/.ssb, where ~ points to the home directory of the user running Scuttlebot.

Message types: Post

` })