Merge pull request #77 from ssb-ngi-pointer/server-startup

Flesh out development instructions
This commit is contained in:
Alexander Cobleigh 2021-03-12 12:24:51 +01:00 committed by GitHub
commit c9eb1aef9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 12 deletions

View File

@ -1,28 +1,30 @@
# Go-SSB Room
This repository contains code for a [Secure-Scuttlebutt Room v2](https://github.com/ssb-ngi-pointer/rooms2/) server written in Go.
This repository contains code for a [Secure Scuttlebutt](https://ssb.nz) [Room (v1+v2) server](https://github.com/ssb-ngi-pointer/rooms2), written in Go.
It not only includes the secret-handshake+boxstream setup and muxrpc handlers for tunneling connections but also a fully embedded http/html interface for administering the room.
It includes:
* secret-handshake+boxstream network transport, sometimes referred to as SHS, using [secretstream](https://github.com/cryptoscope/secretstream)
* muxrpc handlers for tunneling connections
* a fully embedded HTTP server & HTML frontend, for administering the room
## Features
* [x] Rooms v1 (`tunnel.connect`, `tunnel.endpoints`, etc.)
* [x] Simple allow-listing, administerd via the web dashboard
* [ ] Sign-in with SSB
* [x] Simple allow-listing
Currently via `.ssb-go-rooms/authorized_keys`.
To be replaced with a authorization list on the dashboard.
* [ ] Alias managment
## Development
To get started, you need a recent version of [Go](https://golang.org). v1.16 and onward should be sufficient.
To build the server and see a list of it's options, run the following:
To build the server and see a list of its options:
```bash
$ cd cmd/server
$ go build
$ ./server -h
cd cmd/server
go build
./server -h
Usage of ./server:
-dbg string
listen addr for metrics and pprof HTTP server (default "localhost:6078")
@ -42,10 +44,27 @@ Usage of ./server:
print version number and build date
```
If you are working on the sqlite migrations, html templates or website assets, build the server with `go build -tags dev`.
This way it won't use the assets that are embedded in the binary but read them directly from the local filesystem.
If you want to view the development server in your browser:
```sh
# change to the root of the project (e.g. cd go-ssb-room) and generate the frontend's styling; requires npm
go generate -tags dev ./...
# now let's build & run the development server
cd cmd/server && go build -tags dev && ./server
# and visit http://localhost:3000
```
Once you are done with your changes run `go generate` in the changed packages to update them.
This can be useful if you are working on:
* the sqlite migrations,
* html templates,
* or website assets
This way, the build won't use the assets embedded in the binary, but instead read them directly from the local filesystem.
Once you are done with your changes and want to update the embedded assets:
```sh
# cd to the root of the folder, and then run go generate
go generate -tags dev ./...
```
## Tooling
### Mocks