Zach Alberico

Urbit In The Cloud

June 6, 2020

What is this guide?

The goal of this guide is to have clear and easy to follow best practices for deploying your urbit to a server you control in the cloud. This guide uses Digital Ocean as the cloud provider because DO focuses on this kind of use case (individual devs running something for themselves) and it's what I personally use.

Most Urbit users start out running their ship on their laptop in order to play with it, but this means when your laptop is offline your urbit is offline too (and can't get updates or keep hosting a group). You can also only access your urbit from that one laptop. In order to access your urbit from anywhere and any device, you need it running on a computer that's always online and accessible from your other devices. The way to do this is hosting it somewhere.

If you want a hosted urbit, but don't want to manage it yourself you can sign up for hosting on tlon.network. If you want to host your urbit on a spare computer that's always online on your home network check out Native Planet and their software that makes this easy (using tailscale is another option for this approach). For everyone else, running on Digital Ocean is a good option and this guide wil help you do that.

This guide assumes you're running macOS or linux on your local machine.

Create a Digital Ocean droplet

Getting your own domain

Your own domain will make accessing your urbit a lot easier (it'll also allow you to secure things with a Let's Encrypt cert). Domains are relatively inexpensive and since this guide is about best practices I'm making it a required step.

There are a lot of domain name registrars you can use, this guide suggests gandi.net because that's the one I use. From there you can search for and register a domain that you like.

Configuring your domain for your Digital Ocean droplet

Once you've registered your domain you'll need to configure it to use Digital Ocean for DNS. The following steps are done on the Gandi website.

Creating your non-root user

With our domain in place we're now ready to actually log into the box and start to configure the server itself.

Setting up a basic firewall

Continuing to follow the DO docs we're going to configure the ufw firewall.

Installing Nginx

Nginx is a webserver we're going to use as a reverse proxy. All incoming traffic to our Digital Ocean droplet will pass through Nginx and from there to your urbit. This allows us to lock everything else down and secure just that entry point.

Configuring Nginx

Now we're going to configure Nginx so it serves up your urbit traffic securely.

Configuring Let's Encrypt secure certificate

Now that we've got the Nginx reverse proxy installed we're going to get a Let's Encrypt SSL cert for it and configure it to automatically renew.

Note: If this fails it may be because your DNS change has not propagated which can take 12-24 hours.

Installing Urbit

Finally we're ready to install Urbit on your very own server. This part is actually pretty easy, if you haven't installed Urbit locally then the instructions are the exact same as the ones in the Urbit getting started guide. If you have a local ship already we'll send your local ship up.

Leaving your urbit running in a Screen session

Finally, to leave your urbit running after you disconnect we can leave it in a Screen session. This is just a way to leave applications running in the background and then reconnect to them later. Alternatively, the same can be done with tmux.

Links and Misc.

A lot of the above documentation comes from combining existing resources from Digital Ocean and Urbit into a single guide. The main piece here that I had to figure out myself was the specific Nginx config required to get Urbit to work properly.

Nginx is also pretty powerful and configurable. You can do things like have your urbit on an existing server under a subdomain. That kind of thing is left as an exercise for the reader.

On iOS you can save a website to your homescreen as an icon. If you do this for your urbit domain it's a little like having it as an app.