Reference

Toolbox

A toolbox is a hosted cloud shell that acts as a CLI container for an environment. You can think of it as an SSH (Secure Shell) automatically configured for you with the correct role, access, and ssh keys. Toolboxes have all the ENV variables and VPC peering to talk to resources like your database, Redis, etc.

A toolbox opens up into a VSCode instance, but compared to a Workspace in this case we are not using it as an IDE - we are just using it for the stable and well-built terminal interface. You'll notice that your repo is not mounted to the VSCode container, but rather that you are in a kubernetes pod with one or more sibling containers, each one of your services from coherence.yml. You will use cocli to execute commands in those containers, such as launching a shell in one of your application's services.

Toolboxes run in Coherence's cloud. They do not run on your infrastructure.

Starting a toolbox

Toolbox dropdown

Toolbox dropdown

VSCode terminal

After launching the toolbox you'll end up in a VSCode editor. Open a new terminal window from the menu at the top or by pressing the following keyboard shortcut ctrl + ~.

VSCode terminal menu

Full-screen terminal

You can make the terminal full-screen with the ^ button on the terminal tab.

Scratch Volume

A directory is mounted by Coherence across all containers on the toolbox at _coherencescratch. This is useful to for example edit a file using the VSCode interface and be able to use it in your application containers. This is useful for cases like:

  • copying some sql data from an external source to be loaded via a database UI (e.g. psql) into the database for your environment

Example use cases

Running a one-off migration task

Connecting to a DB instance

This example uses Postgres and psql but similar commands will work for any resources of your service (e.g. mysql or redis)

In the toolbox type cocli exec <name of service> then press enter. This will get you a shell prompt (the default command is bash) in the container for your service on this toolbox. (similar to kubectl exec)

For example:

cocli exec backend

If you are not sure which services are available, type cocli services then press enter. The CLI will return all of the services available.

Next, run the following command to update all of the packages and install the postgres-client. The installation is local to this toolbox and will not persist if you were to stop and restart the toolbox.

apt-get update && apt-get install -y postgresql-client

Finally, you can connect to your DB by using the Coherence-provided DATABASE_URL variable. The syntax for the client library you use may differ, see that library's docs for specifics.

psql $DATABASE_URL
Previous
Production