diff options
| author | Benjamin Bouvier <public@benj.me> | 2019-07-30 00:48:37 +0200 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2019-07-31 13:02:03 +0200 |
| commit | 9a889f61c7b83834a37bf44fe2d0308fb562f3ba (patch) | |
| tree | 76c46ee6246df874851059bfab81ece993c3a574 /conf/entrypoint.sh | |
| parent | 89e78bb4d0ddccea47d8219129b5e8791fb797a6 (diff) | |
| download | ihatemoney-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/entrypoint.sh')
| -rwxr-xr-x | conf/entrypoint.sh | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/conf/entrypoint.sh b/conf/entrypoint.sh new file mode 100755 index 0000000..07dcc63 --- /dev/null +++ b/conf/entrypoint.sh @@ -0,0 +1,47 @@ +#!/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" +SQLACHEMY_DEBUG = DEBUG +SQLALCHEMY_TRACK_MODIFICATIONS = $SQLALCHEMY_TRACK_MODIFICATIONS +SECRET_KEY = "$SECRET_KEY" +MAIL_SERVER = "$MAIL_SERVER" +MAIL_PORT = $MAIL_PORT +MAIL_USE_TLS = $MAIL_USE_TLS +MAIL_USE_SSL = $MAIL_USE_SSL +MAIL_USERNAME = "$MAIL_USERNAME" +MAIL_PASSWORD = "$MAIL_PASSWORD" +MAIL_DEFAULT_SENDER = "$MAIL_DEFAULT_SENDER" +ACTIVATE_DEMO_PROJECT = $ACTIVATE_DEMO_PROJECT +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 \ + --log-syslog \ + "$@" |
