optimized rclone http server
This commit is contained in:
parent
adc142cec8
commit
95d4db2fff
3 changed files with 69 additions and 4 deletions
|
|
@ -27,6 +27,7 @@ $ docker load < $(nix-build nix/docker.nix)
|
|||
| `FEDERATE_DRIVE_PORT` | `3215` | specify default library where user-files are uploaded (regular dir or mounted rclone path) |
|
||||
| `FEDERATE_DRIVE_USER` | `` | specify HTTP AUTH credentials (`user` e.g.) for restricted sharing |
|
||||
| `FEDERATE_DRIVE_PW` | `` | specify HTTP AUTH credentials (`pass` e.g.) for restricted sharing |
|
||||
| `FEDERATE_DRIVE_CACHE`| `1m0s` | specify interval to re-check all models/directories |
|
||||
|
||||
# Default database / admin login
|
||||
|
||||
|
|
@ -41,7 +42,7 @@ $ docker load < $(nix-build nix/docker.nix)
|
|||
The server-image will boot `manyfold/cli/manyfold.sh boot` and check for directory `/manyfold` (in the container).
|
||||
When found, it uses the files in there instead (`/manyfold/usr/src/app/public/404.html` instead of `/usr/src/app/public/404.html` e.g.).
|
||||
|
||||
# Federated (remote) network-drives
|
||||
# Federated drives (inbound)
|
||||
|
||||
> Thanks to [rclone](https://rclone.org) network-drives automatically show up as manyfold libraries.
|
||||
|
||||
|
|
@ -60,12 +61,71 @@ Your drives will get automagically mounted and added to the database automagical
|
|||
|
||||
TIP: use **alphanumeric** names for rclone remotes (manyfold libraries choke on dot- or other special-characters)
|
||||
|
||||
**Sharing [federating] a drive with other instances**
|
||||
|
||||
By default environment-flag `FEDERATE_DRIVE_PATH` will share path `/mnt/models` as an open web directory.
|
||||
This means it can be added as remote by other instances.
|
||||
See the environment-flags for more options.
|
||||
|
||||
<details>
|
||||
<summary>**Example connect to other XRForge instance**</summary>
|
||||
<br>
|
||||
```
|
||||
$ rclone config
|
||||
Current remotes:
|
||||
|
||||
Name Type
|
||||
==== ====
|
||||
|
||||
e) Edit existing remote
|
||||
n) New remote
|
||||
d) Delete remote
|
||||
r) Rename remote
|
||||
c) Copy remote
|
||||
s) Set configuration password
|
||||
q) Quit config
|
||||
e/n/d/r/c/s/q> n
|
||||
|
||||
Enter name for new remote.
|
||||
name> xrforge_instanceC
|
||||
|
||||
Option Storage.
|
||||
Type of storage to configure.
|
||||
Choose a number from below, or type in your own value.
|
||||
|
||||
...
|
||||
22 / HTTP
|
||||
...
|
||||
|
||||
Storage> 22
|
||||
|
||||
Option url.
|
||||
URL of HTTP host to connect to.
|
||||
E.g. "https://example.com", or "https://user:pass@example.com" to use a username and password.
|
||||
Enter a value.
|
||||
url> http://url-to-another-xrforge-instance.com
|
||||
|
||||
Option no_escape.
|
||||
Do not escape URL metacharacters in path names.
|
||||
Enter a boolean value (true or false). Press Enter for the default (false).
|
||||
no_escape>
|
||||
|
||||
Edit advanced config?
|
||||
y) Yes
|
||||
n) No (default)
|
||||
y/n> n
|
||||
|
||||
Configuration complete.
|
||||
Options:
|
||||
- type: http
|
||||
- url: http://localhost:8791
|
||||
Keep this "test" remote?
|
||||
y) Yes this is OK (default)
|
||||
e) Edit this remote
|
||||
d) Delete this remote
|
||||
y/e/d> y
|
||||
```
|
||||
</details>
|
||||
|
||||
# Unixy event hooks
|
||||
|
||||
Until WebEvents [will get implemented on a REST-level in manyfold](https://github.com/orgs/manyfold3d/projects/4/views/1?filterQuery=Pub&pane=issue&itemId=108834509&issue=manyfold3d%7Cmanyfold%7C4097) Things like boot-phase, scheduler and file-changes can be reacted up via the `/root/hook.d` directory:
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ run(){
|
|||
-e MULTIUSER=enabled \
|
||||
-e FEDERATION=enabled \
|
||||
-e THEME=vapor \
|
||||
-e FEDERATE_DRIVE_CACHE=5s \
|
||||
--cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse \
|
||||
xrforge
|
||||
#ghcr.io/manyfold3d/manyfold-solo:latest
|
||||
|
|
@ -172,6 +173,7 @@ boot(){
|
|||
rclone_mount
|
||||
set_upload_path
|
||||
start_hook_daemon
|
||||
hook boot # emit unixy hook-event (/root/hook.d/boot/* scripts)
|
||||
|
||||
exec "$@" # exec prevents error 's6-overlay-suexec: fatal: can only run as pid 1'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
set -x
|
||||
test -z "$FEDERATE_DRIVE_PATH" && FEDERATE_DRIVE_PATH=/mnt/models
|
||||
test -z "$FEDERATE_DRIVE_PORT" && FEDERATE_DRIVE_PORT=3215
|
||||
test -z "$FEDERATE_DRIVE_CACHE" && FEDERATE_DRIVE_CACHE=1m0s
|
||||
|
||||
test "$FEDERATE_DRIVE_PATH" = 0 && exit 0 # nothing to do (disabled)
|
||||
|
||||
|
|
@ -9,4 +9,7 @@ test -n "$FEDERATE_DRIVE_USER" && test -m "$FEDERATE_DRIVE_PW" && {
|
|||
AUTH="--user $FEDERATE_DRIVE_USER --pass $FEDERATE_DRIVE_PW"
|
||||
}
|
||||
|
||||
rclone serve http --addr 0.0.0.0:$FEDERATE_DRIVE_PORT ${AUTH} $FEDERATE_DRIVE_PATH &
|
||||
set -x
|
||||
rclone serve http \
|
||||
--poll-interval $FEDERATE_DRIVE_CACHE \
|
||||
--addr 0.0.0.0:$FEDERATE_DRIVE_PORT ${AUTH} $FEDERATE_DRIVE_PATH &> /var/log/rclone.log &
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue