mirror of
https://github.com/YunoHost-Apps/librephotos_ynh.git
synced 2024-09-03 19:36:12 +02:00
Improvements
This commit is contained in:
parent
31de75b5ed
commit
c56ccd9c6b
3 changed files with 34 additions and 38 deletions
|
@ -17,27 +17,27 @@ location ~ ^/(api|media)/ {
|
|||
}
|
||||
|
||||
# Django media
|
||||
location /protected_media {
|
||||
location /protected_media/ {
|
||||
internal;
|
||||
alias /home/yunohost.app/__NAME__/protected_media/;
|
||||
}
|
||||
|
||||
location /static/drf-yasg {
|
||||
location /static/drf-yasg/ {
|
||||
proxy_pass http://127.0.0.1:__BACKEND_PORT__;
|
||||
}
|
||||
|
||||
location /data {
|
||||
location /data/ {
|
||||
internal;
|
||||
alias /home/yunohost.app/__NAME__/data/;
|
||||
}
|
||||
|
||||
# Original Photos
|
||||
location /original {
|
||||
location /original/ {
|
||||
internal;
|
||||
alias /home/yunohost.app/__NAME__/data/;
|
||||
}
|
||||
# Nextcloud Original Photos
|
||||
location /nextcloud_original {
|
||||
location /nextcloud_original/ {
|
||||
internal;
|
||||
alias /home/yunohost.app/__NAME__/data/nextcloud_media/;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ function unpack_source {
|
|||
ynh_setup_source --source_id="miniforge3" --dest_dir="$CONDA_DIR"
|
||||
ynh_setup_source --source_id="cmake" --dest_dir="$final_path/backend/cmake/"
|
||||
else
|
||||
wget -O "${CONDA_DIR}/Miniforge3-4.10.1-4-Linux-aarch64.sh" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh
|
||||
wget -O "${CONDA_DIR}/Miniforge3-4.10.1-4-Linux-aarch64.sh" https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh 2>&1
|
||||
ynh_setup_source --source_id="cmake_amd64" --dest_dir="$final_path/backend/cmake/"
|
||||
fi
|
||||
#ynh_setup_source --source_id="faiss" --dest_dir="$final_path/backend/faiss/"
|
||||
|
@ -56,6 +56,7 @@ function set_up_backend {
|
|||
backend_path="$final_path/backend"
|
||||
pushd "$backend_path"
|
||||
chown -R $app:$app "$backend_path"
|
||||
chown -R $app:$app $data_path
|
||||
ynh_exec_warn_less ynh_exec_as $app python3 -m venv $backend_path/venv
|
||||
path_prefix="$backend_path/venv/bin"
|
||||
if [ "$YNH_ARCH" = "arm64" ] || [ "$arm64_test" -eq 1 ]; then
|
||||
|
@ -85,15 +86,14 @@ function set_up_backend {
|
|||
else
|
||||
ynh_exec_warn_less ynh_exec_as $app env "PATH=$python_path" pip --cache-dir "$cache_dir" install -U torch==1.8.0+cpu torchvision==0.9.0+cpu -f https://download.pytorch.org/whl/torch_stable.html
|
||||
fi
|
||||
pushd "$backend_path/dlib"
|
||||
ynh_exec_warn_less ynh_exec_as $app env "PATH=$python_path" python setup.py install
|
||||
popd
|
||||
install_dlib
|
||||
ynh_exec_warn_less ynh_exec_as $app env "PATH=$python_path" pip --cache-dir "$cache_dir" install -U --requirement "$backend_path/requirements.txt"
|
||||
ynh_exec_warn_less ynh_exec_as $app env "PATH=$python_path" pip --cache-dir "$cache_dir" install -U --requirement "$backend_path/requirements-ynh.txt"
|
||||
#if [ "$YNH_ARCH" = "arm64" ] || [ "$arm64_test" -eq 1 ]; then
|
||||
#ynh_exec_warn_less ynh_exec_as $app unzip "$CONDA_DIR/lib/python3.8/site-packages/"faiss*.egg -d "$CONDA_DIR/lib/python3.8/site-packages/"
|
||||
#fi
|
||||
chown -R root:root "$backend_path"
|
||||
chown -R root:root $data_path
|
||||
popd
|
||||
}
|
||||
|
||||
|
@ -115,11 +115,12 @@ function set_up_frontend {
|
|||
frontend_path=$final_path/frontend
|
||||
pushd $final_path/frontend
|
||||
chown -R $app:$app $frontend_path
|
||||
ynh_exec_warn_less ynh_exec_as $app touch $frontend_path/.yarnrc
|
||||
ynh_exec_warn_less ynh_exec_as $app env "PATH=$node_PATH" yarn --cache-folder $frontend_path/yarn-cache --use-yarnrc $frontend_path/.yarnrc install --legacy-peer-deps
|
||||
ynh_exec_warn_less ynh_exec_as $app env "PATH=$node_PATH" yarn --cache-folder $frontend_path/yarn-cache --use-yarnrc $frontend_path/.yarnrc run build
|
||||
ynh_exec_warn_less ynh_exec_as $app env "PATH=$node_PATH" yarn --cache-folder $frontend_path/yarn-cache --use-yarnrc $frontend_path/.yarnrc add serve
|
||||
chown -R $app:$app $data_path
|
||||
export NODE_OPTIONS="--max-old-space-size=8192"
|
||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm install --legacy-peer-deps
|
||||
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build
|
||||
chown -R root:root $frontend_path
|
||||
chown -R root:root $data_path
|
||||
popd
|
||||
}
|
||||
|
||||
|
|
|
@ -2,60 +2,55 @@ diff --git a/ownphotos/settings.py b/ownphotos/settings.py
|
|||
index 3449af1..f1a6be7 100644
|
||||
--- a/ownphotos/settings.py
|
||||
+++ b/ownphotos/settings.py
|
||||
@@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/1.11/ref/settings/
|
||||
@@ -11,6 +11,7 @@
|
||||
"""
|
||||
import datetime
|
||||
import os
|
||||
+import ldap, tzlocal
|
||||
|
||||
for envvar in (
|
||||
'SECRET_KEY',
|
||||
@@ -76,7 +77,7 @@ CONSTANCE_CONFIG = {
|
||||
'IMAGE_DIRS': ("/data", 'Image dirs list (serialized json)', str)
|
||||
"SECRET_KEY",
|
||||
@@ -77,7 +78,7 @@
|
||||
"IMAGE_DIRS": ("/data", "Image dirs list (serialized json)", str),
|
||||
}
|
||||
|
||||
-INTERNAL_IPS = ('127.0.0.1', 'localhost', '192.168.1.100')
|
||||
+INTERNAL_IPS = ('127.0.0.1', 'localhost')
|
||||
-INTERNAL_IPS = ("127.0.0.1", "localhost", "192.168.1.100")
|
||||
+INTERNAL_IPS = ("127.0.0.1", "localhost")
|
||||
|
||||
CORS_ALLOW_HEADERS = (
|
||||
'cache-control',
|
||||
@@ -93,10 +94,11 @@ CORS_ALLOW_HEADERS = (
|
||||
'x-requested-with',
|
||||
"cache-control",
|
||||
@@ -94,7 +95,9 @@
|
||||
"x-requested-with",
|
||||
)
|
||||
|
||||
-CORS_ORIGIN_WHITELIST = (
|
||||
- 'http://localhost:3000',
|
||||
- 'http://192.168.1.100:3000'
|
||||
-)
|
||||
-CORS_ORIGIN_WHITELIST = ("http://localhost:3000", "http://192.168.1.100:3000")
|
||||
+BACKEND_PORT=os.environ['httpPort']
|
||||
+
|
||||
+CORS_ORIGIN_WHITELIST = [
|
||||
+ 'http://localhost:' + BACKEND_PORT
|
||||
+]
|
||||
+CORS_ORIGIN_WHITELIST = ('http://localhost:' + BACKEND_PORT)
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_PERMISSION_CLASSES': (
|
||||
@@ -231,7 +233,7 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
|
||||
@@ -219,7 +222,7 @@
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = "en-us"
|
||||
|
||||
-TIME_ZONE = os.environ['TIME_ZONE']
|
||||
-TIME_ZONE = os.environ["TIME_ZONE"]
|
||||
+TIME_ZONE = tzlocal.get_localzone().zone
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
@@ -267,8 +269,8 @@ FULLPHOTO_SIZE = (1000, 1000)
|
||||
@@ -258,8 +261,8 @@
|
||||
CORS_ORIGIN_ALLOW_ALL = False
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
|
||||
-IMAGE_SIMILARITY_SERVER = 'http://localhost:8002'
|
||||
-IMAGE_SIMILARITY_SERVER = "http://localhost:8002"
|
||||
-
|
||||
+IMAGE_SIMILARITY_SERVER_PORT=os.environ['IMAGE_SIMILARITY_SERVER_PORT']
|
||||
+IMAGE_SIMILARITY_SERVER = 'http://localhost:' + IMAGE_SIMILARITY_SERVER_PORT
|
||||
|
||||
#Must be less or egal of nb core CPU ( Nearly 2GB per process)
|
||||
HEAVYWEIGHT_PROCESS_ENV = os.environ.get('HEAVYWEIGHT_PROCESS', '1')
|
||||
@@ -289,3 +291,12 @@ LOGGING = {
|
||||
# Must be less or egal of nb core CPU ( Nearly 2GB per process)
|
||||
HEAVYWEIGHT_PROCESS_ENV = os.environ.get("HEAVYWEIGHT_PROCESS", "1")
|
||||
@@ -282,3 +285,12 @@
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue