Skip to main content

CLI client tool for deploying workloads to Racetrack

Project description

Racetrack CLI client

racetrack-client is a CLI client tool for deploying and managing workloads in Racetrack.

Racetrack system allows to deploy jobs in a one step. It transforms your code to in-operation workloads, e.g. Kubernetes workloads. You write some code according to a set of coventions, you include the manifest file which explains the code, and you submit it to Racetrack. A short while after, the service calling your code is in operation.

Quickstart

# Install racetrack-client
python3 -m pip install --upgrade racetrack-client

# Set current remote
racetrack set remote https://racetrack.platform.example.com

# Log in with token
racetrack login T0k3n.g0es.H3r3
# Or log in with username
racetrack login --username admin

# Deploy a Job
racetrack deploy

Installation

Install racetrack-client using pip:

python3 -m pip install --upgrade racetrack-client

Python 3.8 (or higher) is required.

This will install racetrack CLI tool. Verify installation by running racetrack command.

Usage

Run racetrack --help to see usage.

Adding a remote

Assuming your Racetrack server is running on https://racetrack.platform.example.com/lifecycle, you can add this remote as an alias:

racetrack set alias my-dev https://racetrack.platform.example.com/lifecycle

Alias is a short, friendly name for the URL of your Racetrack server, which is also known as "remote". From now on, you can refer to your remote with an alias.

Switching remotes

Set your current remote with:

racetrack set remote my-dev

This will set up a "remote" context for later use.

Logging in

Log in to Racetrack with your user account (you can get your token from the Dashboard's profile page):

racetrack login T0k3n.g0es.H3r3

Alternatively, command racetrack login --username <username> allows you to log in with your username and password (entered into the standard input) and saves the auth token without having to visit the Dashboard page.

In case you're going to use a private repository, provide your git credentials so the job can be built from your code:

racetrack set credentials https://github.com/YourUser/YourRepository USERNAME TOKEN

Installing plugins

Extend Racetrack's possibilities by installing a bunch of plugins:

# This plugin allows you to deploy jobs written in Python
racetrack plugin install github.com/TheRacetrack/plugin-python-job-type

# This plugin allows you to deploy jobs to a local Docker infrastructure
racetrack plugin install github.com/TheRacetrack/plugin-docker-infrastructure

Plugins can only be installed by admin users.

Deploying a job

When your code is ready and you pushed your changes to a repository, it's time to deploy it; that means, upload it to Racetrack so it can become a proper running Job.

To deploy a job, just run it in the place where job.yaml is located:

cd MuffinDestroyer
racetrack deploy 

You will see the URL of your deployed job in the output.

Listing jobs

You can see the list of all deployed jobs with a command:

racetrack list

Checking runtime logs

Check the logs of a running job by means of:

racetrack logs MuffinDestroyer

Deleting a job

Delete your running job with:

racetrack delete MuffinDestroyer

Extra vars

Manifest values can be overriden with key-value pairs coming from a command line. It doesn't modify actual file, but its one-time, in-memory version before submitting it. Racetrack client has --extra-vars KEY=VALUE parameter (or -e in short) that overwrites values found in YAML manifest.

  • KEY is the name of field and it can contain dots to refer to a nested field, for example git.branch=master
  • VALUE can be any YAML or JSON object.

Extra vars parameters can be used multiple times in one command.

Example:

racetrack deploy -e secret_runtime_env_file=.env.local -e git.branch=$(git rev-parse --abbrev-ref HEAD)

It makes CLI commands more script-friendly, so you can overwrite manifest without tracking changes in job.yaml file.
Tip: Use racetrack validate command beforehand to make sure your final manifest is what you expected.

Getting auth token

Command racetrack get auth-token prints out current auth token. It can be used in CLI scripts: curl -H "X-Racetrack-Auth: $(racetrack get auth-token)"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

racetrack-client-2.22.0.tar.gz (42.3 kB view details)

Uploaded Source

Built Distribution

racetrack_client-2.22.0-py3-none-any.whl (54.2 kB view details)

Uploaded Python 3

File details

Details for the file racetrack-client-2.22.0.tar.gz.

File metadata

  • Download URL: racetrack-client-2.22.0.tar.gz
  • Upload date:
  • Size: 42.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for racetrack-client-2.22.0.tar.gz
Algorithm Hash digest
SHA256 7a3daa19dcca80cdda166bdbac87f71f1eaa3c25a233d58193958d07f7338e38
MD5 e71ae017a2da8009e01333d6878bb15d
BLAKE2b-256 86bf2e999eaf9c47b4f5f54ff9b63ce7906ef340fb1c9bbf90c99e449e28c311

See more details on using hashes here.

File details

Details for the file racetrack_client-2.22.0-py3-none-any.whl.

File metadata

File hashes

Hashes for racetrack_client-2.22.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c259dd4cfd546989d5d2ee6120ad1d2661ce4be0272c2bc4b638b135f613d8cf
MD5 4fd6e2ee5da082254f7719026bb2422c
BLAKE2b-256 0b2f8fca59f5be90445aa2dc15c8775327c1ed98506fa9f895890d79bd68e47a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page