Skip to main content

Quickstart

Run your first Runops Task in 2 minutes.

If your company already uses Runops, head over to the CLI User Guide#

Setup#

Requirements

Install & signup#

Running this in the terminal will install Runops and setup your account.

npm install -g runops
runops signup

Create a Target#

A Runops Target is the resource where we run scripts. Let's create a simple python Target:

runops targets create --name 'my-first-target' --type 'python'

Run Your First Task#

Now we can create and run our first Task with a python script.

runops tasks create \
-t 'my-first-target' \
-s 'print("Hello from Runops!")'

🎉 Great! You just executed your first Runops task. Now let's run your first real-world Task.

Add Secrets to Targets#

To make Targets useful we need to add more configurations. Secrets enable Tasks to access your real Targets, like databases, AWS Accounts, and more. You can add secrets to a Target in two ways: when creating the Target, or updating it after it's created.

Create a Target with Secrets#

Use the secrets flag in the CLI when creating the Target. Provide a comma-separated list with the Secrets name and value. The Secret name must follow the names defined for the integrations for them to become available in the execution.

🚨 Don't add spaces between the secrets.

runops targets create \
--name 'my-target-with-secrets' \
--type 'postgres' \
--secrets PG_USER=abc,PG_PASS=123

Update or add Secrets to a Targets#

The Runops CLI update command always adds the new values and only updates if they already exist. Adding a secret to a Target is exactly like creating a target with a secret. You use the secrets flag. Runops creates the new values, and update existing ones.

🚨 Don't add spaces between the secrets.

runops targets update \
--name 'my-target-with-secrets' \
--type 'postgres' \
--secrets PG_HOST='my.db.host',PG_PORT=5432

Test your Target#

Now that you added credentials to your Target you can use it to access the resource you want. Let's create a Task using the Target we just configured. Note that we used postgres as the type, so we'll provide a SQL query in the script:

runops tasks create \
-t 'my-target-with-secrets' \
-s 'select 1'

You have just learned the basics of Runops and ran your first script.

Add Slack reviews to Targets#

We define review workflows on Targets, and reviews happen in Slack. Targets have 3 review modes: none, anyone, and teams. Use the runops signup command to install the Runops Slack app.

⚠️ Make sure to add the Slack bot to your Slack workspace before adding reviews.

none#

In this mode, tasks don’t have a review workflow. They are ready to run right after they are created. This mode is good for making Targets safe and easy to access. Use this mode for database read-replicas and development cloud accounts.

runops targets update \
--name 'my-target-without-reviews' \
--type 'python' \
--review 'none'

anyone#

The anyone mode lets anyone with access to the message in Slack review the Task. It’s suited for an optional peer review flow, and to notify other team members about tasks.

Required option: channel

ℹ️ For reviews on private Slack channels you must add the Runops bot to the channel.

runops targets update \
--name 'my-target-anyone-review' \
--type 'python' \
--review 'anyone' \
--channel 'runops-reviews'

team#

Use this mode when you need multiple groups to review Tasks for a Target. The team mode requires people from one or more teams to review the task. Every user is a member of a team in Runops. This is the team Runops uses to validate if a given user can make the review. The task is only fully approved after one member of each required team approves it.

Required options: channel & reviewers

ℹ️ For reviews on private Slack channels you must add the Runops bot to the channel.

runops targets update \
--name 'my-target-teams-review' \
--type 'python' \
--review 'team' \
--channel 'runops-reviews' \
--reviewers 'DBA,SRE,Security'
Custom markup