Skip to content

Commit 55efc94

Browse files
authored
Update README
1 parent ac6ae78 commit 55efc94

File tree

1 file changed

+46
-19
lines changed

1 file changed

+46
-19
lines changed

README.md

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,59 @@ This project is the client golang application for a wrapper around a statically
33
sqlite3_rsync allows a guaranteed replication with no-downtime or blocks on the main thread by using the special
44
build flag SQLITE_ENABLE_DBPAGE_VTAB when sqlite is compiled into the goproject.
55

6+
## Features:
7+
- PUSH and PULL rsync of sqlite3 database files to a remote SQLRsync server (defaults to sqlrsync.com)
8+
- Creates a [`-sqlrsync` file](https://sqlrsync.com/help/dash-sqlrsync) file neighboring the replicated database which can be shared to PULL down the database elsewhere.
9+
- Stores the PUSH key in ~/.config/sqlrsync/ to allow unattended re-PUSHing of the database (great for a cron job)
10+
- LOCAL Sync (when sqlrsync is provided 2 arguments, both local file paths) allows for a local-only (no server/network use) rsyncing of a running write-node SQLite database to a running read-only SQLite database with no readlocks.
11+
- The same mechanism works for PUSH and PULL: the ORIGIN can be a running write-node and the REPLICA can be a running read-only node. It's pretty magical.
12+
13+
### In PUSH, PULL, or LOCAL mode:
14+
- Use `--dry` to dry-run the command and see what mode it will trigger, and an explanation of what it will do
15+
16+
> <img width="600" height="157" alt="image" src="https://github.com/user-attachments/assets/1988770e-e79d-473a-bd3b-58815dfd6864" />
17+
18+
### When PUSHing:
19+
- On initial upload you can use the `--public` or `--unlisted` flag to allow others to view the webpage for your database, and optionally download any version of it.
20+
- Optionally include a commit message (`--message` or `-m`) to keep track of your changes
21+
22+
### When PULLing:
23+
- You can append an `@` sign and a version reference to download old versions of the database. For example:
24+
```
25+
sqlrsync oregon/elections.db # Pulls down the latest version
26+
sqlrsync oregon/elections.db@1 # Pulls down the first version
27+
sqlrsync oregon/elections.db@latest-2 # Goes backwards 2 versions from the latest
28+
```
29+
30+
> <img width="553" height="74" alt="image" src="https://github.com/user-attachments/assets/1a6608d0-0d66-4801-be98-06ce158f8e6f" />
31+
32+
### Authentication and Authorization
33+
34+
There are 3 types of keys used by SQLRsync:
35+
- Account Admin: Allows the creation of a new Database on REMOTE or PULLing any replica on the account
36+
- Replica Pull: Allows creating a local copy of any version of a specific existing Database on REMOTE to a local file
37+
- Replica Push: Allows the creation of a new version of a specific existing Database on REMOTE
38+
39+
Account Admin keys are never stored locally, and are always interactively prompted or provided as a command line argument.
40+
41+
If you use an Account Admin key, the server will reply with a new replica-specific Pull key (and Push token if you use an Account Create key). The pull key is stored adjacent to the replicated database in a file ending with the suffix `-sqlrsync`, along with other data. (For a database at /tmp/my-data.sqlite, the pull key would be stored in /tmp/my-data.sqlite-sqlrsync)
42+
43+
The more sensitive Replica Push key is stored in ~/.config/sqlrsync/local-secrets.toml and subsequent pushes will use that key.
44+
45+
## Technical Details and Contributing Guidelines
46+
647
We're using CGO to directly call into sqlite_rsync.c to use the algorithm explicitly how the sqlite team
748
implemented the rsync function, however our API uses websockets to communicate between local and remote.
849

9-
## Building
50+
### Building
1051

1152
```
1253
cd sqlite; make build
1354
cd ../bridge; make build
1455
cd ../client; make build
1556
```
1657

17-
## Pre-compiled Binaries
58+
### Pre-compiled Binaries
1859

1960
Pre-compiled binaries for various platforms are available in the [releases](https://github.com/sqlrsync/client/releases) section of the GitHub repository.
2061

@@ -23,28 +64,14 @@ Pre-compiled binaries for various platforms are available in the [releases](http
2364
- Linux: sqlrsync-linux-amd64
2465
- Windows: sqlrsync-windows-amd64.exe
2566

26-
## Running
67+
### Running
2768

2869
Run ./bin/sqlrsync <params>
2970

30-
## Application Logic and Settings
71+
### Application Logic and Settings
3172

3273
By default, REMOTE is SQLRsync.com Version Controlled Storage
3374

34-
### Authentication and Authorization
35-
36-
There are 3 types of keys used by SQLRsync:
37-
- Account Create: Allows the creation of a new Database on REMOTE
38-
- Account Pull: Allows creating a local copy of any version of any existing Database on REMOTE that is owned by that account
39-
- Replica Pull: Allows creating a local copy of any version of a specific existing Database on REMOTE to a local file
40-
- Replica Push: Allows the creation of a new version of a specific existing Database on REMOTE
41-
42-
Account level Pull and Create keys are never stored locally, and are always interactively prompted or provided as a command line argument.
43-
44-
If you use an Account level key, the server will reply with a new replica-specific Pull key (and Push token if you use an Account Create key). The pull key is stored adjacent to the replicated database in a file ending with the suffix `-sqlrsync`, along with other data. (For a database at /tmp/my-data.sqlite, the pull key would be stored in /tmp/my-data.sqlite-sqlrsync)
45-
46-
The more sensitive Replica Push key is stored in ~/.config/sqlrsync/local-secrets.toml and subsequent pushes will use that key.
47-
4875
### Stored Settings
4976

5077
Settings and defaults are stored in your user directory at ~/.config/sqlrsync. Within that directory, there are two files:
@@ -56,7 +83,7 @@ Settings and defaults are stored in your user directory at ~/.config/sqlrsync. W
5683
[defaults]
5784
server = "wss://sqlrsync.com"
5885
```
59-
cd
86+
6087
2. local-secrets.toml
6188
Contains this-machine-specific settings, including the path to the local SQLite files, push keys, and encryption keys.
6289

0 commit comments

Comments
 (0)