Workarea CLI Cheat Sheet

Install the Workarea CLI

Using an Apple Machine

Installation on mac uses homebrew. If you do not have homebrew installed see https://brew.sh/

brew tap workarea/tools ssh://git@stash.tools.weblinc.com:7999/wl/homebrew-taps.git
brew cask install workarea-cli

Note that you need access to Workarea stash to install the CLI.

Using a Linux Machine

To install Workarea CLI on linux run

wget --content-disposition https://packagecloud.io/weblinc/workarea-cli/packages/ubuntu/trusty/workarea-cli_2.1.0+20190424223847-1_amd64.deb/download.deb?read_token=632fa363936e9202ef857c752d851b1cc8d8cb4db166e515

Setup Application

workarea setup --client-id={client_id} --aws-secret-access-key={key} --aws-access-key-id={key}

Create a New Application or Plugin

To create a new application:

workarea new app {app_name}

To create a new plugin:

workarea new plugin {plugin_name}

Doctor

Detect new environments or fix connection issues with existing environments

workarea doctor -r

Console

To open a rails console in an environment use:

workarea {env} console

Debugging

Check running pods

workarea {env} pods

View Logs

App

workarea {env} logs app

You will be prompted to select pod and container. Container choices are:

This can be simplified by doing:

workarea {env} logs app -c app-log -f

Here you will be prompted to select a pod but we are specifying the container in the command (also note the -f to follow the logs)

Sidekiq

All the same notes from app apply!

workarea {env} logs sidekiq

Proxy

You only need to select the pod here.

workarea {env} logs proxy

Getting a shell

workarea {env} bash app

Will be prompted to select a pod. The "app" is optional, it will just filter the list of pods for you.

Veryfying git commit of deploy

export KUBECONFIG=~/.weblinc/kubeconfigs/{client}-{cluster_env}-kubeconfig
kubectl -n {client}-{cluster_env}-app get deployments app -o jsonpath='{.spec.template.spec.containers[0].image}'

Copy Files

To remote

workarea {env} cp --source=test.txt --destination=/workarea/test.txt --copy-to-remote

From remote

workarea {env} cp --source=test.txt --destination=test.txt

Edit

You can edit secrets on your server with:

workarea {env} edit secrets

And edit proxy configuration with:

workarea {env} edit proxy

Kibana

The Worakarea CLI allows you to connect to your application's Kibana intance using port forwarding. This gives you access to the kibana ES console and logstash.

This feature is currently experimental and not available for all environments or applications, if you need access and the following command does not work, please contact Workarea support at https://www.suport.workarea.com

workarea {env} fwd kibana 5601:5601