57 lines
1.3 KiB
Bash
57 lines
1.3 KiB
Bash
#!/bin/bash
|
|
|
|
BRANCH_PRODUCTION="Production"
|
|
BRANCH_WIP="aureplop/restructuring"
|
|
|
|
export SERVICE_DAPHNE_FILENAME="daphne.service"
|
|
export SERVICE_WORKER_FILENAME="worker.service"
|
|
export VENV_DIR="/home/ubuntu"
|
|
|
|
# Exit on error
|
|
set -e
|
|
|
|
. provisioning/move_apps_helpers.sh
|
|
|
|
if [[ "$DJANGO_SETTINGS_MODULE" =~ "prod" ]] ;
|
|
then
|
|
echo "!!! Hint: Don't test me in production"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Notes:"
|
|
echo " - The Vagrant DB data will be lost."
|
|
|
|
echo "-----"
|
|
|
|
echo "»»» Setup state, as of Production"
|
|
|
|
echo "- Checkout '$BRANCH_PRODUCTION'…"
|
|
git checkout "$BRANCH_PRODUCTION"
|
|
|
|
echo "- Prepare database…"
|
|
sudo -u postgres dropdb --if-exists $DBNAME
|
|
sudo -u postgres createdb $DBNAME
|
|
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE $DBNAME TO $DBUSER"
|
|
|
|
echo "- Prepare Django…"
|
|
ln -s secret_example.py cof/settings/secret.py
|
|
. ${VENV_DIR}/venv/bin/activate
|
|
export DJANGO_SETTINGS_MODULE="cof.settings.dev"
|
|
bash provisioning/prepare_django.sh
|
|
|
|
echo "- Checkout '$BRANCH_WIP'…"
|
|
git checkout "$BRANCH_WIP"
|
|
export DJANGO_SETTINGS_MODULE="gestioCOF.settings.dev"
|
|
|
|
echo "##### RUNNING move_apps.sh #####"
|
|
|
|
sh provisioning/move_apps.sh
|
|
|
|
# For production, use:
|
|
# $ git pull
|
|
# $ export DJANGO_SETTINGS_MODULE="gestioCOF.settings.prod"
|
|
# $ sh provisioning/move_apps.sh
|
|
|
|
echo "############ ENDED #############"
|
|
|
|
# Add checks below this line
|