SilverBullet 2.1 released!

This is a major architectural overhaul compared to 2.0.

Please — as always — make sure you regularly backup your space files to avoid any data loss. Nothing should happen, but better be safe than sorry!

  • The server has been rewritten in Go (previously Deno). This uses significantly less memory (think: 10x), is significantly smaller in size (think: 10x), and likely faster (although server performance was never really a bottleneck).
  • Docker base image is now based on Alpine (previously Ubuntu), further reducing memory and disk space usage (think 5x).
  • Significant sync engine re-architecture: see Architecture and Sync, now lives in the service worker (so can partially happen in the background) and parallelizes sync. Once upgrading a full resync will need to happen. Documents are no longer synced by default (you can enable this via config, see Sync).
  • More configuration options for what to index for the purpose of reducing local storage size and needless CPU waste. Some useful ones:
    • config.set("index.search.enable", false) to disable Full Text Search entirely (saves on processing and storage if you don’t use it)
    • config.set("index.paragraph.all", false) to disable indexing all (untagged) paragraphs. This is also somewhat wasteful if you don’t query these.
  • Disable ability to rename pages in read-only mode (by Jelenkee)
  • Improved docker build + health check (by Zef)
  • Added templates.tagItem template (by Andy Costanza)
  • Support links in table queryable objects (by Alex Dobin)
  • Refactor of document editors (by MrMugame)
  • Command to toggle markdown syntax rendering (by aphymi)
  • Fix transclusions not being indexed as links (by MrMugame)
  • Render links inside frontmatter code as clickable anchors (by Andy Constanza)
  • New SB_LOG_PUSH option asking clients to push their browser JS logs to the server so they’re visible there.

I’d like to thank all contributors and people who are living on the edge builds for having been testing this for the last few weeks. I’m sure there’s still issues, but I’ll try to fix those as they show up.

A special shout out to my sponsors, thanks to whom I managed to spend significantly more time on SB over the last weeks, obviously resulting in big investments in the fundamental.

Btw, if you’re wondering: what happened to 2.1.0-2.1.1? Yeah, I messed up some things, ignore them!

19 Likes

Just released 2.1.3 as a small bugfix release fixing the PUID and PGID Docker environment variable behavior, which was broken in some setups.

3 Likes

And don’t forget these 2 new admonition (success and danger) :grin:

3 Likes

For those previously using the --user flag for authentication, it was removed.

Only the SB_USER environment variable is supported now.

1 Like

A little updated: I’ve just released 2.1.5.

This includes a few bug fixes:

  • last modified and file creation times are now reported correctly again (requires a resync… sorry about that)
  • Broken auth on Safari
  • Some subtle issues with sync

Bonus features:

  • Widgets like TOC and Linked mentions can now be switched on and off with a config option Widgets
5 Likes

And another release: 2.1.6

  • Renamed the inconstently named index.search.enable to index.search.enabled
  • Last opened (for pages) and last run (for commands) timestamps are now kept persistently between client loads (and tabs)
  • Fixed docker user and group creation issues
  • Removed file:deleted triggering when checking for getFileMeta (causing an infinite indexing loop in SilverSearch)
  • Server: HTTP Gzip compression is now enabled for sensible content types
  • Nicer syntax to query tag objects from the index: tags.page becomes an alias for index.tag "page"
  • Hidden files and folders (starting with .) are no longer synced, as well as files without a file extension (those were not support anyway)
3 Likes

In 2.1.6 , the following two listeners failed. Have the event names been changed?

event.listen {
  name = "page:saved",
  run = function(event)
    ...
  end
}
event.listen {
  name = "cron:secondPassed",
  run = function(event)
    ...
  end
}

In addition, does the following code have to be placed in CONFIG.md since 2.1.2?

config.set {
  plugs = {
    "github:joekrill/silverbullet-treeview/treeview.plug.js",
  },
}

It used to work outside CONFIG.md, but now it doesn’t seem to.
Other space-lua and space-style seem to be working normally outside CONFIG.md

