updates readme
This commit is contained in:
parent
16d8616f16
commit
3970792599
104
README.md
104
README.md
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
An utility to test 3D models
|
An utility to test 3D models
|
||||||
|
|
||||||
## Installation
|
# Install on your PC
|
||||||
|
|
||||||
First make sure you have python3 installed
|
First make sure you have python3 installed
|
||||||
|
|
||||||
|
@ -26,6 +26,106 @@ cd 3D-tester
|
||||||
|
|
||||||
Now you can browse to `http://localhost:8080`
|
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.
|
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
|
||||||
|
```
|
||||||
|
|
5
app.py
5
app.py
|
@ -20,6 +20,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import bottle
|
||||||
from bottle import route, run, error, abort, template, response, static_file
|
from bottle import route, run, error, abort, template, response, static_file
|
||||||
from utils.utils import BASE_DIR, OBJECT_DIR
|
from utils.utils import BASE_DIR, OBJECT_DIR
|
||||||
from utils import utils
|
from utils import utils
|
||||||
|
@ -88,5 +89,7 @@ def render(file_path):
|
||||||
name=file_name,
|
name=file_name,
|
||||||
object=object,
|
object=object,
|
||||||
)
|
)
|
||||||
|
if __name__ == "__main__":
|
||||||
run(host='localhost', port=8080, debug=True)
|
run(host='localhost', port=8080, debug=True)
|
||||||
|
|
||||||
|
app = bottle.default_app()
|
||||||
|
|
|
@ -75,6 +75,7 @@
|
||||||
:backgroundAlpha="0"
|
:backgroundAlpha="0"
|
||||||
@on-load="onLoad"
|
@on-load="onLoad"
|
||||||
:height="height"
|
:height="height"
|
||||||
|
background-color="green"
|
||||||
>
|
>
|
||||||
</model-obj>
|
</model-obj>
|
||||||
%end
|
%end
|
||||||
|
@ -93,6 +94,7 @@ new Vue({
|
||||||
y: 0,
|
y: 0,
|
||||||
z: 0,
|
z: 0,
|
||||||
},
|
},
|
||||||
|
cameraRotation: { x: 3, y: 2, z: -1 },
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onLoad () {
|
onLoad () {
|
||||||
|
|
Loading…
Reference in New Issue