This is a simple guide on how to install SilverBullet on a Linux based environment using deno and configure it to start at boot.
Requirements:
- Deno
Deno, can be installed in many ways.
I personally prefer using cargo, the Rust package manager.
If you don’t have rust, you can follow the instructions here which requires just 1 or 2 steps:
- Run the command
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- If the above command didn’t manage to add
~/.cargo/bin
to your$PATH
environment variable, you’ll have to add it manually
You can check your $PATH
variable by running:
$ echo $PATH
Once, you have rust
and cargo
available in your environment, you can proceed to install deno
$ cargo install deno --locked
After the installation, check that ~/.deno/bin
has been added to your $PATH
environment variable
Install SilverBullet
Follow the official instructions located here
- Run the following command
$ deno install -f --name silverbullet --unstable-kv --unstable-worker-options -A https://get.silverbullet.md
silverbullet
should be installed under ~/.deno/bin/
At this stage you can test that SilverBullet is working as expected by running
(let’s assume that your space is located in ~/silverbullet
$ silverbullet ~/silverbullet
How to run at boot with systemd (–user)
NOTE Stop silverbullet
if you tested it in the previous step
NOTE: replace user
with your real username
in the commands below
-
Add
~/.local/bin
to your$PATH
environment variable -
Create
/home/user/.local/bin/silverbullet.sh
file:
#!/bin/bash
## Script to start SilverBullet through Deno
/home/user/.cargo/bin/deno run --allow-all --no-config --unstable-kv --unstable-worker-options --reload https://get.silverbullet.md /home/user/silverbullet > /home/user/silverbullet.log 2> /home/user/silverbullet.err
This script will start SilverBullet, through the systemd service we will create below.
It will also create silverbullet.log
and silverbullet.err
files in your home directory for debugging.
NOTE
If you don’t care about log files, you can remove that part of the command:
/home/user/.cargo/bin/deno run --allow-all --no-config --unstable-kv --unstable-worker-options --reload https://get.silverbullet.md /home/user/silverbullet
NOTE
If you’d like to run the edge
version instead, you can modify the command like below:
/home/user/.cargo/bin/deno run --allow-all --no-config --unstable-kv --unstable-worker-options --reload https://edge.silverbullet.md/silverbullet.js /home/user/silverbullet > /home/user/silverbullet.log 2> /home/user/silverbullet.err
NOTE
If you’d like to start your service in --sync-only
mode, you can modify the command like below:
/home/user/.cargo/bin/deno run --allow-all --no-config --unstable-kv --unstable-worker-options --reload https://get.silverbullet.md --sync-only /home/user/silverbullet > /home/user/silverbullet.log 2> /home/user/silverbullet.err
- Create
~/.config/systemd/user/silverbullet.service
file:
[Unit]
Description=SilverBullet
[Service]
Type=simple
ExecStart=/home/user/.local/bin/silverbullet.sh
[Install]
WantedBy=default.target
- Execute the following commands to enable and start the new silverbullet service
$ systemctl --user enable silverbullet.service
$ systemctl --user start silverbullet.service
At this point you can test that silverbullet
is running by going to http://localhost:3000 (or 127.0.0.1)
NOTE: sb.log and sb.err files are located in /home/user
How to upgrade SilverBullet
- First stop the silverbullet service
$ systemctl --user stop silverbullet.service
- Run the upgrade
$ silverbullet upgrade
- Re enable the service
$ systemctl --user start silverbullet.service