Hi @ChenZhu-Xie

I had removed the page:saved event because nothing (appeared to be) using it and it wasn’t really documented. Since you seem to be using it, I just brought it back (will be in the next release).

As to cron:secondPassed that is still there? I’m using it also in my Git library and it triggers just fine?

As to where the plugs should be defined, this really doesn’t matter, it doesn’t need to be CONFIG. Do note that if you put it in multiple places, the values will override each other.

@Zef :folded_hands: Thank you for helping me preserve the page:saved event.

I double-checked, and cron:secondPassed is functioning normally.

Last time, I mistakenly set the interval to 10, assuming the unit was seconds. In fact, it was 10 minutes. After waiting just 1 minute without seeing any result, I wrongly thought that cron:secondPassed had disappeared together with page:saved during the version update — it was simply my misjudgment.

Regarding

config.set {
  plugs = {
    "github:joekrill/silverbullet-treeview/treeview.plug.js",
  },
}  

I now realized that this adjustment is not required by the version upgrade itself, but only necessary to comply with the format mentioned in this post:

I have no further issues — 3 matters have all been resolved.

1 Like

I’m trying to switch to 2.1 (2.1.6-0-g9521c76) from 2.0 and getting this error

Failed to process config Parse error at pos 44885

When I start with fresh data , copy paste current CONFIG file content, then run reload, I see no errors in the console.
Problem exists when refreshing the page.

Is it because my CONFIG file is too big? It has 3028 lines

That length should be fine, although I do wonder what you could possibly have there. What are you using this for? :laughing:

I have all my lua scripts and styles there.
I can share once I sit back to pc

Ok, generally I would say this is not the best idea. Perhaps it’s better to just use CONFIG for config.* API calls, and move the rest elsewhere (anywhere, really).

Moved script to a different file. Now it works perfectly.

2 Likes

2.1.7

  • Restructure of the Library/Std library, added some more (self) documentation. See Std as an entry point.
  • Re-added page:saved event that was removed in 2.1
  • When the clipboard API is used in Safari, will now give a proper error (Safari restriction) by (Noah Stanley)
  • Full text search results now show full page path
  • Space folders now support symlinks again (regression from 2.1)
  • Lua: fixes in arithmetic model (by Matouš Jan Fialka)
  • Lua: Removed unary plus from grammar (wasn’t actually supported) (by Matouš Jan Fialka)
  • Bugfix: auth and service worker caching fixes
  • Bugfix: docker health check failed when SB_URL_PREFIX was used
  • Bugfix: infinite item index loop in obscure cases
6 Likes

Note, as of 2.1.7 it is no longer supported to concatenate strings using the + operator in Space Lua, you have to is the proper .. operator instead. This should never have worked, because it’s not Lua defined behavior, but if you depended on it you may see some errors because of it.

3 Likes

A Storage Consumption Comparison between versions 2.0.0 and 2.1.7 on fly.io:

  • Image Size: 121 → 21 MB (a reduction of ↓↓ 82.6%)
  • Memory Usage: 158 → 70 MB (a reduction of ↓ 55.7%)
