buttle 4c3dfe5d49 | ||
---|---|---|
objects | ||
static | ||
utils | ||
views | ||
.gitignore | ||
LICENSE | ||
README.md | ||
app.py | ||
run.sh |
README.md
3D tester
A utility to test 3D models.
Install on your PC
First make sure you have python3 installed
Then..
git clone https://git.hangar.org/arcHIVE-tech/3D-tester.git 3Dtester
cd 3D-tester
python3 -m venv ./venv
source ./venv/bin/activate
pip install bottle
chmod +x run.sh
Usage
cd 3D-tester
./run.sh
Now you can browse to http://localhost:8080
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 /opt/3Dtester
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
supervisorctl restart 3Dtester
Check that we are listening on the port 8080
netstat -tunpla | grep 8080
apache2
<VirtualHost *:80>
ServerName my.domain.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
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 nextcloud 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