diff --git a/.sandstorm/build.sh b/.sandstorm/build.sh index 30f128c..93ccc27 100755 --- a/.sandstorm/build.sh +++ b/.sandstorm/build.sh @@ -1,6 +1,18 @@ #!/bin/bash set -euo pipefail +# Get application code. +cd /opt/app +rm -rf babybuddy +git clone https://github.com/babybuddy/babybuddy.git + +# Set up required application environment variables. +SECRET_KEY=$(python -c 'import random; result = "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]); print(result)') +cat < /opt/app/babybuddy/.env +DJANGO_SETTINGS_MODULE=babybuddy.settings.sandstorm +SECRET_KEY=$SECRET_KEY +EOF + # Checkout desired version and apply Sandstorm patch. VERSION=$(grep -oE 'appMarketingVersion = \(defaultText = "(.+)"' /opt/app/.sandstorm/sandstorm-pkgdef.capnp | cut -d '"' -f2) cd /opt/app/babybuddy diff --git a/.sandstorm/setup.sh b/.sandstorm/setup.sh index 553e4fa..8b396ae 100755 --- a/.sandstorm/setup.sh +++ b/.sandstorm/setup.sh @@ -10,15 +10,3 @@ apt-get install -y nginx uwsgi uwsgi-plugin-python3 python-virtualenv pipenv sql # Disable nginx (controlled by `launcher.sh`). service nginx stop systemctl disable nginx - -# Get application code. -cd /opt/app -rm -rf babybuddy -git clone https://github.com/babybuddy/babybuddy.git - -# Set up required application environment variables. -SECRET_KEY=$(python -c 'import random; result = "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]); print(result)') -cat < /opt/app/babybuddy/.env -DJANGO_SETTINGS_MODULE=babybuddy.settings.sandstorm -SECRET_KEY=$SECRET_KEY -EOF