# Live updates to a read-only instance?

**URL:** https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065
**Category:** v1: Troubleshooting (legacy)
**Created:** [September 29, 2024, 12:56am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065 "2024-09-29T00:56:52Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![bonsairobo](https://community.silverbullet.md/user_avatar/community.silverbullet.md/bonsairobo/32/644_2.png) [@bonsairobo](https://community.silverbullet.md/u/bonsairobo)
#### Post date: [September 29, 2024, 12:56am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/1 "2024-09-29T00:56:52Z")

</div>

I am wondering if it’s possible to create two instances of SB pointed at the same directory, where one instance supports edits and the other is read-only. This seems like a simple way of hosting a blog.

But I tried this and I keep getting “failed to update read-only database” errors from the read-only SB instance.

It seems that maybe each space directory can only support one SB instance at a time. Is that true?

If so, is the recommended workflow to somehow continuously replicate from one source to the read-only replica?

---

<div class="post-metadata">

### Author: ![bent0n](https://community.silverbullet.md/user_avatar/community.silverbullet.md/bent0n/32/604_2.png) [@bent0n](https://community.silverbullet.md/u/bent0n)
#### Post date: [September 29, 2024, 7:11am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/2 "2024-09-29T07:11:11Z")

</div>

I think you will have issues because the db is in the root of the space. And you need two different db for two different instances.

One solution would be to have the read-only instance in a sub-directory of your admin instance. I saw someone with a setup like this in the forum.

Other possible solutions would be to use some containers volume mapping to point different db on the host system while using the same path in both containers.

---

<div class="post-metadata">

### Author: ![SH3LLco](https://community.silverbullet.md/user_avatar/community.silverbullet.md/sh3llco/32/630_2.png) [@SH3LLco](https://community.silverbullet.md/u/SH3LLco)
#### Post date: [September 30, 2024, 10:30pm UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/3 "2024-09-30T22:30:01Z")

</div>

This is currently how im using silverbullet. You can take a look at my [blog](https://infophreak.com/hosting-silverbullet-md-read-only-admin-with-docker-digitalocean-cloudflare-and-nginx/).

However, i found some issues with the original method of accessing the admin site. You can read the issue i was having [here](https://community.silverbullet.md/t/read-only-site-not-displaying-images-in-subfolders/1026/3). Essentially, the admin side can’t be password protected. I removed the admin route in nginx and removed the environment user/pass. I then setup cloudflare tunnel access to get to the admin on localhost. I’m in the process of redoing that blog with this current admin solution.

For now, you can check out [this video](https://www.youtube.com/watch?v=_OYWOPlWFFY&t=78s) that i used to setup my admin side. [This one](https://www.youtube.com/watch?v=DZE_wGRTXOc) is good too. There are some other good videos as well that describe the same setup. I set mine up to only allow my email and authentication is through github. It’s worth mentioning that if you are running silverbullet in docker, when you setup cloudflare tunnel, do not do the docker setup for that. Install cloudflare tunnel locally on your host. It will save you hours of pulling your hair out troubleshooting the complexities of docker network routing. I did eventually find a way, but i wouldnt recommend it to others due to it being a very new feature docker has added, and im not too familiar with how well its supported.

---

<div class="post-metadata">

### Author: ![bonsairobo](https://community.silverbullet.md/user_avatar/community.silverbullet.md/bonsairobo/32/644_2.png) [@bonsairobo](https://community.silverbullet.md/u/bonsairobo)
#### Post date: [October 12, 2024, 9:18pm UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/4 "2024-10-12T21:18:27Z")

</div>

This is what I ended up doing. There’s just one issue I still need to fix.

> <https://github.com/silverbulletmd/silverbullet/issues/1112>
>
> I have both a \`SETTINGS.md\` and a \`blog/SETTINGS.md\` in my space directory so th…at I can have another read-only instance running in the \`blog/\` space directory while I edit from the writable instance.
> 
> So I also set a different \`indexPage\` in each of my settings files. This is how I noticed that my writable instance is using the \`blog/SETTINGS.md\` instead of \`SETTINGS.md\`. It sends me to the wrong index page. I confirmed this is the case because after I delete \`blog/SETTINGS.md\`, the bug goes away and I arrive at the correct index page again.

---

<div class="post-metadata">

### Author: ![SH3LLco](https://community.silverbullet.md/user_avatar/community.silverbullet.md/sh3llco/32/630_2.png) [@SH3LLco](https://community.silverbullet.md/u/SH3LLco)
#### Post date: [December 20, 2024, 10:30am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/5 "2024-12-20T10:30:06Z")

</div>

For anyone still needing help having a read only public site and private admin site that share the same data, here is my setup blog [Hosting SilverBullet.md read-only & admin with Docker, DigitalOcean, Cloudflare, and NGINX](https://infophreak.com/hosting-silverbullet-md-read-only-admin-with-docker-digitalocean-cloudflare-and-nginx)

---

<div class="post-metadata">

### Author: ![whoknew](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/w/c68b51/32.png) [@whoknew](https://community.silverbullet.md/u/whoknew)
#### Post date: [April 4, 2025, 3:00am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/6 "2025-04-04T03:00:11Z")

</div>

I have a somewhat different approach. I have a script that starts SB with 2 functions, _ro_ or _rw_. For _ro_ mode, I just set the following environment variable:

```auto
#!/usr/bin/env bash

cd /path/to/sb_docroot
env SB_READ_ONLY=true /path/to/silverbullet [options] .

```

The _rw_ function just starts SB without the ‘_env_’ part.

---

<div class="post-metadata">

### Author: ![lochel](https://community.silverbullet.md/user_avatar/community.silverbullet.md/lochel/32/912_2.png) [@lochel](https://community.silverbullet.md/u/lochel)
#### Post date: [April 25, 2025, 5:55pm UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/7 "2025-04-25T17:55:22Z")

</div>

Curious to know if this works with v2.  
Since there are no database files anymore, I imagine it might just work out of the box. Has anyone tried it?

---

<div class="post-metadata">

### Author: ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)
#### Post date: [April 26, 2025, 7:31am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/8 "2025-04-26T07:31:34Z")

</div>

Indeed, in theory it should just work.

---

<div class="post-metadata">

### Author: ![monospacedmagic](https://community.silverbullet.md/user_avatar/community.silverbullet.md/monospacedmagic/32/1342_2.png) [@monospacedmagic](https://community.silverbullet.md/u/monospacedmagic)
#### Post date: [May 14, 2025, 11:12am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/9 "2025-05-14T11:12:11Z")

</div>

If it does: Would it be feasible to (in v2) implement the ability to change the mode based on which port (or domain/URL?) is used to access Silverbullet? That way, as an example, Silverbullet could provide public read-only access at [mydomain.com](http://mydomain.com), but read-write access at [edit.mydomain.com](http://edit.mydomain.com) behind either its own authentication layer or one added by the sysadmin.

Edit: Would you prefer I turn this into its own thread?

---

<div class="post-metadata">

### Author: ![lochel](https://community.silverbullet.md/user_avatar/community.silverbullet.md/lochel/32/912_2.png) [@lochel](https://community.silverbullet.md/u/lochel)
#### Post date: [May 14, 2025, 6:22pm UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/10 "2025-05-14T18:22:34Z")

</div>

I just tested running two v2 instances in parallel for the same space: one with read-only access and one with authentication and write access. From the limited testing I did, everything seems to work perfectly. The read-only instance receives live updates as expected.

---

<div class="post-metadata">

### Author: ![monospacedmagic](https://community.silverbullet.md/user_avatar/community.silverbullet.md/monospacedmagic/32/1342_2.png) [@monospacedmagic](https://community.silverbullet.md/u/monospacedmagic)
#### Post date: [May 14, 2025, 10:14pm UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/11 "2025-05-14T22:14:53Z")

</div>

Yeah, can confirm, seems to work perfectly. Just some UI tweaks could be good, like disabling the apparent ability to rename a file (it fails if you try but yeah). I think it makes sense to move these thoughts to a new thread though so I’m going to start working on that 🙂

---

<div class="post-metadata">

### Author: ![Thaurin](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/t/dbc845/32.png) [@Thaurin](https://community.silverbullet.md/u/Thaurin)
#### Post date: [September 4, 2025, 8:35am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/12 "2025-09-04T08:35:45Z")

</div>

I would like to actually switch between read-only mode and editable mode live with a command. It would make navigating your notes much easier, especially on mobile. On mobile, each time you tap anywhere, including on links, it pops up the on-screen keyboard, taking up half the screen and making it more difficult to just read through your notes.

If I could just tap an actionButton to toggle read-only mode, it would make it so much easier.

However, I’m not sure how difficult this would be to implement and how tied to a boot the read-only mode is. The alternative would be indeed running two instances and keeping two different PWA’s on my phone, which is not ideal.

---

<div class="post-metadata">

### Author: ![Thaurin](https://community.silverbullet.md/letter_avatar_proxy/v4/letter/t/dbc845/32.png) [@Thaurin](https://community.silverbullet.md/u/Thaurin)
#### Post date: [September 4, 2025, 8:42am UTC](https://community.silverbullet.md/t/live-updates-to-a-read-only-instance/1065/13 "2025-09-04T08:42:28Z")

</div>

Oh wow, sorry. There is actually `editor.setUiOption("forcedROMode", true)`, which I just found out from the [Action Button](https://community.silverbullet.md/t/make-actionbuttons-editable/2535) page and [this topic](https://community.silverbullet.md/t/make-actionbuttons-editable/2535). This is perfect and should be there by default! ❤
