Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Tidy deployment script and add postgresql binding.
Browse files Browse the repository at this point in the history
  • Loading branch information
blairboy362 committed Aug 28, 2018
1 parent 7469fd8 commit 4ea98d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
26 changes: 20 additions & 6 deletions etc/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

set -e

function cycle_app() {
local app_name=$1

# ensure we don't get caught out by caching problems
# caused by the same app code having been pushed under a different
# app name in the same space (for testing purposes, perhaps).
cf delete -f ${app_name}
cf push ${app_name} --no-start
}

if [ -z "$1" ]; then
echo "Missing PAAS space argument"
echo " deploy.sh staging|production"
Expand All @@ -15,27 +25,31 @@ sudo apt-get update && sudo apt-get install cf-cli

cf login -u $PAAS_USER -p $PAAS_PASSWORD -a https://api.cloud.service.gov.uk -o gds-performance-platform -s $PAAS_SPACE

# bind services
#cf bind-service performance-platform-backdrop-read gds-performance-platform-mongodb-service
#cf bind-service performance-platform-backdrop-write gds-performance-platform-mongodb-service

# set environmental variables
cycle_app performance-platform-backdrop-read
cf set-env performance-platform-backdrop-read ENVIRONMENT $PAAS_SPACE
cf set-env performance-platform-backdrop-read STAGECRAFT_URL https://performance-platform-stagecraft-$PAAS_SPACE.cloudapps.digital
cf set-env performance-platform-backdrop-read SIGNON_API_USER_TOKEN $APP_SIGNON_API_USER_TOKEN
cf set-env performance-platform-backdrop-read DATABASE_ENGINE mongo
cf push performance-platform-backdrop-read

cycle_app performance-platform-backdrop-write
cf set-env performance-platform-backdrop-write ENVIRONMENT $PAAS_SPACE
cf set-env performance-platform-backdrop-write STAGECRAFT_URL https://performance-platform-stagecraft-$PAAS_SPACE.cloudapps.digital
cf set-env performance-platform-backdrop-write SIGNON_API_USER_TOKEN $APP_SIGNON_API_USER_TOKEN
cf set-env performance-platform-backdrop-write SECRET_KEY $APP_SECRET_KEY
cf set-env performance-platform-backdrop-write REDIS_DATABASE_NUMBER $REDIS_DATABASE_NUMBER
cf set-env performance-platform-backdrop-write DATABASE_ENGINE mongo
cf push performance-platform-backdrop-write

cycle_app performance-platform-backdrop-celery-worker
cf set-env performance-platform-backdrop-celery-worker ENVIRONMENT $PAAS_SPACE
cf set-env performance-platform-backdrop-celery-worker STAGECRAFT_OAUTH_TOKEN $APP_STAGECRAFT_OAUTH_TOKEN
cf set-env performance-platform-backdrop-celery-worker REDIS_DATABASE_NUMBER $REDIS_DATABASE_NUMBER
cf push performance-platform-backdrop-celery-worker

# deploy apps
cf push -f manifest.yml
cycle_app performance-platform-backdrop-flower
cf push performance-platform-backdrop-flower

# create and map routes
cf map-route performance-platform-backdrop-read cloudapps.digital --hostname performance-platform-backdrop-read-$PAAS_SPACE
Expand Down
2 changes: 2 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ applications:
command: python start.py read 8080
services:
- gds-performance-platform-mongodb-service
- backdrop-db

- name: performance-platform-backdrop-write
<<: *defaults
command: python start.py write 8080
services:
- gds-performance-platform-mongodb-service
- backdrop-db

- name: performance-platform-backdrop-celery-worker
<<: *defaults
Expand Down

0 comments on commit 4ea98d6

Please sign in to comment.