deploy 978 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. # This deploy hook gets executed after dependencies are resolved and the
  3. # build hook has been run but before the application has been started back
  4. # up again. This script gets executed directly, so it could be python, php,
  5. # ruby, etc.
  6. echo "-> Deploy step"
  7. pushd ${OPENSHIFT_REPO_DIR} > /dev/null
  8. echo "DATABASE_NAME=${OPENSHIFT_APP_NAME}" > ${OPENSHIFT_REPO_DIR}/.env
  9. echo "DATABASE_USERNAME=${OPENSHIFT_MYSQL_DB_USERNAME}" >> ${OPENSHIFT_REPO_DIR}/.env
  10. echo "DATABASE_PASSWORD=${OPENSHIFT_MYSQL_DB_PASSWORD}" >> ${OPENSHIFT_REPO_DIR}/.env
  11. echo "DATABASE_HOST=${OPENSHIFT_MYSQL_DB_HOST}" >> ${OPENSHIFT_REPO_DIR}/.env
  12. echo "DATABASE_PORT=${OPENSHIFT_MYSQL_DB_PORT}" >> ${OPENSHIFT_REPO_DIR}/.env
  13. echo "DATABASE_SOCKET=${OPENSHIFT_MYSQL_DB_SOCKET}" >> ${OPENSHIFT_REPO_DIR}/.env
  14. chmod ugo+r ${OPENSHIFT_REPO_DIR}/.env
  15. source ${OPENSHIFT_REPO_DIR}/.env
  16. gem install bundler
  17. echo "Migrating"
  18. RAILS_ENV="production" bundle exec rake db:migrate
  19. popd > /dev/null