Package: racetrack-client
Racetrack CLI clientracetrack-clientis 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-clientpython3-mpipinstall--upgraderacetrack-client# Set current remoteracetracksetremotehttps://racetrack.platform.example.com# Log in with tokenracetrackloginT0k3n.g0es.H3r3# Or log in with usernameracetracklogin--usernameadmin# Deploy a JobracetrackdeployInstallationInstall racetrack-client using pip:python3-mpipinstall--upgraderacetrack-clientPython 3.8 (or higher) is required.This will installracetrackCLI tool. Verify installation by runningracetrackcommand.UsageRunracetrack --helpto see usage.Adding a remoteAssuming your Racetrack server is running onhttps://racetrack.platform.example.com/lifecycle,
you can add this remote as an alias:racetracksetaliasmy-devhttps://racetrack.platform.example.com/lifecycleAlias 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 remotesSet your current remote with:racetracksetremotemy-devThis will set up a "remote" context for later use.Checking current remoteYou can check your current remote withracetrack get remote.A commandracetrack get remote -q(with flag-qor--quiet)
prints only the current address of Lifecycle (without other logs), which makes it usable for scripts.
Likewise, a commandracetrack get pub -q(with flag-qor--quiet)
prints the current address of Pub service.
"Quiet" mode is automatically applied when not in a TTY.Logging inLog in to Racetrack with your user account (you can get your token from the Dashboard's profile page):racetrackloginT0k3n.g0es.H3r3Alternatively, commandracetrack 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:racetracksetcredentialshttps://github.com/YourUser/YourRepositoryUSERNAMETOKENInstalling pluginsExtend Racetrack's possibilities by installing a bunch of plugins:# This plugin allows you to deploy jobs written in Pythonracetrackplugininstallgithub.com/TheRacetrack/plugin-python-job-type# This plugin allows you to deploy jobs to a local Docker infrastructureracetrackplugininstallgithub.com/TheRacetrack/plugin-docker-infrastructurePlugins can only be installed by admin users.Deploying a jobWhen 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 wherejob.yamlis located:cdMuffinDestroyer
racetrackdeployYou will see the URL of your deployed job in the output.Listing jobsYou can see the list of all deployed jobs with a command:racetracklistChecking runtime logsCheck the logs of a running job by means of:racetracklogsMuffinDestroyerDeleting a jobDelete your running job with:racetrackdeleteMuffinDestroyerExtra varsManifest 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=VALUEparameter (or-ein short)
that overwrites values found in YAML manifest.KEYis the name of field and it can contain dots to refer to a nested field, for examplegit.branch=masterVALUEcan be any YAML or JSON object.Extra vars parameters can be used multiple times in one command.Example:racetrackdeploy-esecret_runtime_env_file=.env.local-egit.branch=$(gitrev-parse--abbrev-refHEAD)It makes CLI commands more script-friendly, so you can overwrite manifest without tracking changes in job.yaml file.Tip: Useracetrack validatecommand beforehand to make sure your final manifest is what you expected.Getting auth tokenCommandracetrack get auth-tokenprints out current auth token.
It can be used in CLI scripts:curl -H "X-Racetrack-Auth: $(racetrack get auth-token)"