Toolboxes
A toolbox is a running container using your application image, with port forwarding set up to provide access to your cloud resources for your deployed environment. It's ideal for debugging, running migrations, or executing one-off tasks.
Installation
To get started with cocli and toolboxes, follow these steps:
- Install
cnc
by following the instructions at CNC Framework Getting Started. Note: Skip the "Setup CNC configuration files" step. - Install
cocli
by following the instructions in the cocli GitHub repository.
Authentication
Before using cocli, you need to authenticate:
- Create an access token in your Coherence user profile (top right user menu).
- Set the token in your shell:
export COHERENCE_ACCESS_TOKEN="your-access-token-here"
Starting a Toolbox
Use the following steps to start a toolbox:
# Set your access token
export COHERENCE_ACCESS_TOKEN="your-access-token-here"
# Get the application ID
app_id=$(cocli apps list | jq '.[] | select(.title=="Your App Name") | .id')
# Get the collection ID
collection_id=$(cocli collections list -a $app_id | jq '.data[] | select(.name=="your-collection-name") | .id')
# Start a toolbox on environment "main"
cocli cnc -c $collection_id -- toolbox start main
For more toolbox commands, refer to the CNC documentation or use the --help flag (e.g., cnc toolbox start --help).
Proxy Only
If you don't want to run your app container, the --proxy-only
flag will make the CLI:
- start the network proxies into your VPC for each resource (e.g. database/redis)
- print the environment configuration the app would use, including connection strings to the proxied resources
This is useful for example to connect to a database locally in one of your environments. You can also connect your local app to remote database or redis using the connection info printed here, similar to a toolbox but more flexible since the code does not have to be built or deployed by Coherence to be available. For users on ARM (e.g. new Macs) this is also the suggested workaround to the platform mismatch between the deployed containers in the cloud (AMD) and your local runtime.