Guest User

Untitled

a guest
Sep 18th, 2018
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. #!/bin/bash
  2. ###############################################################################
  3. set -eu # -x for verbose logging to juju debug-log
  4.  
  5. install_path ="/var/www/appflower"
  6. config_propel_ini ="/etc/appflower/propel.yml"
  7. config_database_yml="/etc/appflower/database.yml"
  8. hostname =`unit-get public-address`
  9.  
  10. juju-log "Adding AppFlower Relations"
  11. juju-log " - Retrieved hostname: $hostname"
  12.  
  13. # DATABASE RELATION
  14. ###############################################################################
  15. # Get the database settings; if not set, wait for this hook to be
  16. # invoked again
  17. database=`relation-get database`
  18. if [ -z "$database" ] ; then
  19. exit 0 # wait for future handshake from database service unit
  20. fi
  21.  
  22. # Our protocol on this interface ensures that all or none of the
  23. # settings are set. But we can verify the setting or the values if
  24. # more error checking if desired.
  25. user=`relation-get user`
  26. password=`relation-get password`
  27. host=`relation-get private-address`
  28.  
  29. # config/database.yml
  30. juju-log " - writing config/database.yml to $oonfig_database_yml"
  31. cat > $config_database_yml <<EOF
  32. dev:
  33. propel:
  34. param:
  35. classname: DebugPDO
  36.  
  37. test:
  38. propel:
  39. param:
  40. classname: DebugPDO
  41.  
  42. all:
  43. propel:
  44. class: sfPropelDatabase
  45. param:
  46. classname: PropelPDO
  47. dsn: mysql:dbname=$database;host=$host
  48. username: $user
  49. password: $password
  50. encoding: utf8
  51. persistent: true
  52. pooling: true
  53. EOF
  54.  
  55.  
  56. # BUILDING DATABASE
  57. ###############################################################################
  58. # It's time to build the database, after the connection has been established
  59. juju-log " - building the model"
  60. ./symfony propel:build-model
  61. ./symfony propel:insert-sql
  62.  
  63. # Build the cache
  64. juju-log " - Building the cache"
  65. ./symfony appflower:validator-cache frontend cache yes
Add Comment
Please, Sign In to add comment