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#

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 Configs to Targets#

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

Create a Target with configs#

Use the config flag in the CLI when creating the Target. Provide a JSON with the configs keys and values. The config name must follow the names defined for the integrations for them to become available in the execution.

🚨 Don't add spaces between the configs.

runops targets create \
--name 'my-target-with-configs' \
--type 'postgres' \
--config '{"PG_HOST":"127.0.0.1","PG_USER":"abc","PG_PASS":"123"}'

Update or add configs to a Targets#

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

runops targets update \
--name 'my-target-with-configs' \
--config '{"PG_HOST":"127.0.0.1","PG_USER":"abc","PG_PASS":"123"}'

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-configs' \
-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' \
--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' \
--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' \
--review 'team' \
--channel 'runops-reviews' \
--reviewers 'DBA,SRE,Security'
Custom markup