Skip to content

Commit 485da90

Browse files
Merge pull request #173 from ThomasWaldmann/http-stdio
REST http via stdio
2 parents 4c02324 + e1637a2 commit 485da90

8 files changed

Lines changed: 503 additions & 48 deletions

File tree

contrib/server/nginx-systemd/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ compatibility. For production use, you **must** add SSL/TLS configuration.
1818

1919
- **`borgstore@.socket`** — systemd creates `/run/borgstore/<name>.sock` and
2020
starts the matching service on the first incoming connection.
21-
- **`borgstore@.service`** — runs `borgstore.server.rest --socket-activation`,
21+
- **`borgstore@.service`** — runs `borgstore-server-rest --socket-activation`,
2222
adopting the pre-bound socket from systemd.
2323
- **`nginx-borgstore.conf`** — a single wildcard `location` block routes any
2424
`/repos/<name>/` URL to the matching Unix socket; nginx strips the path

contrib/server/nginx-systemd/borgstore@.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Group=borgstore
2727
# Minimum required: BORGSTORE_BACKEND, BORGSTORE_USERNAME, BORGSTORE_PASSWORD
2828
EnvironmentFile=/etc/borgstore/%i.env
2929

30-
ExecStart=/usr/bin/python3 -m borgstore.server.rest \
30+
ExecStart=/usr/bin/borgstore-server-rest \
3131
--backend ${BORGSTORE_BACKEND} \
3232
--username ${BORGSTORE_USERNAME} \
3333
--password ${BORGSTORE_PASSWORD} \

docs/servers.rst

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,41 @@ cloud storage servers:
1313
- server-side hash computation (e.g. sha256) for item content
1414
- server-side defragmentation helper (copies blocks to new items)
1515

16-
Running the server
17-
------------------
16+
Running the server on host:port
17+
-------------------------------
1818

1919
Run a server with a file: backend (for a local directory), using HTTP Basic Authentication::
2020

21-
python3 -m borgstore.server.rest --host 127.0.0.1 --port 5618 \
22-
--username user --password pass \
23-
--backend file:///tmp/teststore
21+
borgstore-server-rest --host 127.0.0.1 --port 5618 \
22+
--username user --password pass \
23+
--backend file:///tmp/teststore
2424

2525
For production deployments, consider using systemd socket activation
2626
(see contrib/server/nginx-systemd/README.md).
2727

28+
Running the server via stdio
29+
----------------------------
30+
31+
Run a server with a file: backend (for a local directory), talking http via
32+
stdin/stdout, logging via stderr:
33+
34+
borgstore-server-rest --stdio \
35+
--backend file:///tmp/teststore
36+
2837
Accessing the server from a client
2938
----------------------------------
3039

3140
The borgstore REST client can then access via::
3241

3342
http://user:pass@127.0.0.1:5618/
3443

44+
or (when using http over stdio):
45+
46+
rest://user@host:port//tmp/teststore # via ssh, abs. path
47+
rest://user@host:port/teststore # via ssh, rel. path
48+
rest:////tmp/teststore # locally, without ssh, abs. path
49+
rest:///teststore # locally, without ssh, rel. path
50+
3551
Permissions
3652
-----------
3753

@@ -45,24 +61,24 @@ Examples:
4561

4662
Read-only access::
4763

48-
python3 -m borgstore.server.rest --host 127.0.0.1 --port 5618 \
49-
--username user --password pass \
50-
--backend file:///tmp/teststore \
51-
--permissions '{"": "lr"}'
64+
borgstore-server-rest --host 127.0.0.1 --port 5618 \
65+
--username user --password pass \
66+
--backend file:///tmp/teststore \
67+
--permissions '{"": "lr"}'
5268

5369
No-delete, no-overwrite (allow adding new items)::
5470

55-
python3 -m borgstore.server.rest --host 127.0.0.1 --port 5618 \
56-
--username user --password pass \
57-
--backend file:///tmp/teststore \
58-
--permissions '{"": "lrw"}'
71+
borgstore-server-rest --host 127.0.0.1 --port 5618 \
72+
--username user --password pass \
73+
--backend file:///tmp/teststore \
74+
--permissions '{"": "lrw"}'
5975

6076
Full access::
6177

62-
python3 -m borgstore.server.rest --host 127.0.0.1 --port 5618 \
63-
--username user --password pass \
64-
--backend file:///tmp/teststore \
65-
--permissions '{"": "lrwWD"}'
78+
borgstore-server-rest --host 127.0.0.1 --port 5618 \
79+
--username user --password pass \
80+
--backend file:///tmp/teststore \
81+
--permissions '{"": "lrwWD"}'
6682

6783
BorgBackup shortcuts
6884
~~~~~~~~~~~~~~~~~~~~
@@ -87,10 +103,10 @@ Example — restrict a backup server to no-delete access:
87103

88104
.. code-block:: bash
89105
90-
python3 -m borgstore.server.rest --host 127.0.0.1 --port 5618 \
91-
--username user --password pass \
92-
--backend file:///home/user/repos/repo1 \
93-
--permissions borgbackup-no-delete
106+
borgstore-server-rest --host 127.0.0.1 --port 5618 \
107+
--username user --password pass \
108+
--backend file:///home/user/repos/repo1 \
109+
--permissions borgbackup-no-delete
94110
95111
Custom JSON permissions
96112
~~~~~~~~~~~~~~~~~~~~~~~
@@ -99,10 +115,10 @@ You can also pass an arbitrary JSON-encoded permissions mapping directly.
99115

100116
Hierarchical rules (list-only at root, read/write in ``data/``)::
101117

102-
python3 -m borgstore.server.rest --host 127.0.0.1 --port 5618 \
103-
--username user --password pass \
104-
--backend file:///tmp/teststore \
105-
--permissions '{"": "l", "data": "lrw"}'
118+
borgstore-server-rest --host 127.0.0.1 --port 5618 \
119+
--username user --password pass \
120+
--backend file:///tmp/teststore \
121+
--permissions '{"": "l", "data": "lrw"}'
106122

107123
Quota
108124
-----
@@ -120,8 +136,8 @@ Example — limit storage to 1 GiB:
120136

121137
.. code-block:: bash
122138
123-
python3 -m borgstore.server.rest --host 127.0.0.1 --port 5618 \
124-
--username user --password pass \
125-
--backend file:///tmp/teststore \
126-
--quota 1073741824
139+
borgstore-server-rest --host 127.0.0.1 --port 5618 \
140+
--username user --password pass \
141+
--backend file:///tmp/teststore \
142+
--quota 1073741824
127143

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ s3 = [
4040
]
4141
none = []
4242

43+
[project.scripts]
44+
borgstore-server-rest = "borgstore.server.rest:main"
45+
4346
[project.urls]
4447
Homepage = "https://github.com/borgbackup/borgstore"
4548

0 commit comments

Comments
 (0)