Deploy to Scalingo from CircleCI

This page describes the steps to setup Continuous Deployment from CircleCI to Scalingo. Follow this guide to automatically deploy to Scalingo after a successful build.

Setup .circleci/config.yml

To trigger a deployment after a successful build on CircleCI you have to add a deploy job and configure workflows in your .circleci/config.yml:

version: 2
      # Add steps to build your app
    resource_class: small # Or another size, depending on your plan possibilities
      - image: cimg/base:2023.10 # CircleCI base images include git by default
      - checkout # Checkout your app's git repo
      - run:
          name: Add Scalingo to known_hosts
          command: mkdir -p ~/.ssh && ssh-keyscan -H ssh.[region] >> ~/.ssh/known_hosts
      - run:
          name: Deploy on Scalingo
          command: |
            git push git@ssh.[region] master
  version: 2
      - build
      - deploy:
            - build
              only: master

You can read more about Configuring CircleCI Deployment on the CircleCI documentation.

SSH Keys

To deploy to Scalingo from CircleCI, you’ll have to add your private key to the CircleCI interface. On CircleCI website, head over to your project’s Project Settings, then the SSH keys page to add your key. You will also need to add the public key to the SSH Keys page on Scalingo Dashboard.

We recommend to generate a new key pair for integrating CircleCI with Scalingo.

Executing post-deployment commands

You can define postdeploy hook integrated in your Procfile. If you still prefer to run post-deployment commands at CircleCI level, you will have to download our command line tool in the CircleCI environment and use the scalingo run command.

command: |
  ssh-keyscan -H ssh.[region] >> ~/.ssh/known_hosts
  git push git@ssh.[region] $CIRCLE_SHA1:master
  curl -LO
  tar xvf scalingo_1.6.0_linux_amd64.tar.gz
  scalingo_1.6.0_linux_amd64/scalingo --app my-app login --ssh
  scalingo_1.6.0_linux_amd64/scalingo --app my-app run rake db:migrate

Suggest edits

Deploy to Scalingo from CircleCI

©2024 Scalingo