You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
870 B

  1. #!/bin/bash
  2. . lib/common
  3. set -e
  4. DBNAME="$(relation-get dbname)" || exit 1
  5. initing="${GOGOCARTO_CODE}"/.initing-${DBNAME}
  6. if [ -e "$initing" ]; then
  7. exit 0
  8. fi
  9. inited="${GOGOCARTO_CODE}"/.inited-${DBNAME}
  10. MONGO_URL=mongodb://${TARGET_SERVICE_NAME}:27017
  11. cat <<EOF >> ${GOGOCARTO_CODE}/.env
  12. ###> doctrine/mongodb-odm-bundle ###
  13. MONGODB_URL=$MONGO_URL
  14. MONGODB_DATABASE=$DBNAME
  15. ###< doctrine/mongodb-odm-bundle ###
  16. EOF
  17. if [ -e "$inited" ]; then
  18. exit 0
  19. fi
  20. ## came from ``Makefile`` in git's gogocarto source code. Target load-fixtures.
  21. touch "$initing"
  22. trap_add EXIT,ERR "rm -v \"$initing\""
  23. symphony doctrine:mongodb:schema:create &&
  24. symphony doctrine:mongodb:generate:hydrators &&
  25. symphony doctrine:mongodb:generate:proxies &&
  26. symphony doctrine:mongodb:fixtures:load -n || {
  27. err "Mongo database initialization failed."
  28. exit 1
  29. }
  30. touch "$inited"