Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ###############################################################################
- set -eu # -x for verbose logging to juju debug-log
- install_path ="/var/www/appflower"
- config_propel_ini ="/etc/appflower/propel.yml"
- config_database_yml="/etc/appflower/database.yml"
- hostname =`unit-get public-address`
- juju-log "Adding AppFlower Relations"
- juju-log " - Retrieved hostname: $hostname"
- # DATABASE RELATION
- ###############################################################################
- # Get the database settings; if not set, wait for this hook to be
- # invoked again
- database=`relation-get database`
- if [ -z "$database" ] ; then
- exit 0 # wait for future handshake from database service unit
- fi
- # Our protocol on this interface ensures that all or none of the
- # settings are set. But we can verify the setting or the values if
- # more error checking if desired.
- user=`relation-get user`
- password=`relation-get password`
- host=`relation-get private-address`
- # config/database.yml
- juju-log " - writing config/database.yml to $oonfig_database_yml"
- cat > $config_database_yml <<EOF
- dev:
- propel:
- param:
- classname: DebugPDO
- test:
- propel:
- param:
- classname: DebugPDO
- all:
- propel:
- class: sfPropelDatabase
- param:
- classname: PropelPDO
- dsn: mysql:dbname=$database;host=$host
- username: $user
- password: $password
- encoding: utf8
- persistent: true
- pooling: true
- EOF
- # BUILDING DATABASE
- ###############################################################################
- # It's time to build the database, after the connection has been established
- juju-log " - building the model"
- ./symfony propel:build-model
- ./symfony propel:insert-sql
- # Build the cache
- juju-log " - Building the cache"
- ./symfony appflower:validator-cache frontend cache yes
Add Comment
Please, Sign In to add comment