Deploy to Deno Deploy

You can deploy SilverBullet to Deno Deploy for free, and store space content in Deno KV. This is a convenient option to deploy SilverBullet in the cloud, without having to run or pay for a server.

Note: this setup is highly experimental, rarely used and may break at any time. We recommend using another deployment method.

Steps

Sign up for a (free) Deno Deploy account and “Create an empty project” there.

Jump to the “Settings”, give your project a nicer name, and configure the following environment variables:

  • SB_FOLDER: db://
  • SB_PORT: 8000
  • SB_SYNC_ONLY: 1 (Deno Deploy does not currently support Workers, so running indexing etc. on the server will not work)
  • SB_USER: (e.g. pete:letmein) — this is super important otherwise your space will be open to anybody without any authentication
  • SB_AUTH_TOKEN: (Optional) If you would like to migrate existing content from elsewhere (e.g. a local folder) using [[Sync]], you will want to configure an authentication token here (pick something secure).

Make sure you have installed Deno locally on your machine.

Then, install deployctl via:

$ deno install -gArf jsr:@deno/deployctl

To deploy, run:

$ deployctl deploy -p=your-project --entrypoint=https://edge.silverbullet.md/silverbullet.js --include= --prod

This will ask you to authenticate with your Deno Deploy account, and then deploy SilverBullet.

Migrating and backing up content

This setup stores your space in Deno’s KV database, which is still a beta feature and not specifically designed for this purpose. Therefore it’s recommended to use something like Sync to make backups elsewhere.

For this, be sure to also configure a SB_AUTH_TOKEN variable.

1 Like

tansk for this guide

but after trying to deploy with

$ deployctl deploy -p=your-project --entrypoint=https://silverbullet.md/silverbullet.js --include= --prod

silverbullet.js 404’s

Error The deployment failed: HTTP status client error (404 Not Found) for url (https://silverbullet.md/silverbullet.js)

Right, the URL changed, updated in the original post.

I don’t know the details about SBs internals, but sketch my vision, correct me, if I’m wrong:

deno.dev allows you to sync with any github repo. So you can fork any version of silverbullet and could run directly deploy it (without installing anything at all).

You can upgrade your mirror anytime, so you decide when to upgrade.

Only missing part is the single entrypoint of the project for deno deploy.

Yes, SB requires a build step (to build the plugs, Frontend and bundle them up in a single JS file) if that can somehow be automated as part of the Deno deploy process you don’t need to do a local checkout. Theoretically this should be doable perhaps with the help of GitHub actions somehow.

A new setting popped up when deploying github projects on deno. It might help.

Is there a way to make this work with Git Sync? I managed to complete the setup for a friend and we got a working password-protected instance, but without a backup server that I would know better, it feels too risky to use seriously.

No. Deno deploy will likely never support running shell commands.

What you could do is use silverbullet sync to sync files with a folder elsewhere and run git from there. Not sure that’s actually helpful though.

You may want to look at fly.io. I think will be possible to run there (if you limit it to just one container). Will take some fiddling, but I think I managed to at some point in the past.

And if you get that to work, be sure to post it in Guides :wink:

That is helpful, I was hoping to find asome solution like that, thanks!

1 Like

Is running SilverBullet on Deno Deploy a popular option? What’s the experience like?

I ask because I’ve been trying to deploy it; I was struggling and then got a somewhat working version but there was a lot of lag. I am new to both Deno Deploy and Silver Bullet so want to ask if this is a well trodden path and if the end result - Silver Bullet on Deno Deploy - is a sensible thing to work towards.

I don’t think it’s popular. I consider it experimental and limited. It only supports sync mode, and you cannot use it with tools like git etc.

I’d rather go with hosting it on your own server, or otherwise try something like Deploy SilverBullet to fly.io

1 Like

Thanks for the advice; I appreciate it.