diff options
-rwxr-xr-x | install/install.sh | 11 | ||||
-rw-r--r-- | install/nginx.conf.template | 6 | ||||
-rw-r--r-- | install/uwsgi.ini.template | 2 |
3 files changed, 14 insertions, 5 deletions
diff --git a/install/install.sh b/install/install.sh index 7358ee747..049a8a34a 100755 --- a/install/install.sh +++ b/install/install.sh @@ -41,7 +41,10 @@ UWSGI_PORT=${UWSGI_PORT-8891} NGINX_PORT=${NGINX_PORT-80} # don't forget the trailing slash -INSTALL_PREFIX=/srv/ +INSTALL_PREFIX=${INSTALL_PREFIX-/srv/} +if ! echo "$INSTALL_PREFIX" | grep -qs '/$'; then + INSTALL_PREFIX="$INSTALL_PREFIX/" +fi # if a virtualenv is used put the full path of the python to use PYTHON=python @@ -235,8 +238,11 @@ $PYTHON ./manage.py migrate --fake 2> /dev/null > /dev/null echo '* uwsgi configuration' +# NOTE: Replacing #INSTALL_PREFIX#/ is done on purpose, since we +# ensured that variable has a trailing slash. sed -s "s|#APP_NAME#|$APP_NAME|g;\ s|#DB_NAME#|$DB_NAME|g;\ + s|#INSTALL_PREFIX#/|$INSTALL_PREFIX|g;\ s|#URL#|$URL|g;\ s|#UWSGI_PORT#|$UWSGI_PORT|g;" $CDIR'/uwsgi.ini.template' > \ $INSTALL_PATH'/conf/uwsgi.ini' @@ -254,11 +260,14 @@ service uwsgi restart echo '* nginx configuration' +# NOTE: Replacing #INSTALL_PREFIX#/ is done on purpose, since we +# ensured that variable has a trailing slash. sed -s "s|#APP_NAME#|$APP_NAME|g;\ s|#UWSGI_PORT#|$UWSGI_PORT|g;\ s|#DB_NAME#|$DB_NAME|g;\ s|#DATE#|$DATE|g;\ s|#NGINX_PORT#|$NGINX_PORT|g;\ + s|#INSTALL_PREFIX#/|$INSTALL_PREFIX|g;\ s|#URL#|$URL|g;" $CDIR'/nginx.conf.template' > \ $INSTALL_PATH'/conf/nginx.conf' ln -s $INSTALL_PATH'/conf/nginx.conf' \ diff --git a/install/nginx.conf.template b/install/nginx.conf.template index c41018786..8df09e859 100644 --- a/install/nginx.conf.template +++ b/install/nginx.conf.template @@ -1,18 +1,18 @@ server { listen #NGINX_PORT#; server_name #URL#; - root /srv/#DB_NAME#/ishtar/; + root #INSTALL_PREFIX#/#DB_NAME#/ishtar/; access_log /var/log/django/#APP_NAME#-access.log; error_log /var/log/django/#APP_NAME#-error.log; client_max_body_size 20M; location /static-#DATE#/ { # STATIC_URL - alias /srv/#DB_NAME#/ishtar/#APP_NAME#/static/; # STATIC_ROOT + alias #INSTALL_PREFIX#/#DB_NAME#/ishtar/#APP_NAME#/static/; # STATIC_ROOT expires 30d; } location /media/ { # MEDIA_URL - alias /srv/#DB_NAME#/ishtar/#APP_NAME#/media/; # MEDIA_ROOT + alias #INSTALL_PREFIX#/#DB_NAME#/ishtar/#APP_NAME#/media/; # MEDIA_ROOT expires 30d; } diff --git a/install/uwsgi.ini.template b/install/uwsgi.ini.template index 7a20c058c..dd8f00480 100644 --- a/install/uwsgi.ini.template +++ b/install/uwsgi.ini.template @@ -2,7 +2,7 @@ # variables projectname = #APP_NAME# projectdomain = #URL# -base = /srv/#DB_NAME#/ishtar/ +base = #INSTALL_PREFIX#/#DB_NAME#/ishtar/ # config plugins = python |