2025-10-05 14:29:09.346	
2025/10/05 06:29:09 Running shell command: git push origin main
2025-10-05 14:29:08.731	
2025/10/05 06:29:08 Running shell command: git pull origin main
2025-10-05 14:29:08.414	
2025/10/05 06:29:08 Running shell command: git commit -a -m Snapshot
2025-10-05 14:29:08.082	
2025/10/05 06:29:08 Running shell command: git add ./*
2025-10-05 14:28:02.103	
2025/10/05 06:28:02 SilverBullet is now running: http://0.0.0.0:3000
2025-10-05 14:28:02.103	
2025/10/05 06:28:02 Local shell command execution enabled for ALL commands.
2025-10-05 14:28:02.057	
Will run SilverBullet with UID 0, inferred from the owner of /space (set PUID environment variable to override)
2025-10-05 14:28:02.055	
[INFO] Git 同步成功 ✅
2025-10-05 14:28:02.054	
HEAD is now at 7d4ee77 Snapshot
2025-10-05 14:28:02.031	
* [new branch]      main       -> origin/main
2025-10-05 14:28:02.031	
* branch            main       -> FETCH_HEAD
2025-10-05 14:28:02.031	
From https://github.com/ChenZhu-Xie/xczphysics_SilverBullet
2025-10-05 14:28:00.699	
[INFO] 远程仓库非空,强制同步 main 分支
2025-10-05 14:28:00.430	
[INFO] 检查远程是否为空...
2025-10-05 14:27:59.224	
2025/10/05 06:27:59 INFO SSH listening listen_address=[fdaa:2b:d047:a7b:2c1:af45:5a47:2]:22
2025-10-05 14:27:59.079	
[INFO] 检查远程仓库可访问性...
2025-10-05 14:27:59.079	
[INFO] 当前远程 URL: https://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@github.com/ChenZhu-Xie/xczphysics_SilverBullet.git
2025-10-05 14:27:59.073	
[INFO] 检查本地是否配置了远程 origin...
2025-10-05 14:27:59.068	
[INFO] 创建 LICENSE
2025-10-05 14:27:59.067	
[INFO] 创建 .gitignore
2025-10-05 14:27:59.064	
[WARN] 未检测到远程 origin,正在添加
2025-10-05 14:27:59.055	
[WARN] 修正 Git 配置 core.editor: 当前='' -> 期望='nano'
2025-10-05 14:27:59.047	
[WARN] 修正 Git 配置 push.autoSetupRemote: 当前='' -> 期望='true'
2025-10-05 14:27:59.039	
[WARN] 修正 Git 配置 pull.rebase: 当前='' -> 期望='false'
2025-10-05 14:27:59.035	
[WARN] 修正 Git 配置 credential.helper: 当前='' -> 期望='store'
2025-10-05 14:27:59.027	
[WARN] 修正 Git 配置 user.email: 当前='' -> 期望='[email protected]'
2025-10-05 14:27:59.021	
[WARN] 修正 Git 配置 user.name: 当前='' -> 期望='Xcz'
2025-10-05 14:27:59.014	
Initialized empty Git repository in /space/.git/
2025-10-05 14:27:59.002	
Machine created and started in 6.754s
2025-10-05 14:27:58.986	
[INFO] 初始化 Git 仓库
2025-10-05 14:27:58.976	
To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.
2025-10-05 14:27:58.976	
Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
2025-10-05 14:27:58.976	
[WARN  tini (659)] Tini is not running as PID 1 and isn't registered as a child subreaper.
2025-10-05 14:27:58.965	
 INFO [fly api proxy] listening at /.fly/api
2025-10-05 14:27:58.963	
 INFO Preparing to run: `/sbin/tini -g -- /init.sh` as root
2025-10-05 14:27:58.962	
 INFO starting statics vsock server
2025-10-05 14:27:58.957	
 INFO Resized /space to 1056964608 bytes
2025-10-05 14:27:58.956	
 INFO Mounting /dev/vdd at /space w/ uid: 0, gid: 0 and chmod 0755
2025-10-05 14:27:58.955	
/dev/vdd: clean, 11/64512 files, 8785/258048 blocks
2025-10-05 14:27:58.952	
 INFO Checking filesystem on /space
2025-10-05 14:27:58.861	
 INFO Starting init (commit: fedadb2e)...
2025-10-05 14:27:58.040	
2025-10-05T06:27:58.040564144 [01K6SGW8PSQ7VJ1ZEMNZPKQE32:main] Listening on API socket ("/fc.sock").
2025-10-05 14:27:58.040	
2025-10-05T06:27:58.040419631 [01K6SGW8PSQ7VJ1ZEMNZPKQE32:main] Running Firecracker v1.12.1
2025-10-05 14:27:57.944	
Configuring firecracker
2025-10-05 14:27:57.210	
Formatting volume
2025-10-05 14:27:56.766	
Opening encrypted volume
2025-10-05 14:27:56.288	
Encrypting volume
2025-10-05 14:27:56.288	
Uninitialized volume 'silverbullet_space', initializing...
2025-10-05 14:27:56.288	
Setting up volume 'silverbullet_space'
2025-10-05 14:27:56.262	
Successfully prepared image registry.fly.io/enlarge-the-percentage@sha256:ac547e9bcb74dd02f4e43cf73d72485ac70a42ff41f6889614646660abb9317b (4.023218349s)
2025-10-05 14:27:52.238	
Pulling container image registry.fly.io/enlarge-the-percentage@sha256:ac547e9bcb74dd02f4e43cf73d72485ac70a42ff41f6889614646660abb9317b

2025-10-05 14:18:20.567	
Running shell command: git [ "push", "origin", "main" ]
2025-10-05 14:18:20.006	
Running shell command: git [ "pull", "origin", "main" ]
2025-10-05 14:18:19.763	
Running shell command: git [ "commit", "-a", "-m", "Snapshot" ]
2025-10-05 14:18:19.052	
Running shell command: git [ "add", "./*" ]
2025-10-05 14:15:19.754	
SilverBullet is now running: http://localhost:3000
2025-10-05 14:15:19.753	
Listening on http://0.0.0.0:3000/ (http://localhost:3000/)
2025-10-05 14:15:19.114	
Running with ALL shell commands enabled.
2025-10-05 14:15:19.014	
Using local disk as a storage backend: /app/SB_space
2025-10-05 14:15:19.012	
Starting SilverBullet binding to 0.0.0.0:3000
2025-10-05 14:15:18.921	
Storing database in /app/SB_space/.silverbullet.db.json.
2025-10-05 14:15:16.346	
[INFO] 启动 SilverBullet...
2025-10-05 14:15:16.346	
[INFO] Git 同步成功 ✅
2025-10-05 14:15:16.345	
HEAD is now at 7d4ee77 Snapshot
2025-10-05 14:15:16.275	
* branch            main       -> FETCH_HEAD
2025-10-05 14:15:16.275	
From https://github.com/ChenZhu-Xie/xczphysics_SilverBullet
2025-10-05 14:15:15.988	
[INFO] 远程仓库非空,强制同步 main 分支
2025-10-05 14:15:15.718	
[INFO] 检查远程是否为空...
2025-10-05 14:15:15.417	
2025/10/05 06:15:15 INFO SSH listening listen_address=[fdaa:2b:d047:a7b:2b4:27b8:8407:2]:22
2025-10-05 14:15:15.252	
[INFO] 检查远程仓库可访问性...
2025-10-05 14:15:15.252	
[INFO] 当前远程 URL: https://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@github.com/ChenZhu-Xie/xczphysics_SilverBullet.git
2025-10-05 14:15:15.241	
[INFO] 检查本地是否配置了远程 origin...
2025-10-05 14:15:15.240	
[INFO] 远程 origin URL 正确
2025-10-05 14:15:15.232	
[INFO] Git 配置 core.editor 正确
2025-10-05 14:15:15.228	
[INFO] Git 配置 push.autoSetupRemote 正确
2025-10-05 14:15:15.224	
[INFO] Git 配置 pull.rebase 正确
2025-10-05 14:15:15.220	
[INFO] Git 配置 credential.helper 正确
2025-10-05 14:15:15.216	
[INFO] Git 配置 user.email 正确
2025-10-05 14:15:15.211	
[INFO] Git 配置 user.name 正确
2025-10-05 14:15:15.143	
[INFO] Volume /app/SB_space 已挂载
2025-10-05 14:15:15.128	
[INFO] 等待卷 /app/SB_space 挂载...
2025-10-05 14:15:15.109	
Machine created and started in 3.366s
2025-10-05 14:15:15.106	
To fix the problem, use the -s option or set the environment variable TINI_SUBREAPER to register Tini as a child subreaper, or run Tini as PID 1.
2025-10-05 14:15:15.106	
Zombie processes will not be re-parented to Tini, so zombie reaping won't work.
2025-10-05 14:15:15.106	
[WARN  tini (660)] Tini is not running as PID 1 and isn't registered as a child subreaper.
2025-10-05 14:15:15.088	
 INFO [fly api proxy] listening at /.fly/api
2025-10-05 14:15:15.085	
 INFO Preparing to run: `/tini -- docker-entrypoint.sh ./init.sh` as root
2025-10-05 14:15:15.084	
 INFO starting statics vsock server
2025-10-05 14:15:15.077	
 INFO Resized /app/SB_space to 1056964608 bytes
2025-10-05 14:15:15.073	
 INFO Mounting /dev/vdd at /app/SB_space w/ uid: 0, gid: 0 and chmod 0755
2025-10-05 14:15:15.072	
/dev/vdd: clean, 105/64512 files, 11698/258048 blocks
2025-10-05 14:15:15.069	
 INFO Checking filesystem on /app/SB_space
2025-10-05 14:15:14.992	
 INFO Starting init (commit: fedadb2e)...
2025-10-05 14:15:14.157	
2025-10-05T06:15:14.157884912 [01K6SG5233AKSCNWWVC5HV9N8G:main] Listening on API socket ("/fc.sock").
2025-10-05 14:15:14.157	
2025-10-05T06:15:14.157772840 [01K6SG5233AKSCNWWVC5HV9N8G:main] Running Firecracker v1.12.1
2025-10-05 14:15:13.499	
[  234.168815] reboot: Restarting system
2025-10-05 14:15:13.495	
 INFO Umounting /dev/vdd from /app/SB_space
2025-10-05 14:15:13.494	
 INFO Starting clean up.
2025-10-05 14:15:13.478	
 INFO Main child exited normally with code: 130
2025-10-05 14:15:12.628	
 INFO Sending signal SIGINT to main child process w/ PID 657
2025-10-05 14:15:12.570	
Configuring firecracker
2025-10-05 14:15:11.760	
Opening encrypted volume
2025-10-05 14:15:11.760	
Setting up volume 'silverbullet_space'
2025-10-05 14:15:11.743	
Container image registry.fly.io/enlarge-the-percentage@sha256:f13f1466a0c4415a3332be21bfaeb498a9354f8449d25c70a48edd6c43fb3505 already prepared
2025-10-05 14:15:11.743	
Pulling container image registry.fly.io/enlarge-the-percentage@sha256:f13f1466a0c4415a3332be21bfaeb498a9354f8449d25c70a48edd6c43fb3505

3 Likes

So it works for you on fly.io? @drhayes is having trouble Deploy SilverBullet to fly.io - #6 by drhayes

I’m pretty sure mine is because I’d specified an incorrect SB_HOSTNAME environment variable – I had it as :: (which I thought was needed for the JS server to bind to the IPv6 address), but Go didn’t like that. I swapped to fly’s recommended value of fly-local-6pn and things are working just great again!

The weird thing about my fly.io setup is I’m not exposing an IPv4 port; I’m strictly getting to my hosted SB through a fly proxy as an added layer of security.

2 Likes

2.1.8

  • New https://silverbullet.md/Library/Std/APIs/Virtual%20Page API, internally used by:
  • Default table renderer now renders ref attributes as links, so they’re clickable
  • Fix: render TOC correctly when header itself contains a link (by Oleksandr Kuvshynov)
  • Fix: read-only pages are now never saved back to your space (could happen, e.g. with tasks on tag pages)
  • Fix: Table of Contents widget works again
  • Fix: Poor behavior when multiple pages are delete in sequence (by Oleksandr Kuvshynov)
  • Lua:
    • Some fixes in tonumber handling
    • Setting a table value to nil now deletes it as a key, so it no longer appears in table.keys
6 Likes