diff --git a/manyfold/README.md b/manyfold/README.md index 2d0ada0..82944b9 100644 --- a/manyfold/README.md +++ b/manyfold/README.md @@ -13,16 +13,20 @@ $ docker load < $(nix-build nix/docker.nix) # Extra environment-variables -| environment variable | default | info | -|----------------------|--------------|------------------------| -| `APPNAME` | `manyfold` | manyfold instance name | -| `THEME` | `default` | bootstrap theme | -| `NO_OVERLAYFS` | `` | disable the filesystem overlay mechanism | -| `NO_DEFAULTDB` | `` | disable the default db (activates manyfold installer) | -| `NO_DELETEBIGFILES` | `` | disable deleting big files which are older than 5 days and bigger than ($currentyear-2020) MB's | -| `NO_PACKAGEALL` | `` | don't package all experiences every hour to /usr/src/app/public/experiences.zip | -| `RCLONE_REMOTE` | `` | specify **single** rclone remote name (without semicolon) to mount | -| `UPLOAD_PATH` | `/mnt/models`| specify default library where user-files are uploaded (regular dir or mounted rclone path) | +| environment variable | default | info | +|-----------------------|--------------|------------------------| +| `APPNAME` | `manyfold` | manyfold instance name | +| `THEME` | `default` | bootstrap theme | +| `NO_OVERLAYFS` | `` | disable the filesystem overlay mechanism | +| `NO_DEFAULTDB` | `` | disable the default db (activates manyfold installer) | +| `NO_DELETEBIGFILES` | `` | disable deleting big files which are older than 5 days and bigger than ($currentyear-2020) MB's | +| `NO_PACKAGEALL` | `` | don't package all experiences every hour to /usr/src/app/public/experiences.zip | +| `RCLONE_REMOTE` | `` | specify **single** rclone remote name (without semicolon) to mount (default: mount all rclone remotes)| +| `UPLOAD_PATH` | `/mnt/models`| specify default library where user-files are uploaded (regular dir or mounted rclone path) | +| `FEDERATE_DRIVE_PATH` | `/mnt/models`| serve path over HTTP (so other instances can add it as a remote). Specify `0` to disable | +| `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 | # Default database / admin login @@ -56,6 +60,12 @@ 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. + # 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: @@ -77,3 +87,4 @@ Currently inotify events (`inotify_MODIFY` e.g.) are triggered for local file-ch In theory, federated drives can still be reacted upon, but by integrating with XRForge's ActivityPub (**Follow** feature e.g.) > Perhaps in the future this will also work for rclone remotes, by writing a `hourly`-script which scans them and fires `inotify_MODIFY` accordingly. + diff --git a/manyfold/cli/manyfold.sh b/manyfold/cli/manyfold.sh index 36fe945..2e3dac7 100755 --- a/manyfold/cli/manyfold.sh +++ b/manyfold/cli/manyfold.sh @@ -22,7 +22,7 @@ run(){ #-e NO_DEFAULTDB=true \ #-e PUBLIC_HOSTNAME=localhost \ #-e PUBLIC_PORT=80 \ - debug ${oci} run "$@" -p 8790:3214 --name xrforge \ + debug ${oci} run "$@" -p 8790:3214 -p 8791:3215 --name xrforge \ -e SECRET_KEY_BASE=lkjwljlkwejrlkjek34k234l \ -e DATABASE_ADAPTER=sqlite3 \ -e SUDO_RUN_UNSAFELY=enabled \ diff --git a/manyfold/root/hook.d/boot/httpserver.sh b/manyfold/root/hook.d/boot/httpserver.sh new file mode 100755 index 0000000..8d90ff3 --- /dev/null +++ b/manyfold/root/hook.d/boot/httpserver.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -x +test -z "$FEDERATE_DRIVE_PATH" && FEDERATE_DRIVE_PATH=/mnt/models +test -z "$FEDERATE_DRIVE_PORT" && FEDERATE_DRIVE_PORT=3215 + +test "$FEDERATE_DRIVE_PATH" = 0 && exit 0 # nothing to do (disabled) + +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 & diff --git a/nix/docker.nix b/nix/docker.nix index cbea10c..ea68b23 100644 --- a/nix/docker.nix +++ b/nix/docker.nix @@ -1,21 +1,22 @@ -#{ pkgs ? import { } -# , pkgsLinux ? import { system = "x86_64-linux"; } -#}: -{} : +{ pkgs ? import { } + , pkgsLinux ? import { system = "x86_64-linux"; } +}: -let - pkgs = import (builtins.fetchGit { - #name = "nixos-24.05"; - #url = "https://github.com/nixos/nixpkgs/"; - #ref = "refs/heads/nixos-unstable"; - #rev = "ef99fa5c5ed624460217c31ac4271cfb5cb2502c"; +let - name = "nixos-25.05"; - url = "https://github.com/NixOS/nixpkgs"; - rev = "b65adef5fe1f68db0bbd27dbb1d5f779805c2b8b"; - #hash = "sha256-P+QnQOEh8n+4terom/1ZijQYgv4SnrFLfRzIcFzT1MI="; +# -- swap the above pkgs with the pkgs definition below for 100% reproducability +# -- WARNING: requires quite some diskspace + +#{ } : +# +#let +# pkgs = import ( builtins.fetchTarball { +# # https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-25.05.zip +# name = "nixos-25.05"; +# url = "https://github.com/NixOS/nixpkgs/archive/nixos-25.05.tar.gz"; +# sha256 = "sha256:10cqhkqkifcgyibj9nwxrnq424crfl40kwr3daky83m2fisb4f6p"; +# }) {}; - }) {}; vars = import ./vars.nix; # generate the reproducable blob below via: