Skip to content

Instantly share code, notes, and snippets.

@dlupu
Last active January 11, 2016 07:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlupu/1597e94f8bb986d6495a to your computer and use it in GitHub Desktop.
Save dlupu/1597e94f8bb986d6495a to your computer and use it in GitHub Desktop.
Script I use to automatically deploy code to https://scalingo.com/ from https://semaphoreci.com/
### THIS SCRIPT IS EXECUTED IN THE APP ROOT FOLDER ###
# be sure scalingo.com is a known ssh host 00:00
ssh-keyscan -H -p 22 scalingo.com >> ~/.ssh/known_hosts
# install Scalingo CLO
curl -O https://cli-dl.scalingo.io/install && bash install
# DPL is a deploy tool made for continuous deployment (ruby)
gem install dpl
# Setup the `staging` git remote if its missing
git remote add staging git@scalingo.com:my-app.git || true # replace with your git repository
# This will push the `master` branch to `staging` git remote
dpl --provider=scalingo --api_key="XXXXX" --remote=staging # replace with your `api_key` from https://my.scalingo.com/profile
# HACK previous command has also logged us in into the CLI so we can use it from now on
# RUN the migrations
scalingo --remote staging run bundle exec rake db:migrate
# Restart containes
scalingo --remote staging restart
# Add here other commands like (e.g. notify newrelic a deploy has just been made)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment