aboutsummaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
authorBenjamin Bouvier <public@benj.me>2019-07-30 00:48:37 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2019-07-31 13:02:03 +0200
commit9a889f61c7b83834a37bf44fe2d0308fb562f3ba (patch)
tree76c46ee6246df874851059bfab81ece993c3a574 /conf
parent89e78bb4d0ddccea47d8219129b5e8791fb797a6 (diff)
downloadihatemoney-mirror-9a889f61c7b83834a37bf44fe2d0308fb562f3ba.zip
ihatemoney-mirror-9a889f61c7b83834a37bf44fe2d0308fb562f3ba.tar.gz
ihatemoney-mirror-9a889f61c7b83834a37bf44fe2d0308fb562f3ba.tar.bz2
[docker] Download IHM from Pypy or reference git repo;
This creates two modes to run the Docker image: - either in non-NIGHTLY mode, the latest version will be installed from pypy. - or in Nightly mode, it will clone the repository and update it every time the instance is restarted. It also updates Python to 3.7, for additional goodness.
Diffstat (limited to 'conf')
-rwxr-xr-xconf/entrypoint.sh (renamed from conf/confandrun.sh)23
1 files changed, 23 insertions, 0 deletions
diff --git a/conf/confandrun.sh b/conf/entrypoint.sh
index b08bf97..07dcc63 100755
--- a/conf/confandrun.sh
+++ b/conf/entrypoint.sh
@@ -1,4 +1,8 @@
#!/bin/sh
+
+# Fail the whole script on the first failure.
+set -e
+
cat <<EOF > /etc/ihatemoney/ihatemoney.cfg
DEBUG = $DEBUG
SQLALCHEMY_DATABASE_URI = "$SQLALCHEMY_DATABASE_URI"
@@ -17,6 +21,25 @@ ADMIN_PASSWORD = '$ADMIN_PASSWORD'
ALLOW_PUBLIC_PROJECT_CREATION = $ALLOW_PUBLIC_PROJECT_CREATION
ACTIVATE_ADMIN_DASHBOARD = $ACTIVATE_ADMIN_DASHBOARD
EOF
+
+if [ ! -z "$NIGHTLY" ]; then
+ # Clone or update repository into /ihatemoney.
+ if [ ! -d /ihatemoney/.git ]; then
+ echo "Cloning..."
+ git clone --depth 1 https://github.com/spiral-project/ihatemoney /ihatemoney
+ echo "Done cloning."
+ else
+ cd /ihatemoney
+ echo "Updating..."
+ git pull || echo "Couldn't update; maybe Github is unreachable?"
+ echo "Done updating."
+ fi
+ pip install --no-cache-dir -e /ihatemoney
+else
+ # Get the latest release from PyPy.
+ pip install --no-cache-dir --upgrade ihatemoney
+fi
+
# Start gunicorn without forking
exec gunicorn ihatemoney.wsgi:application \
-b 0.0.0.0:8000 \