From 8a08c02f506523262d73b75b6635c5fb56808d0d Mon Sep 17 00:00:00 2001 From: thomas Date: Mon, 1 Mar 2021 01:57:01 +0000 Subject: [PATCH] =?UTF-8?q?Mise=20=C3=A0=20jour=20de=20'librephotos.sh'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- librephotos.sh | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/librephotos.sh b/librephotos.sh index fde9f47..0ddd960 100644 --- a/librephotos.sh +++ b/librephotos.sh @@ -26,9 +26,8 @@ pip3 install torch==1.7.1+cpu torchvision==0.8.2+cpu -f https://download.pytorch pip3 install -v --install-option="--no" --install-option="DLIB_USE_CUDA" --install-option="--no" --install-option="USE_AVX_INSTRUCTIONS" --install-option="--no" --install-option="USE_SSE4_INSTRUCTIONS" dlib cd /usr/src -git clone https://github.com/LibrePhotos/librephotos +git clone https://github.com/tomamplius/librephotos cd librephotos -sed 's/geopy==1.11.0/geopy==2.1.0/' -i requirements.txt pip3 install -r requirements.txt python3 -m spacy download en_core_web_sm @@ -51,6 +50,10 @@ cd /usr/src/librephotos/ export PYTHONUNBUFFERED=TRUE mkdir -p /logs +#! /bin/bash +cd /usr/src/librephotos/ +export PYTHONUNBUFFERED=TRUE +mkdir -p /logs export PYTHONUNBUFFERED=TRUE export BACKEND_HOST=localhost export DB_BACKEND=postgresql @@ -73,6 +76,27 @@ export ADMIN_EMAIL=thomas@lgy.fr export ADMIN_PASSWORD=toto export MAPBOX_API_KEY= export DEBUG=0 +export BASE_DATA=/var/lib/librephotos/ +export BASE_LOGS=/var/log/librephotos/ + +python3 image_similarity/main.py 2>&1 | tee $BASE_LOGS/gunicorn_image_similarity.log & +python3 manage.py showmigrations | tee $BASE_LOGS/show_migrate.log +python3 manage.py migrate | tee $BASE_LOGS/command_migrate.log +python3 manage.py showmigrations | tee $BASE_LOGS/show_migrate.log +python3 manage.py build_similarity_index 2>&1 | tee $BASE_LOGS/command_build_similarity_index.log +python3 manage.py clear_cache +python3 manage.py createadmin -u $ADMIN_USERNAME $ADMIN_EMAIL 2>&1 | tee $BASE_LOGS/command_createadmin.log +echo "Running backend server..." +python3 manage.py rqworker default 2>&1 | tee $BASE_LOGS/rqworker.log & +if [ "$DEBUG" = 1 ] +then + echo "develompent backend starting" + gunicorn --worker-class=gevent --timeout 36000 --reload --bind localhost:8001 --log-level=info ownphotos.wsgi 2>&1 | tee $BASE_LOGS/gunicorn_django.log +else + echo "production backend starting" + gunicorn --worker-class=gevent --timeout 3600 --bind localhost:8001 --log-level=info ownphotos.wsgi 2>&1 | tee $BASE_LOGS/gunicorn_django.log +fi + python3 image_similarity/main.py 2>&1 | tee /logs/gunicorn_image_similarity.log & python3 manage.py showmigrations | tee /logs/show_migrate.log @@ -160,18 +184,17 @@ http { # Django media location /protected_media { internal; - alias /protected_media/; + alias /var/lib/librephotos/protected_media/; } - # Original Photos location /original { internal; - alias /data/; + alias /var/lib/librephotos/data/; } # Nextcloud Original Photos location /nextcloud_original { internal; - alias /data/nextcloud_media/; + alias /var/lib/librephotos/data/nextcloud_media/; } } }