Skip to content

Commit 735170e

Browse files
committed
Docs update
1 parent 481a1a9 commit 735170e

File tree

5 files changed

+55
-22
lines changed

5 files changed

+55
-22
lines changed

pkg/server/cmd/server.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ func buildConfig(bundledFiles fs.FS, args []string) *server.ServerConfig {
165165
}
166166

167167
func ServerCommand(bundledFiles fs.FS) *cobra.Command {
168-
var userPass string
169168
var hostname string
170169
var port int
171170
var c = &cobra.Command{
@@ -174,12 +173,17 @@ func ServerCommand(bundledFiles fs.FS) *cobra.Command {
174173
Args: cobra.MinimumNArgs(0),
175174
Run: func(cmd *cobra.Command, args []string) {
176175
serverConfig := buildConfig(bundledFiles, args)
176+
if port != 0 {
177+
serverConfig.Port = port
178+
}
179+
if hostname != "" {
180+
serverConfig.BindHost = hostname
181+
}
177182
if err := server.RunServer(serverConfig); err != nil {
178183
log.Fatal(err)
179184
}
180185
},
181186
}
182-
c.Flags().StringVarP(&userPass, "user", "", "", "user:pass authentication info")
183187
c.Flags().StringVarP(&hostname, "hostname", "L", "127.0.0.1", "Host or address to listen to")
184188
c.Flags().IntVarP(&port, "port", "p", 3000, "Port to listen to")
185189

pkg/server/server.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ func RunServer(config *ServerConfig) error {
7777
// File is in the bundle, let's serve it
7878
if r.Header.Get("If-Modified-Since") == utcDateString(meta.LastModified) {
7979
w.WriteHeader(304)
80-
log.Printf("Sending 304 not modified: %s", path)
8180
return
8281
}
8382
w.Header().Set("Content-Type", meta.ContentType)

website/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ An attempt at documenting the changes/new features introduced in each release.
33
## Edge
44
These are changes live on the edge builds:
55

6+
* New server written in Go, should be functionally equivalent to the old Deno-based backend, but is much smaller, faster and uses less memory.
67
* Sync engine re-architecture: see [[Architecture]] and [[Sync]]
78
* More configuring what to index (see [[^Library/Std/Config]] under the `index` section) for the purpose of reducing local storage size and needless CPU waste. Some useful ones:
89
* `config.set("index.search.enable", false)` to disable [[Full Text Search]] entirely (saves on processing and storage if you don’t use it)
910
* `config.set("index.paragraph.all", false)` to disable indexing all (untagged) paragraphs. This is also somewhat wasteful if you don’t query these.
10-
* Parallel sync (5 files simultaneously)
11+
* Parallel sync
1112
* Disable ability to rename pages in read-only mode (by [Jelenkee](https://github.com/silverbulletmd/silverbullet/pull/1509))
1213
* Improved docker build + health check (by [Zef](https://github.com/silverbulletmd/silverbullet/issues/1515))
1314
* Added `templates.tagItem` template (by [Andy Costanza](https://github.com/silverbulletmd/silverbullet/commit/6d4f964a6e2a4f7dae04aa7558defcaa9f1f1a86))

website/Development.md

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,70 @@
11
# Stack
2-
SilverBullet is written in [TypeScript](https://www.typescriptlang.org/) and built on top of the excellent [CodeMirror 6](https://codemirror.net/) editor component. Additional UI is built using [Preact](https://preactjs.com/). [ES Build](https://esbuild.github.io) is used to build both the front-end and back-end bundles. The server backend runs as an HTTP server on [Deno](https://deno.land/) using [Hono](https://hono.dev).
2+
SilverBullet’s client is written in [TypeScript](https://www.typescriptlang.org/) and built on top of the excellent [CodeMirror 6](https://codemirror.net/) editor component. Additional UI is built using [Preact](https://preactjs.com/). [ES Build](https://esbuild.github.io) is used to build the frontend.
3+
4+
[[Plugs]] are also written in TypeScript.
5+
6+
The SilverBullet server is written in [Go](https://go.dev/).
7+
8+
# Project layout
9+
310

411
# Development
5-
Requirements: [Deno](https://deno.land/) 2.2 or newer.
12+
Requirements:
13+
* [Deno](https://deno.land/) 2.4 or newer.
14+
* [Go](https://go.dev/) 1.25 or newer
15+
* Make
16+
17+
It's convenient to also install [air](https://github.com/air-verse/air) for development, this tool will watch your code base for changes and automatically rebuild:
18+
19+
```shell
20+
go install github.com/air-verse/air@latest
21+
```
22+
23+
Make sure your `$GOPATH/bin` is in your $PATH.
624

7-
Clone the repository from GitHub:
25+
To build everything and run the server using air:
826

927
```shell
10-
git clone git@github.com:silverbulletmd/silverbullet.git
11-
cd silverbullet
28+
air <PATH-TO-YOUR-SPACE>
1229
```
1330

14-
And build it:
31+
Note, that if you want to pass arguments to your SilverBullet binary like `-p` or `-L` you need to this as follows:
1532

1633
```shell
17-
deno task build
34+
air -- -L 0.0.0.0 <PATH-TO-YOUR-SPACE>
1835
```
1936

20-
For convenience, replace your `silverbullet` install with the one from this repo via:
37+
38+
Alternatively, to build the project without air:
2139

2240
```shell
23-
deno task install
41+
make build
2442
```
2543

26-
You can now run the server in “watch mode” (automatically restarting when you change source files) with:
44+
To run the resulting server:
2745

2846
```shell
29-
deno task watch-server <PATH-TO-YOUR-SPACE>
47+
./silverbullet <PATH-TO-YOUR-SPACE>
3048
```
3149

32-
It's convenient to run three commands in parallel (in separate terminals):
50+
### Useful development tasks
51+
52+
Typecheck, lint, test the frontend:
3353

3454
```shell
35-
deno task watch-web
36-
deno task watch-server <PATH-TO-YOUR-SPACE>
37-
deno task watch-plugs
55+
make test
3856
```
3957

40-
All of these watch for file changes and a rebuild should trigger automatically.
58+
### Build a docker container
59+
Note, you do not need Deno nor Go locally installed for this to work:
60+
61+
```shell
62+
docker build -t silverbullet .
63+
```
64+
65+
To run:
66+
67+
```shell
68+
docker run -p 3000:3000 -v <PATH-TO-YOUR-SPACE>:/space silverbullet
69+
```
4170

42-
Note that there are dependencies between these builds. Any change to any of the built-in _plugs_ requires a rebuild of the web app. Any rebuild of the web app will only be picked up by the server after it restarts (which should happen automatically).

website/Install/Configuration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ SilverBullet is primarily configured via environment variables. This page gives
44

55
* `SB_INDEX_PAGE`: Sets the default page to load, defaults to `index`.
66
* `SB_SPACE_IGNORE`: Ignore certain path patterns based on a .gitignore style format, e.g. `SB_SPACE_IGNORE="IgnoreMe/*"`.
7+
* `SB_HTTP_LOGGING`: Set to any value to enable HTTP logging
78

89
# Network
910
* `SB_HOSTNAME`: Set to the hostname to bind to (defaults to `127.0.0.0`, set to `0.0.0.0` to accept outside connections for the local deno setup, defaults to `0.0.0.0` for docker)
@@ -43,7 +44,7 @@ Configuration only relevant to docker deployments:
4344
* `PGID`: Runs the server process with the specified GID (default: whatever group owns the `/space` mapped folder)\
4445

4546
# Web app manifest
46-
Configure aspects of web app appearance:
47+
Configure aspects of web app appearance as well as the authentication page:
4748

4849
* `SB_NAME`: Sets `name` and `short_name` members of web app manifest to whatever specified in `SB_NAME`
4950
* `SB_DESCRIPTION`: Sets `description` member of web app manifest to whatever specified in `SB_DESCRIPTION`

0 commit comments

Comments
 (0)