3D-tester/README.md

138 lines
2.2 KiB
Markdown
Raw Normal View History

2021-06-13 14:11:22 +02:00
# 3D tester
A utility to test 3D models.
2021-06-13 14:11:22 +02:00
2021-06-18 20:27:33 +02:00
# Install on your PC
2021-06-13 14:11:22 +02:00
First make sure you have python3 installed
Then..
```
git clone https://git.hangar.org/arcHIVE-tech/3D-tester.git 3Dtester
2021-06-13 14:11:22 +02:00
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`
2021-06-18 20:27:33 +02:00
## Adding 3D models
2021-06-13 14:11:22 +02:00
Add your 3D models to the `./objects` folder. Create subdirectories as needed.
2021-06-18 20:27:33 +02:00
# Install on a server
```
git clone https://git.hangar.org/arcHIVE-tech/3D-tester.git /opt/3Dtester
cd /opt/3Dtester
2021-06-18 20:27:33 +02:00
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
2021-06-18 20:27:33 +02:00
```
Check that we are listening on the port 8080
2021-06-18 20:27:33 +02:00
```
netstat -tunpla | grep 8080
```
## apache2
2021-06-19 08:14:50 +02:00
```
<VirtualHost *:80>
ServerName my.domain.com
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
</VirtualHost>
```
2021-06-18 20:27:33 +02:00
# 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
2021-06-18 20:27:33 +02:00
```
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
```