xrforge/manyfold/README.md

151 lines
8.7 KiB
Markdown
Raw Normal View History

# Manyfold container
The XRForge-serverimage is a pre-configured Manyfold container (reproducably via [nix](https://nixos.org) dockertools).
It also contains some extra's, to better fit an XR audience.
> To run the container, see the [sysadmin](https://manyfold.app/sysadmin/) documentation of the [manyfold](https://github.com/manyfold3d/manyfold) project.
# Build the container-image
```bash
$ 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 (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 |
2025-08-05 18:59:03 +02:00
| `FEDERATE_DRIVE_CACHE`| `1m0s` | specify interval to re-check all models/directories |
# Default database / admin login
* email: `xrforge@localhost`
* login: `xrforge`
* password: `xrforge!1`
> please modify the password in the settings screen of the webinterface.
# Filesystem overlay-mechanism
2025-07-28 19:18:42 +02:00
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.).
2025-08-05 18:59:03 +02:00
# Federated drives (inbound)
2025-07-28 18:46:12 +02:00
> Thanks to [rclone](https://rclone.org) network-drives automatically show up as manyfold libraries.
![](https://i.imgur.com/4VMF3CQ.png)
To enable rclone to mount network drives, the container must be run with FUSE-device support.
The quickest way is:
* add `-v ./manyfold/root/.config:/root/.config --cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse` to the docker cmd
* add network drives by running `docker exec -it rclone config` in a running container
* profit!
2025-07-28 19:18:42 +02:00
Your drives will get automagically mounted and added to the database automagically (by [manyfold.sh](cli/manyfold.sh) `rclone_automount`-cmd) during container boot.
2025-07-28 18:41:09 +02:00
> NOTE: by default all rclone remotes automagically show up as separate manyfold libraries, however use `RCLONE_REMOTE` this to specify a [combined](https://rclone.org/combine/) or [union](https://rclone.org/union/) rclone remote.
TIP: use **alphanumeric** names for rclone remotes (manyfold libraries choke on dot- or other special-characters)
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.
2025-08-05 18:59:03 +02:00
<details>
2025-08-05 19:00:24 +02:00
<summary><h2>Example connect to other XRForge instance</h2></summary>
2025-08-05 18:59:03 +02:00
<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:
```
$ ls /root/hook.d
boot
daily
hourly
inotify_CREATE
inotify_MODIFY
```
You can put scripts in there, which are fired when needed.
> Example: [manyfold/root/hook.d/daily/delete_big_files.sh] is triggered daily to cleanup files which exceed a certain age/size.
2025-08-05 13:57:59 +02:00
Currently inotify events (`inotify_MODIFY` e.g.) are triggered for local file-changes (`/mnt/models` e.g.).
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.