|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +DEBIAN_FRONTEND=noninteractive |
| 4 | + |
| 5 | +# install required system packages |
| 6 | +# HACK: install git so we can install bacongobbler's fork of django-fsm |
| 7 | +# install openssh-client for temporary fleetctl wrapper |
| 8 | +apt-get update && \ |
| 9 | + apt-get install -yq python-dev libpq-dev libyaml-dev git |
| 10 | + |
| 11 | +# install pip |
| 12 | +curl -sSL https://raw.githubusercontent.com/pypa/pip/1.5.6/contrib/get-pip.py | python - |
| 13 | + |
| 14 | +# add a deis user that has passwordless sudo (for now) |
| 15 | +useradd deis --groups sudo --home-dir /app --shell /bin/bash |
| 16 | +sed -i -e 's/%sudo\tALL=(ALL:ALL) ALL/%sudo\tALL=(ALL:ALL) NOPASSWD:ALL/' /etc/sudoers |
| 17 | + |
| 18 | +# create a /app directory for storing application data |
| 19 | +mkdir -p /app && chown -R deis:deis /app |
| 20 | + |
| 21 | +# create directory for confd templates |
| 22 | +mkdir -p /templates && chown -R deis:deis /templates |
| 23 | + |
| 24 | +# create directory for logs |
| 25 | +mkdir -p /var/log/deis && chown -R deis:deis /var/log/deis |
| 26 | + |
| 27 | +# install dependencies |
| 28 | +pip install -r /app/requirements.txt |
| 29 | + |
| 30 | +# Create static resources |
| 31 | +/app/manage.py collectstatic --settings=deis.settings --noinput |
| 32 | + |
| 33 | +# cleanup. indicate that python, libpq and libyanl are required packages. |
| 34 | +apt-mark unmarkauto python python-openssl libpq5 libpython2.7 libyaml-0-2 && \ |
| 35 | + apt-get remove -y --purge python-dev gcc cpp libpq-dev libyaml-dev git && \ |
| 36 | + apt-get autoremove -y --purge && \ |
| 37 | + apt-get clean -y && \ |
| 38 | + rm -Rf /usr/share/man /usr/share/doc && \ |
| 39 | + rm -rf /tmp/* /var/tmp/* && \ |
| 40 | + rm -rf /var/lib/apt/lists/* |
0 commit comments