CodeRed Cloud CLI Quickstart#

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

Get an API Key#

To use cr, you will need an API key. Run the following command to create your first key:

$ cr login

Warning

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

Usage#

All commands operate on a website, which is identified by a handle. In this guide, we will use the word WEBAPP in place of your handle.

Your website’s handle is the first part of the domain, i.e. WEBAPP.codered.cloud. It can also be found by running:

$ cr list

Your first deployment#

In the terminal, cd to your project folder and run cr deploy WEBAPP.

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 key can also be specified in an environment variable named CR_TOKEN. This is useful for CI/CD pipelines.

Read the full configuration reference.