Last active
October 6, 2015 17:47
-
-
Save mjlescano/b90987acfc5c270554e4 to your computer and use it in GitHub Desktop.
Gist to migrate a running instance of DemocracyOS on Heroku from `^0.17.0` to `1.0.0`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
log() { | |
echo "$(tput setaf 6) · $@$(tput sgr0)" | |
} | |
read -e -p 'Heroku App Name? (e.g. `legoland-democracyos`) ' APP_NAME | |
read -e -p 'Mongo Host:port/db? (e.g. `ds043991.mongolab.com:43991/heroku_app34008377`) ' MONGO_HOST | |
read -e -p 'Mongo User? ' MONGO_USER | |
read -e -p 'Mongo Pass? ' MONGO_PASS | |
log "Setting maintenance:on" | |
heroku maintenance:on -a "$APP_NAME" | |
log "Migrating Comments" | |
mongo $MONGO_HOST -u $MONGO_USER -p $MONGO_PASS --eval 'db.laws.renameCollection("topics")' | |
mongo $MONGO_HOST -u $MONGO_USER -p $MONGO_PASS --eval 'db.comments.update({ context: 'summary' }, { $set: { context: 'body' } },{ multi: true })' | |
mongo $MONGO_HOST -u $MONGO_USER -p $MONGO_PASS --eval 'db.comments.update({ context: 'law' },{ $set: { context: 'topic' } },{ multi: true })' | |
log "Unsetting Notifier Server" | |
heroku config:unset NOTIFICATIONS_TOKEN NOTIFICATIONS_URL GITHUB_PASSWORD GITHUB_USERNAME -a "$APP_NAME" | |
log "Add SendGrid Addon" | |
heroku addons:create sendgrid -a "$APP_NAME" | |
log "Setting Embebed notifier" | |
heroku config:set NOTIFICATIONS_MAILER_SERVICE='sendgrid' NOTIFICATIONS_MAILER_AUTH_USER=$(heroku config:get SENDGRID_USERNAME -a "$APP_NAME") NOTIFICATIONS_MAILER_AUTH_PASS=$(heroku config:get SENDGRID_PASSWORD -a "$APP_NAME") -a "$APP_NAME" | |
log "Pushing 1.0.0" | |
git push "$APP_NAME" 1.0.0:master -f | |
log "Setting maintenance:off" | |
heroku maintenance:off -a "$APP_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment