Skip to content

Commit

Permalink
Move application code management to build.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
cdubz committed Feb 9, 2020
1 parent e2ef383 commit 0a2b210
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 12 additions & 0 deletions .sandstorm/build.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF > /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
Expand Down
12 changes: 0 additions & 12 deletions .sandstorm/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > /opt/app/babybuddy/.env
DJANGO_SETTINGS_MODULE=babybuddy.settings.sandstorm
SECRET_KEY=$SECRET_KEY
EOF

0 comments on commit 0a2b210

Please sign in to comment.