Commit c5b3e1e1 authored by sim's avatar sim

[CONF] Support running uWSGI from outside of pipenv shell

parent 28b3c385
...@@ -24,6 +24,9 @@ endif = ...@@ -24,6 +24,9 @@ endif =
# needed to run uwsgi when it was not installed with pipenv # needed to run uwsgi when it was not installed with pipenv
plugins = python35 plugins = python35
# needed to run uwsgi outside of pipenv shell, because of this virtualenv bug:
# https://github.com/kennethreitz/pipenv/issues/829
home = {VENV}
# unix socket is better than TCP one, there is less overhead # unix socket is better than TCP one, there is less overhead
socket = /tmp/gargantext.sock socket = /tmp/gargantext.sock
chmod-socket = 664 chmod-socket = 664
......
...@@ -45,6 +45,9 @@ done ...@@ -45,6 +45,9 @@ done
# Target can be dev or prod # Target can be dev or prod
TARGET="${1:-dev}" TARGET="${1:-dev}"
# Virtual environment directory
VENV=$(pipenv --venv)
# Gargantext configuration file path # Gargantext configuration file path
[ -z "$GARGANTEXT_CONF" ] && GARGANTEXT_CONF=gargantext.ini [ -z "$GARGANTEXT_CONF" ] && GARGANTEXT_CONF=gargantext.ini
...@@ -134,6 +137,7 @@ DB_PORT=$(escape_ini "${DB_PORT:-5432}") ...@@ -134,6 +137,7 @@ DB_PORT=$(escape_ini "${DB_PORT:-5432}")
DB_NAME=$(escape_ini "$DB_NAME") DB_NAME=$(escape_ini "$DB_NAME")
DB_USER=$(escape_ini "$DB_USER") DB_USER=$(escape_ini "$DB_USER")
DB_PASS=$(escape_ini "$DB_PASS") DB_PASS=$(escape_ini "$DB_PASS")
VENV=$(escape_ini "$VENV")
echo "▸ Generate configuration file from $GARGANTEXT_TEMPLATE..." echo "▸ Generate configuration file from $GARGANTEXT_TEMPLATE..."
sed -E -e "s/[{]DEBUG[}]/$DEBUG/g" \ sed -E -e "s/[{]DEBUG[}]/$DEBUG/g" \
...@@ -143,6 +147,7 @@ sed -E -e "s/[{]DEBUG[}]/$DEBUG/g" \ ...@@ -143,6 +147,7 @@ sed -E -e "s/[{]DEBUG[}]/$DEBUG/g" \
-e "s/[{]DB_NAME[}]/$DB_NAME/g" \ -e "s/[{]DB_NAME[}]/$DB_NAME/g" \
-e "s/[{]DB_USER[}]/$DB_USER/g" \ -e "s/[{]DB_USER[}]/$DB_USER/g" \
-e "s/[{]DB_PASS[}]/$DB_PASS/g" \ -e "s/[{]DB_PASS[}]/$DB_PASS/g" \
-e "s/[{]VENV[}]/$VENV/g" \
"$GARGANTEXT_TEMPLATE" > "$GARGANTEXT_CONF" \ "$GARGANTEXT_TEMPLATE" > "$GARGANTEXT_CONF" \
&& echo "Configuration for $TARGET environment written successfully in" \ && echo "Configuration for $TARGET environment written successfully in" \
"$GARGANTEXT_CONF." "$GARGANTEXT_CONF."
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment