Deploy SilverBullet to fly.io

Fly.io is a nice and simple to use (and probably) cheap option of hosting SilverBullet “in the cloud” yourself, exposing it to the Internet (with username and password). You don’t have to manage a full server and the process of setting it up is pretty straight forward.

Requirements

A fly.io account. I think you have to sign up with a credit card. Since we’ll configure your fly.io app to automatically stop when not in use (after a few minutes), cost of running SilverBullet should be low or possibly even free (I’ve seen claims that fly.io won’t charge you if your monthly bill is < $5). No promises, though. Please report your experiences when you deploy SilverBullet this way.

Setup

On your local machine, create an empty folder with a single file in it: fly.toml:

# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
swap_size_mb = 512

[build]
# Replace edge with a specific release, e.g. 0.9.0
# To upgrade, update the version number and run 'fly deploy' again
image = 'zefhemel/silverbullet:edge'

[deploy]
strategy = 'immediate'

[[mounts]]
# Volume to store your space
source = 'space_data'
destination = '/space'
initial_size = '1gb'

[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = 'stop'
auto_start_machines = true
min_machines_running = 0

[[vm]]
# 512mb is the recommended minimum
memory = '512mb'
cpu_kind = 'shared'
cpus = 1

Install the fly CLI, then launch the app. The first time you’ll have to authenticate your account.

fly launch

This will ask if you would like to “copy its configuration to the new app?” Say yes.

Tweak the suggested (random) app name if you like, this will become part of your deployed URL.

This will give you a running SilverBullet with no authentication. So let’s set a username and password immediately (replace user with your prefered username and letmein with something more secure).

fly secrets set SB_USER=user:letmein

After a while, you’ll be asked for your username and password.

That’s all.

Upgrading

You will have to manually upgrade your SilverBullet instance as follows:

In your fly.toml change the tag of your docker image to a specific version number, e.g. zefhemel/silverbullet:0.9.0, and then when it’s released update to zefhemel/silverbullet:0.9.1. Save your changes and run:

fly deploy

After a little while (watch server logs as described below to see progress), your upgraded SilverBullet will come back up.

Monitor server logs

fly logs

SSH into your machine

fly ssh console

Enjoy!

1 Like

It is highly recommended that you do something like this right after: Backup your space to Github