CodeRed Cloud CLI Quickstart#

Before running this guide, make sure you have cr installed.

Get an API Token#

To use cr, first log in to your CodeRed Cloud dashboard and create an API token for your Client here: https://app.codered.cloud/billing/. Note that a token will have access to all websites belonging to that Client. If you need more fine-grained permissions, contact support to create separate Clients.

API tokens are secret and should be stored either in the CR_TOKEN environment variable, or in your personal config file at ~/.cr.ini as so:

[cr]
token = a1b2c3...

Warning

Never commit or expose your tokens to public version control! If you do accidentally expose a token, it can be cycled through the CodeRed Cloud dashboard.

The webapp handle is your website’s CodeRed Cloud subdomain. For example: demo.codered.cloud would be demo.

Finally, run cr --help to see usage, or cr {command} --help to see usage about a particular command.

Usage#

Once you have installed cr, have a webapp handle, and have an API token, you are ready to do your first deployment. To start, open a terminal and cd to your project folder.

For Django and Wagtail projects, this is the folder containing a manage.py and requirements.txt file. For WordPress projects, this should contain a wp-config.php file. For Static HTML sites, this is the folder with the published/built HTML (for example, Sphinx usually outputs to a _build/html/ folder)

$ cd ~/myproject
$ cr deploy webapp

If the cr tool detects that you are in the wrong folder, it will prompt you to confirm.

To configure automatic deployments on git push, see: Automated Deployments.

Configuration#

Configuration files can be created using the name .cr.ini. The following locations are searched:

  • Home Directory (i.e. ~/.cr.ini)

  • The working directory (this generally should be your project root, unless you have specified --path to some commands).

A config file in the working directory will override values in a config file from home directory.

The default section in the config file is [cr]. Other sections named after your webapp handles can override these values. For example:

# API token for my client.
[cr]
token = abc...

# These settings are for ``demo.codered.cloud``
[demo]
token = xyz...

The API token can also be specified in an environment variable named CR_TOKEN. This is useful for CI/CD pipelines.

Read the full configuration reference.