# Cli commands

## Nginx-LE cli tooling

Nginx-LE provides optional cli tooling to manage your Nginx-LE instance.

The cli tooling is based on dart and the DCli library.

To install the cli tooling:

(If you already have dart installed you can go straight to step 3.)

1. Install dcli [install guide](https://github.com/bsutton/dcli/wiki/Installing-DCli)
2. Restart your terminal
3. Activate Nginx-LE

`pub global activate nginx_le`

On linux this amounts to:

```
sudo apt-get update
sudo apt-get install --no-install-recommends -y wget ca-certificates gnupg2
wget https://github.com/noojee/dcli/releases/download/latest-linux/dcli_install -O dcli_install
chmod +x dcli_install
export PATH="$PATH":"$HOME/.pub-cache/bin":"$HOME/.dcli/bin"
./dcli_install
pub global activate nginx_le
```

The DCli installer also installs dart (if its not already installed).

The Nginx-LE cli exposes the following commands:

| Command | Description                                           | Comment                                                                                                                                                                                        |
| ------- | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| build   | Builds the docker image.                              | Only required if you need to customise the code the image runs on.                                                                                                                             |
| config  | Configures nginx-le and creates the docker container. | You must run config before you can run any other commands (except build).                                                                                                                      |
| start   | Starts nginx-le                                       | Starts the nginx-le docker container                                                                                                                                                           |
| restart | Restarts nginx-le                                     | Restarts the docker container                                                                                                                                                                  |
| stop    | Stops nginx-le                                        | Stops the docker container.                                                                                                                                                                    |
| acquire | Acquires or renews a Lets Encrypt certificate         | The method used to acquire a certificate depends on the Auth Provider selected when you ran `nginx-le config`. If you are using the AUTO\_ACQUIRE mode then this action happens automatically. |
| revoke  | Revokes the current Lets Encrypt certificate          | Full certificate revocation. You need to run revoke/acquire if you change the type of certificate between production and staging.                                                              |
| cli     | Attaches you to the Docker container in a bash shell. | Play inside the nginx-le docker container.                                                                                                                                                     |
| logs    | Tails various logs in the container                   |                                                                                                                                                                                                |

Example of running Nginx-LE command

```
nginx-le config
```
