Developer Center

CLI basics

Learn how to use pt - the PowerTools CLI, in just a few minutes.

To get started with and ship apps, all you need to know is pt, the PowerTools CLI. The CLI manages your workspace, provisions your cloud accounts and gives you a simple interface to develop, deploy and operate complex apps.

Installation

You can install pt with the following command:

$ curl https://www.powertools.dev/install.sh | bash

To install pt a different way, please reference our install guide.

Dependencies

pt ships as a static binary. It requires Docker and git.

Coming Soon: builds and deploys will run in your cloud account, instead of on your local machine. This means docker will no longer be needed.

Git repository

Each PowerTools workspace is tied to a specific git repository. PowerTools never has access to your team's codebase, so you will need to clone your code repository before signing in. When you signup for PowerTools for the first time, we will (optionally) create a workspace for you.

A repository that is connected to PowerTools will have a .powertools/workspace.yml schema in it.

PowerTools will automatically context switch between workspaces, when it finds a .powertools/workspace.yml file. Otherwise it will prompt you to pick a workspace when you have more than one signed in.

PowerTools never has access to your code repository.

Authenticate your cloud

To sync your workspace, build, deploy and operate apps - pt needs to authenticate with your cloud account.

If you have multiple cloud accounts in your workspace, you may be asked to authenticate more than once. For example, if your workspace schema looks like:

# .powertools/workspace.yml
---
environments:
  - name: prod-aws
    cloud: aws
    cloud_region: us-east-1
    cloud_account_id: 12345

  - name: prod-gcp
    cloud: gcp
    cloud_region: us-west-1
    cloud_account_id: 12345

You will see the authentication flow more than once.

Your cloud credentials never leave your machine, and PowerTools never has access to any of your cloud infrastructure.

Common commands

Once you have installed pt and signed into a workspace, you only need to know a few commands to be productive.

🧩 pt new

Create a new PowerTools service, by selecting from a template.

🚧 pt dev

Run a service with your local code changes.

🛠️ pt build

Package a service so that it can be deployed.

✈️ pt deploy

Deploy a service and provision any cloud infrastructure for it.

Basic command structure

Most commands require a service and environment.

To pass a service directly, simply run most commands with the svc or environment name. For example pt deploy my-svc prod will look for the service named my-svc.

If you run a command inside of a service directory (where a service.yml file exists), pt will automatically pick that service, if no argument is passed.

If a service can not be picked, and is not passed as an argument, a prompt will be displayed:

$ pt dev
🚧  - run any service to preview local changes

step (1/6) - select a service
Select from one of the following valid services we found in your workspace:
[x] cron-svc
[ ] web-svc

If an environment is not passed, and your workspace has more than one environment a similar prompt will be displayed:

$ pt deploy

step (1/6) - select an environment

[x] prod
[ ] stage

Many commands accept the --release flag to automatically pick the release environment.

List all commands

Running pt at any time, will show all available commands:

$ pt
🚀 PowerTools - develop, deploy and operate

   ✈️  pt deploy  deploy and release services
   🛠️ pt build   build, test and push artifacts for services
   🚧 pt dev     run any service to preview local changes
   🧩 pt new     create a new workspace or service



Other commands:

    🔍 pt logs                show real time and error logs for any service
    🔑 pt secrets edit        manage secret keys, tokens and passwords for a service
    ☎️  pt signup              signup for powertools and set up your first workspace
    🚢 pt workspace sync      setup, manage and apply any changes to your workspace
    🚮 pt workspace teardown  delete a powertools workspace
    🐠 pt undeploy            undeploy a service

...

👏 Further reading

If you have made it this far, you know everything needed to be productive in the pt CLI.

To learn more about a specific command, select it in the navigation section.