<a id="cp-demo-teardown"></a>

# Troubleshoot and Stop the Confluent Platform Demo

Use the following sections to troubleshoot the demo and stop it when you are finished viewing it.

<a id="cp-demo-troubleshooting"></a>

## Troubleshooting the scripted demo

If the start script does not complete successfully, go through the following troubleshooting steps.

### Docker

1. Upon startup, if the output is similar to below, it is possible that the environment is not supported or `cp-demo` was not started properly.
   Read the pre-requisites and follow proper instructions at [Module 1](on-prem.md#cp-demo-on-prem-tutorial).
   ```bash
   WARNING: The REPOSITORY variable is not set. Defaulting to a blank string.
   WARNING: The SSL_CIPHER_SUITES variable is not set. Defaulting to a blank string.
   WARNING: The CONNECTOR_VERSION variable is not set. Defaulting to a blank string.
   WARNING: The CONTROL_CENTER_KSQL_WIKIPEDIA_URL variable is not set. Defaulting to a blank string.
   WARNING: The CONTROL_CENTER_KSQL_WIKIPEDIA_ADVERTISED_URL variable is not set. Defaulting to a blank string.
   ...
   ERROR: invalid reference format
   ```
2. Verify that the status of all the Docker containers show `Up` state.
   ```bash
   docker compose ps
   ```
3. In the advanced Docker preferences settings, verify the following resources are allocated to Docker:
   - Memory: at least 8 GB (default is 2 GB)
   - CPU cores: at least 2 cores
4. Verify you have not run out of disk storage needed for Docker’s “disk image” file ([Docker documentation](https://docs.docker.com/docker-for-mac/space/)).

### Logs

1. If the script errors out before completing, or if there are Docker containers that are not in `Up` state, view the container’s logs with the command `docker compose logs [container]` and look for error messages and exceptions.
   ```bash
   docker compose logs
   ```
2. If there are any errors that indicate issues with TLS communication, verify that the TLS certificates were properly generated and that there are no errors in the following files:
   ```bash
   ls scripts/security/*.log
   ```

### Security

If there are any errors that indicate issues with TLS communication, force TLS certificates to be regenerated by starting the script with `CLEAN=true`:

```bash
CLEAN=true ./scripts/start.sh
```

### Validate

1. Verify there are messages in the Kafka  topics, including `wikipedia.parsed`:
   ```bash
   ./scripts/consumers/listen.sh
   ```
2. Run the [validation scripts](https://github.com/confluentinc/cp-demo/tree/latest/scripts/validate/) to verify that they pass.
   ```bash
   cd scripts/validate/
   ```

### CLI login

1. If you are running `cp-demo` for a long time and issuing Confluent CLI commands on the `tools` container that error out with:
   ```bash
   Your token has expired. You are now logged out.
   Error: You must log in to run that command.
   ```

   Then run the following command, which refreshes the token by logging back in to MDS:
   ```bash
   ./scripts/helper/refresh_mds_login.sh
   ```

## Stop the Confluent Platform environment

1. Stop the consumer group `app` to stop consuming from topic
   `wikipedia.parsed`. Note that the command below stops the consumers
   gracefully with `kill -15`, so the consumers follow the shutdown
   sequence.
   ```bash
   ./scripts/app/stop_consumer_app_group_graceful.sh
   ```
2. Stop the Docker environment, destroy all components and clear all Docker
   volumes.
   ```bash
   ./scripts/stop.sh
   ```

<a id="cp-demo-ccloud-cleanup"></a>

## Stop the Confluent Cloud environment

If you ran the [Module 2: Deploy Hybrid Confluent Platform and Confluent Cloud Environment](hybrid-cloud.md#cp-demo-hybrid) portion of this tutorial, which included creating resources in Confluent Cloud, follow the clean up procedure below to avoid unexpected Confluent Cloud charges.

Any Confluent Cloud example uses real Confluent Cloud resources.
After you are done running a Confluent Cloud example, manually verify that all Confluent Cloud resources are destroyed to avoid unexpected charges.

1. Make sure that you’re still using the `ccloud` CLI context.
   ```none
   confluent context use ccloud
   ```
2. Delete the Confluent Cloud service account you created for the cluster link. This will also delete all API keys associated with the account.
   ```text
   confluent iam service-account delete ${SERVICE_ACCOUNT_ID}
   ```
3. Destroy your Confluent Cloud ksqlDB cluster. Go to [https://confluent.cloud/environments](https://confluent.cloud/environments) -> Select **cp-demo-cluster** -> ksqlDB -> Select “delete”.
4. Destroy your Confluent Cloud cluster. Go to [https://confluent.cloud/environments](https://confluent.cloud/environments) -> Select **cp-demo-cluster** -> Cluster Overview -> Cluster Settings -> Select “Delete cluster”.
5. Destroy your Confluent Cloud environment. Go to [https://confluent.cloud/environments](https://confluent.cloud/environments) and delete the environment “cp-demo-env” that you created.

#### NOTE
The Health+ cluster will be shown in the Confluent Cloud Console until it ages out.

## Related content

- [Scripted Confluent Platform Demo](overview.md#scripted-demo)
- [Module 2: Deploy Hybrid Confluent Platform and Confluent Cloud Environment](hybrid-cloud.md#cp-demo-hybrid)
