You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+46-19Lines changed: 46 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,18 +3,59 @@ This project is the client golang application for a wrapper around a statically
3
3
sqlite3_rsync allows a guaranteed replication with no-downtime or blocks on the main thread by using the special
4
4
build flag SQLITE_ENABLE_DBPAGE_VTAB when sqlite is compiled into the goproject.
5
5
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
- 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
- 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
+
6
47
We're using CGO to directly call into sqlite_rsync.c to use the algorithm explicitly how the sqlite team
7
48
implemented the rsync function, however our API uses websockets to communicate between local and remote.
8
49
9
-
## Building
50
+
###Building
10
51
11
52
```
12
53
cd sqlite; make build
13
54
cd ../bridge; make build
14
55
cd ../client; make build
15
56
```
16
57
17
-
## Pre-compiled Binaries
58
+
###Pre-compiled Binaries
18
59
19
60
Pre-compiled binaries for various platforms are available in the [releases](https://github.com/sqlrsync/client/releases) section of the GitHub repository.
20
61
@@ -23,28 +64,14 @@ Pre-compiled binaries for various platforms are available in the [releases](http
23
64
- Linux: sqlrsync-linux-amd64
24
65
- Windows: sqlrsync-windows-amd64.exe
25
66
26
-
## Running
67
+
###Running
27
68
28
69
Run ./bin/sqlrsync <params>
29
70
30
-
## Application Logic and Settings
71
+
###Application Logic and Settings
31
72
32
73
By default, REMOTE is SQLRsync.com Version Controlled Storage
33
74
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
-
48
75
### Stored Settings
49
76
50
77
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
56
83
[defaults]
57
84
server = "wss://sqlrsync.com"
58
85
```
59
-
cd
86
+
60
87
2. local-secrets.toml
61
88
Contains this-machine-specific settings, including the path to the local SQLite files, push keys, and encryption keys.
0 commit comments