kopia lustrzana https://github.com/OpenDroneMap/WebODM
Unit test, better letsencrypt challenge, gunicorn service fix
rodzic
8304fc0991
commit
fd38281085
|
@ -226,9 +226,14 @@ class Task(models.Model):
|
|||
"""
|
||||
Get a path relative to the place where assets are stored
|
||||
"""
|
||||
return self.task_path("assets", *args)
|
||||
|
||||
def task_path(self, *args):
|
||||
"""
|
||||
Get path relative to the root task directory
|
||||
"""
|
||||
return os.path.join(settings.MEDIA_ROOT,
|
||||
assets_directory_path(self.id, self.project.id, ""),
|
||||
"assets",
|
||||
*args)
|
||||
|
||||
def is_asset_available_slow(self, asset):
|
||||
|
|
|
@ -7,6 +7,7 @@ from datetime import timedelta
|
|||
|
||||
import json
|
||||
import requests
|
||||
from PIL import Image
|
||||
from django.contrib.auth.models import User
|
||||
from rest_framework import status
|
||||
from rest_framework.test import APIClient
|
||||
|
@ -67,6 +68,8 @@ class TestApiTask(BootTransactionTestCase):
|
|||
image1 = open("app/fixtures/tiny_drone_image.jpg", 'rb')
|
||||
image2 = open("app/fixtures/tiny_drone_image_2.jpg", 'rb')
|
||||
|
||||
img1 = Image.open("app/fixtures/tiny_drone_image.jpg")
|
||||
|
||||
# Not authenticated?
|
||||
res = client.post("/api/projects/{}/tasks/".format(project.id), {
|
||||
'images': [image1, image2]
|
||||
|
@ -110,6 +113,27 @@ class TestApiTask(BootTransactionTestCase):
|
|||
self.assertTrue(multiple_param_task.name == 'test_task')
|
||||
self.assertTrue(multiple_param_task.processing_node.id == pnode.id)
|
||||
|
||||
# Uploaded images should be the same size as originals
|
||||
with Image.open(multiple_param_task.task_path("tiny_drone_image.jpg")) as im:
|
||||
self.assertTrue(im.size == img1.size)
|
||||
|
||||
# Normal case with images[], GCP, name and processing node parameter and resize_to option
|
||||
res = client.post("/api/projects/{}/tasks/".format(project.id), {
|
||||
'images': [image1, image2],
|
||||
'name': 'test_task',
|
||||
'processing_node': pnode.id,
|
||||
'resize_to': img1.size[0] / 2.0
|
||||
}, format="multipart")
|
||||
self.assertTrue(res.status_code == status.HTTP_201_CREATED)
|
||||
resized_task = Task.objects.latest('created_at')
|
||||
|
||||
# Uploaded images should have been resized
|
||||
with Image.open(resized_task.task_path("tiny_drone_image.jpg")) as im:
|
||||
self.assertTrue(im.size[0] == img1.size[0] / 2.0)
|
||||
|
||||
# TODO: gcp entries should have been resized
|
||||
|
||||
|
||||
# Cannot create a task with images[], name, but invalid processing node parameter
|
||||
res = client.post("/api/projects/{}/tasks/".format(project.id), {
|
||||
'images': [image1, image2],
|
||||
|
|
|
@ -28,7 +28,7 @@ if [ $? -eq 0 ]; then
|
|||
fi
|
||||
|
||||
# Generate/update certificate
|
||||
certbot certonly --tls-sni-01-port 8000 --work-dir ./letsencrypt --config-dir ./letsencrypt --logs-dir ./letsencrypt --standalone -d $DOMAIN --register-unsafely-without-email --agree-tos --keep
|
||||
certbot certonly --tls-sni-01-port 8000 --http-01-port 8080 --work-dir ./letsencrypt --config-dir ./letsencrypt --logs-dir ./letsencrypt --standalone -d $DOMAIN --register-unsafely-without-email --agree-tos --keep
|
||||
|
||||
# Create ssl dir if necessary
|
||||
if [ ! -e ssl/ ]; then
|
||||
|
|
|
@ -8,7 +8,7 @@ User=odm
|
|||
Group=odm
|
||||
PIDFile=/run/webodm-gunicorn.pid
|
||||
WorkingDirectory=/webodm
|
||||
ExecStart=/webodm/python3-venv/bin/gunicorn webodm.wsgi --bind unix:/tmp/gunicorn.sock --timeout 360 --preload
|
||||
ExecStart=/webodm/python3-venv/bin/gunicorn webodm.wsgi --bind unix:/tmp/gunicorn.sock --timeout 300000 --max-requests 250 --preload
|
||||
ExecStop=/bin/kill -s QUIT $MAINPID
|
||||
Restart=on-failure
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue