1
0

Added ngrok deployment option

This commit is contained in:
Zef Hemel 2023-11-10 10:57:57 +01:00
parent d58db6aa1a
commit 69ef37a170
5 changed files with 60 additions and 20 deletions

View File

@ -36,7 +36,7 @@ export function PageNavigator({
orderId: orderId,
});
}
let completePrefix: string | undefined = undefined;
let completePrefix = currentPage + "/";
if (currentPage && currentPage.includes("/")) {
const pieces = currentPage.split("/");
completePrefix = pieces.slice(0, pieces.length - 1).join("/") + "/";

View File

@ -1,5 +1,4 @@
# SilverBullet deployment examples
Below you'll find **user examples** on how to deploy SilverBullet using different alternatives.
**NOTE**: paths, usernames and passwords are just examples and should be updated to your own personal environment

View File

@ -0,0 +1,19 @@
The most straightforward way to add TLS on top of SilverBulet is to use use [Caddy](https://caddyserver.com/). Caddy can automatically provision an SSL certificate for you.
When youre deploying on a public server accessible to the Internet, you can do this as follows:
```shell
$ sudo caddy reverse-proxy --to :3000 --from yourdomain.com:443
```
If youre deploying on a local network and access your server via a VPN, this is a bit more tricky. The recommended setup here is to use [Tailscale](https://tailscale.com/) which now [supports TLS certificates for your VPN servers](https://tailscale.com/kb/1153/enabling-https/). Once you have this enabled, get a certificate via:
```shell
$ tailscale cert yourserver.yourtsdomain.ts.net
```
Caddy can automatically find these certificates once provisioned, so you can just run:
```shell
$ sudo caddy reverse-proxy --to :3000 --from yourserver.yourtsdomain.ts.net:443
```

View File

@ -0,0 +1,35 @@
If you would like to expose your local SilverBullet instance running on your laptop to the wider Internet (so you can access it from other machines, or even outside your home) using [ngrok](https://ngrok.com/) is a simple and free solution.
**Note:** this will require you to keep the machine youre running SilverBullet **switched on at all times** (or at least when you want access to SB). When you shut it down (or clause the lid), SilverBullet will become inaccessible (unless you use the sync [[Client Modes|client mode]] of course, but then content will only sync when the machine is on).
## Setup
Generally this setup involves a few steps:
1. [[Install]] and run SilverBullet either via Deno or Docker on your local machine
2. Sign up, install and launch [ngrok](https://ngrok.com/) to expose the local port to the Internet
3. Profit
It is **absolutely key** to enable [[Authentication]] on SilverBullet, otherwise anybody who can guess the URL ngrok gives you, and view and edit your files at will (or worse).
So generally the steps are to run SilverBullet (e.g. via Deno) (see [[Install]] for more options) — note the port here (`3000`):
```bash
$ silverbullet -p 3000 --user mysuser:mypassword path/to/space
```
Then, create a free [ngrok](https://dashboard.ngrok.com/) account, and follow the instructions to download the ngrok client for your platform, and authenticate it (look for the `ngrok config add-authtoken` command).
Then, in another terminal run `ngrok`:
```bash
$ ngrok http 3000
```
This will give you a `https://xxx.ngrok-free.app` style URL you can open in your browser.
Note that this URL changes every time, which is inconvenient. Therefore its **recommended you create a domain** as well (you get 1 for free). Follow the [instructions on the domains page](https://dashboard.ngrok.com/cloud-edge/domains) in the ngrok dashboard on how to do this. Once you created your domain, you can launch `ngrok` as follows:
```bash
$ ngrok http --domain=your-domain.ngrok-free.app 3000
```
Enjoy!

View File

@ -89,27 +89,14 @@ To upgrade, simply pull the latest docker image and start the new container.
docker pull zefhemel/silverbullet
```
## Running SilverBullet on your network/Internet
## Exposing SilverBullet to your network/Internet
$tls
For SilverBullet to be offline capable (loadable without a network connection) it needs to be accessed either via `localhost` or via TLS (a `https://`) URL. The most straightforward way to do this is by using [Caddy](https://caddyserver.com/). Caddy can automatically provision an SSL certificate for you.
Running SilverBullet on your machine is cool, but you likely want to access it from elsewhere as well (other machines on your network, your mobile device), perhaps even from outside your home. For this you either need to use a VPN, or expose SB to the public Internet. In either scenario, be sure to use [[Authentication]].
When youre deploying on a public server accessible to the Internet, you can do this as follows:
To expose your SilverBullet instance to the Internet, you have a few options:
```shell
$ sudo caddy reverse-proxy --to :3000 --from yourdomain.com:443
```
If youre deploying on a local network and access your server via a VPN, this is a bit more tricky. The recommended setup here is to use [Tailscale](https://tailscale.com/) which now [supports TLS certificates for your VPN servers](https://tailscale.com/kb/1153/enabling-https/). Once you have this enabled, get a certificate via:
```shell
$ tailscale cert yourserver.yourtsdomain.ts.net
```
Caddy can automatically find these certificates once provisioned, so you can just run:
```shell
$ sudo caddy reverse-proxy --to :3000 --from yourserver.yourtsdomain.ts.net:443
```
* [[Deployments/ngrok]]: the easiest solution to exposing your _locally running_ SilverBullet to the Internet
* [[Deployments/Caddy]]: the easiest solution to expose SilverBullet running on a publicly accessible server to the Internet (but local network as well using Tailscale)
If you access SilverBullet via plain HTTP (outside of localhost) everything _should_ still mostly work, except offline mode.