Skip to content

Commit f7c872f

Browse files
committed
feat: Better readme doc for sqlite
1 parent 9d83956 commit f7c872f

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ Mozilla Sync Storage built with [Rust](https://rust-lang.org).
3838
- pkg-config
3939
- [Rust stable](https://rustup.rs)
4040
- python 3.9+
41-
- MySQL 5.7 (or compatible)
42-
* libmysqlclient (`brew install mysql` on macOS, `apt install libmysqlclient-dev` on Ubuntu, `apt install libmariadb-dev-compat` on Debian)
41+
- At least one database backend (depending on which one you'll be running)
42+
* MySQL 5.7 (or compatible)
43+
* libmysqlclient (`brew install mysql` on macOS, `apt install libmysqlclient-dev` on Ubuntu, `apt install libmariadb-dev-compat` on Debian)
44+
* SQLite v3.24 or greater
4345

4446
Depending on your OS, you may also need to install `libgrpcdev`,
4547
and `protobuf-compiler-grpc`. *Note*: if the code complies cleanly,
@@ -52,7 +54,8 @@ are missing `libcurl4-openssl-dev`.
5254
2. Now `cp config/local.example.toml config/local.toml`. Open `config/local.toml` and make sure you have the desired settings configured. For a complete list of available configuration options, check out [docs/config.md](docs/config.md).
5355
3. To start a local server in debug mode, run either:
5456
- `make run_mysql` if using MySQL or,
55-
- `make run_spanner` if using spanner.
57+
- `make run_spanner` if using spanner or,
58+
- `make run_sqlite` if using sqlite.
5659

5760
The above starts the server in debug mode, using your new `local.toml` file for config options. Or, simply `cargo run` with your own config options provided as env vars.
5861
4. Visit `http://localhost:8000/__heartbeat__` to make sure the server is running.
@@ -185,9 +188,24 @@ SYNC_SYNCSTORAGE__SPANNER_EMULATOR_HOST=localhost:9010 make run_spanner
185188
Setting up the server with sqlite only requires a path to the database file,
186189
which will be created automatically:
187190

188-
`sqlite:path/syncdb.sqlite`
191+
One for the syncserver data
192+
`sqlite:path/syncdb.sqlite`
193+
And one for the tokenserver data
194+
`sqlite:path/tokendb.sqlite`
189195

190-
This requires at least sqlite v3.24.0 to be installed on the host system.
196+
Note that after database initialisation you will still need to run two SQL
197+
insert on the tokenserver database to announce the presence of your syncserver
198+
to the clients.
199+
```sql
200+
-- Create a new service record
201+
INSERT INTO `services` (`id`, `service`, `pattern`)
202+
VALUES ('1', 'sync-1.5', '{node}/1.5/{uid}');
203+
204+
-- Create a new service node record. Set the node field to the path of your
205+
-- syncserver.
206+
INSERT INTO `nodes` (`id`, `service`, `node`, `available`, `current_load`, `capacity`, `downed`, `backoff`)
207+
VALUES ('1', '1', 'http://localhost:8000', '1', '0', '1', '0', '0');
208+
```
191209

192210
### Running via Docker
193211

0 commit comments

Comments
 (0)