CNC Toolbox
The CNC toolbox in Coherence provides a suite of tools to help you manage your application infrastructure locally.
The toolbox uses the CNC Framework (CNC) to provide a running container for your application and uses the Coherence command-line interface (CLI) to interact with your cloud resources.
What is a toolbox?
The CNC toolbox uses your application image to run your app and uses port forwarding to access cloud resources for your deployed environment. This gives you the benefit of interacting with your cloud resources as if you were running them locally when debugging, running migrations, or executing one-off tasks in your cloud environment.
Installation
- Install
cocnc
by following the instructions in the CNC documentation. - Install
cocli
by following the instructions in thecocli
GitHub repository. - Authenticate your cloud provider:
gcloud auth application-default login
gcloud auth login
aws configure
Coherence authentication
Before using cocli
, you must authenticate your Coherence CLI with an access token.
Click the three-dot menu on the top right of your Coherence dashboard and select Profile from the dropdown. In the API section of your profile settings, click Create token. Then run the following command on your local machine with your access token:
export COHERENCE_ACCESS_TOKEN="your-access-token-here"
Starting a Toolbox
To start a toolbox, you need your application ID and collection ID. You can set both variables in your terminal with the following command (be sure to add your application name and collection name before running the command.):
app_id=$(cocli apps list | jq '.[] | select(.title=="Your App Name") | .id')
collection_id=$(cocli collections list -a $app_id | jq '.data[] | select(.name=="your-collection-name") | .id')
Next, run the following (after replacing <your-environment-name>
with the name you gave your environment on Coherence):
cocli cnc -c $collection_id -- toolbox start <your-environment-name>
To run a toolbox in proxy-only mode, use the --proxy-only
flag:
cocli cnc -c $collection_id -- toolbox start <your-environment-name> --proxy-only