diff --git a/README.md b/README.md index 61bbe06..fe9ca5b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ An utility to test 3D models -## Installation +# Install on your PC First make sure you have python3 installed @@ -26,6 +26,106 @@ cd 3D-tester Now you can browse to `http://localhost:8080` -### Adding 3D models +## Adding 3D models Add your 3D models to the `./objects` folder. Create subdirectories as needed. + +# Install on a server + +``` +git clone https://git.hangar.org/arcHIVE-tech/3D-tester.git /opt/3Dtester +cd 3D-tester +python3 -m venv ./venv +source ./venv/bin/activate +pip install bottle +pip install gunicorn +``` + +## Gunicorn + +Gunicorn will server the python app + +Create and edit the file ./3Dtester/gunicorn.py + +``` +pythonpath = '/opt/3Dtester' +command = './venv/bin/gunicorn' +bind = '127.0.0.1:8080' +workers = 3 +user = 'www-data' +``` + +You can test the installation + +``` +gunicorn -c ./gunicorn.py app:app +``` + +## Supervisor + +We need something to keep Gunicorn going on system reboots, start, stop, etc. + +Instead of systemd ... + +``` +apt-get install supervisor +``` + +Edit `/etc/supervisor/conf.d/3Dtester.conf` + +``` +[program:3Dtester] +command = /opt/3Dtester/venv/bin/gunicorn -c /opt/3Dtester/gunicorn.py app:app +directory = /opt/3Dtester +user = www-data +``` +Restart supervisor +``` +systemctl restart supervisor +``` + +Now you can do things like +``` +supervisorctl status 3Dtester +supervisorctl stop 3Dtester +supervisorctl start 3Dtester +``` + +``` +netstat -tunpla | grep 8080 +``` + +## apache2 + + + + + +# Updating + +``` +cd 3D-tester +git pull origin main +``` + +# nextcloud + +We upload the 3D models to our nextcloud server. That server is on the same machine as 3Dtester. + +To make the uploaded files available we bind the directory with a mount point + +``` +mkdir /opt/3Dtester/objects/cloud +``` + +Edit `/etc/fstab` + +``` +/var/www/nextcloud/data/a_user/files/path/to/3D/samples /opt/3Dtester/objects/cloud/ none bind,ro,0 0 +``` + +Now we can mount it + +``` +mount /opt/3Dtester/objects/cloud +``` diff --git a/app.py b/app.py index 9d9d8ca..5b09488 100644 --- a/app.py +++ b/app.py @@ -20,6 +20,7 @@ along with this program. If not, see . import os, sys from pathlib import Path +import bottle from bottle import route, run, error, abort, template, response, static_file from utils.utils import BASE_DIR, OBJECT_DIR from utils import utils @@ -88,5 +89,7 @@ def render(file_path): name=file_name, object=object, ) +if __name__ == "__main__": + run(host='localhost', port=8080, debug=True) -run(host='localhost', port=8080, debug=True) +app = bottle.default_app() diff --git a/views/vue-3d.tpl b/views/vue-3d.tpl index f05e9bb..8e4fcd8 100644 --- a/views/vue-3d.tpl +++ b/views/vue-3d.tpl @@ -75,6 +75,7 @@ :backgroundAlpha="0" @on-load="onLoad" :height="height" + background-color="green" > %end @@ -93,6 +94,7 @@ new Vue({ y: 0, z: 0, }, + cameraRotation: { x: 3, y: 2, z: -1 }, }, methods: { onLoad () {