From 1ce33422cf54a97e9df87de160006e4eaa93c810 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Holcroft Date: Thu, 14 Sep 2017 09:33:06 +0200 Subject: [PATCH] Removed location hierarchy, and use __NAME__ instead of __APP__ so ynh nginx help works as expected --- conf/nginx.conf | 50 ++++++++++++++++++++++++------------------------ conf/settings.py | 4 ++-- conf/uwsgi.ini | 6 +++--- scripts/install | 4 ++-- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index a7f18bf..9f38d52 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -3,37 +3,37 @@ location __PATH__ { # Path to source alias __FINALPATH__/ ; - location __PATH__/favicon.ico { - # DATA_DIR/static/favicon.ico - alias __FINALPATH__/static/favicon.ico; - expires 30d; - } - - location __PATH__/robots.txt { - # DATA_DIR/static/robots.txt - alias __FINALPATH__/static/robots.txt; - expires 30d; - } - - location __PATH__/static { - # DATA_DIR/static/ - alias __FINALPATH__/static/; - expires 30d; - } - - location __PATH__/media { - # DATA_DIR/media/ - alias __FINALPATH__/media/; - expires 30d; - } - include uwsgi_params; # Needed for long running operations in admin interface uwsgi_read_timeout 3600; # Adjust based to uwsgi configuration: - uwsgi_pass unix:///opt/__APP__/uwsgi.sock + uwsgi_pass unix:///opt/__NAME__/uwsgi.sock # uwsgi_pass 127.0.0.1:8080; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } + +location __PATH__/favicon.ico { + # DATA_DIR/static/favicon.ico + alias __FINALPATH__/static/favicon.ico; + expires 30d; +} + +location __PATH__/robots.txt { + # DATA_DIR/static/robots.txt + alias __FINALPATH__/static/robots.txt; + expires 30d; +} + +location __PATH__/static { + # DATA_DIR/static/ + alias __FINALPATH__/static/; + expires 30d; +} + +location __PATH__/media { + # DATA_DIR/media/ + alias __FINALPATH__/media/; + expires 30d; +} diff --git a/conf/settings.py b/conf/settings.py index f1ca838..4640a9b 100644 --- a/conf/settings.py +++ b/conf/settings.py @@ -40,9 +40,9 @@ DATABASES = { # Database engine 'ENGINE': 'django.db.backends.mysql', # Database name - 'NAME': '__APP__', + 'NAME': '__NAME__', # Database user - 'USER': '__APP__', + 'USER': '__NAME__', # Database password 'PASSWORD': '__DB_PWD__', # Set to empty string for localhost diff --git a/conf/uwsgi.ini b/conf/uwsgi.ini index 4eb5490..f97a6b2 100644 --- a/conf/uwsgi.ini +++ b/conf/uwsgi.ini @@ -1,5 +1,5 @@ [uwsgi] -uid = __APP__ +uid = __NAME__ gid = users protocol = uwsgi @@ -22,10 +22,10 @@ master = true # maximum number of worker processes processes = 4 # the socket (use the full path to be safe -socket = /opt/__APP__/uwsgi.sock +socket = /opt/__NAME__/uwsgi.sock # ... with appropriate permissions - may be needed chmod-socket = 666 -stats = /opt/__APP__/stats.sock +stats = /opt/__NAME__/stats.sock # clear environment on exit vacuum = true plugins = python3 diff --git a/scripts/install b/scripts/install index 921df1f..82337dd 100755 --- a/scripts/install +++ b/scripts/install @@ -118,7 +118,7 @@ ynh_system_user_create $app # Copy Files sudo cp ../conf/uwsgi.ini $final_path/uwsgi.ini -ynh_replace_string "__APP__" "$app" $final_path/uwsgi.ini +ynh_replace_string "__NAME__" "$app" $final_path/uwsgi.ini ynh_replace_string "__FINALPATH__" "$finalpath" $final_path/uwsgi.ini # Config service @@ -144,7 +144,7 @@ key=$(ynh_string_random 64) sudo cp $final_path/weblate/settings_example.py $final_path/weblate/settings.py sudo cp ../conf/settings.py $final_path/weblate/settings.py -ynh_replace_string "__APP__" "$app" $final_path/settings.py +ynh_replace_string "__NAME__" "$app" $final_path/settings.py ynh_replace_string "__DB_PWD__" "$db_pwd" $final_path/weblate/settings.py ynh_replace_string "__ADMIN__" "$admin" $final_path/weblate/settings.py ynh_replace_string "__ADMINMAIL__" "$admin_mail" $final_path/weblate/settings.py