diff --git a/.gitmodules b/.gitmodules index cee78cf..e69de29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "xrfragment"] - path = xrfragment - url = https://codeberg.org/coderofsalvation/xrfragment diff --git a/manyfold/README.md b/manyfold/README.md index ce06492..8bd650d 100644 --- a/manyfold/README.md +++ b/manyfold/README.md @@ -3,9 +3,22 @@ The XRForge-serverimage is a pre-configured [Manyfold](https://manyfold.app) container (reproducably via [nix](https://nixos.org) dockertools). It also contains some extra's, to better fit an XR audience & enable community libraries. -> To run the container, see the [sysadmin](https://manyfold.app/sysadmin/) documentation of the [manyfold](https://github.com/manyfold3d/manyfold) project. +> To run the container, see the docker-cmd below [sysadmin](https://manyfold.app/sysadmin/) documentation of the [manyfold](https://github.com/manyfold3d/manyfold) project. -# Build/Run the container-image +``` +$ docker run -t xrforge docker.io/coderofsalvation/xrforge:latest +``` + +To persist data: + +``` +$ mkdir mnt config +$ docker run -t xrforge docker.io/coderofsalvation/xrforge:latest -v ./mnt:/mnt -v ./config:/config +``` + +# Build & Run the container-image + +> **NOTE**: [nix](https://nixos.org) is used to promote reproducability-over-repeatability ```bash $ git clone --recurse-submodules --depth 1 https://codeberg.org/coderofsalvation/xrforge.git @@ -21,7 +34,7 @@ sending incremental file list ... ``` -> NOTE: if you don't want the default XR Fragments asset-library, omit `--recurse-submodules` in the git cmd and `-v ./xrfragment....` in the docker cmd. +> NOTE: if you don't want the default XR Fragments asset-library, omit `--recurse-submodules` in the git cmd To preserve your uploaded models, add the `experiences` as a docker volume-flag, for example: @@ -39,8 +52,10 @@ $ manyfold/cli/manyfold run -v ./experiences:/mnt/experiences | `HOMEPAGE` | `/models` | show '/models' URL as homepage (use `/` for manyfold default) | | `THEME` | `default` | bootstrap theme | | `RUNTESTS` | `0` | set to `1` to run XRForge related [/test](test) scripts | +| `NO_PUBLIC_ONLY` | `` | disable public only models | | `NO_OVERLAYFS` | `` | disable the filesystem overlay mechanism | -| `NO_DEFAULTDB` | `` | disable the default db (activates manyfold installer) | +| `NO_DEFAULTDB` | `` | disable the default xrforge db (activates manyfold installer) | +| `NO_ASSETS` | `` | disable downloading assets from xrfragment.org repository | | `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)| diff --git a/manyfold/cli/manyfold.sh b/manyfold/cli/manyfold.sh index 595dcdd..f236d7e 100755 --- a/manyfold/cli/manyfold.sh +++ b/manyfold/cli/manyfold.sh @@ -179,12 +179,37 @@ start_syslog(){ } scan_libraries(){ - sleep 20 # wait for manyfold/redis to boot first + sleep 10 # wait for manyfold/redis to boot first cd /usr/src/app echocolor "scanning libraries" bin/manyfold libraries scan } +rails_query(){ + cd /usr/src/app + echo "$*" | bin/rails console +} + +force_public(){ + test -n "$NO_PUBLIC_ONLY" && return 0 # nothing to do + echocolor "forcing public-only models" + infinite 60 rails_query 'Model.find_each { |it| it.grant_permission_to("view", nil) }' & +} + +get_xrfragment_assets(){ + test -n "$NO_ASSETS" && return 0 # nothing to do here + test -d /mnt/assets || { + echocolor "fetching XR Fragments assets & templates" + mkdir -p /mnt/assets/xrfragment/\#1 + cd /tmp + timeout 50 wget "https://codeberg.org/coderofsalvation/xrfragment/archive/main.zip" + unzip main.zip + cp -r xrfragment/assets/* /mnt/assets/xrfragment/\#1/. + rm -rf main.zip xrfragment + } + add_lib_to_db /mnt/assets +} + # The new entrypoint of the docker boot(){ echocolor "[$APPNAME]" "booting..." @@ -199,6 +224,8 @@ boot(){ mount_rclone set_upload_path start_hook_daemon + force_public + get_xrfragment_assets scan_libraries & hook boot # emit unixy hook-event (/root/hook.d/boot/* scripts) diff --git a/manyfold/mnt/assets/xrfragment/#1 b/manyfold/mnt/assets/xrfragment/#1 deleted file mode 120000 index a4dcea9..0000000 --- a/manyfold/mnt/assets/xrfragment/#1 +++ /dev/null @@ -1 +0,0 @@ -../../../xrfragment/assets \ No newline at end of file diff --git a/xrfragment b/xrfragment deleted file mode 160000 index 7a95d4f..0000000 --- a/xrfragment +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7a95d4ffbf610d4a82d586eb04edf8c24460a195