Heroku
Execute commands to a Heroku application.
Type: bash
Configuration
Name | Required | Description |
---|---|---|
HEROKU_API_KEY | yes | Heroku API key |
Setup Guide
Part 1: Setup a sample Rails app on Heroku
Skip part 1 if you already have a Heroku app.
Create a Dockerfile
# Dockerfile
FROM --platform=linux/amd64 redmine
Build the image
docker build .
Use the image in a Heroku app
heroku login
heroku container:push web --app runops-heroku-app
heroku container:release web --app runops-heroku-app
Test the rails console using the running
heroku run rails runner 'puts Rails.env' --app runops-heroku-app
Part 2: Add the Heroku app to Runops
Create a Heroku authentication token
heroku authorizations:create
Create a new Runops connection and set the type to bash
. Then set the token as a configuration of your Runops connection. Either add it to your secrets provider, Agent env var, or runops-hosted secrets.
Name your variable
HEROKU_API_KEY
so that Runops can use it to talk to your app
Then you are ready to run the ruby code in the console from Runops. Run a task with the script:
heroku run rails runner 'puts Rails.env' --app runops-heroku-app
You can get an improved setup by wrapping the CLI boilerplate. With a Custom Command you can provide only the ruby code portion of this script and Runops takes care of assembling the full CLI script with your Ruby code. Let us know if you want to get access to Custom Commands.