Skip to content

Commit

Permalink
Update READMEs wrt running things locally (#1225)
Browse files Browse the repository at this point in the history
Co-authored-by: Hazel <hazel.he@datastax.com>
  • Loading branch information
tatu-at-datastax and Hazel-Datastax authored Jul 2, 2024
1 parent 89fd059 commit 7d6306e
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 13 deletions.
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ The quickest way to test out the Data API directly is to start a local copy of t

```shell
cd docker-compose
./start_dse_next_dev_mode.sh
./start_hcd.sh
# or
./start_dse69.sh
```

This starts an instance of the Data API along with a Stargate coordinator node in "developer mode" (with DataStax Enterprise 6.8 embedded).
This starts an instance of the Data API along with a backend database (HCD or DSE 6.9)

> **Warning**
> Running this script with no options will use the latest `v1` tagged version of Data API and latest `v2` tagged version of the Stargate coordinator. Therefore, if you have these tags already present in your local Docker from other development/testing, those are the images that will be used. See our Docker compose [README](docker-compose/README.md) to see additional options.
> Running this script with no options will use the latest `v1` tagged version of Data API. Therefore, if you have these tags already present in your local Docker from other development/testing, those are the images that will be used. See our Docker compose [README](docker-compose/README.md) to see additional options.
Once the services are up, you can access the Swagger endpoint at: http://localhost:8181/swagger-ui/

Expand Down Expand Up @@ -73,7 +75,9 @@ You can run your application in dev mode that enables live coding using:
```shell script
docker run -d --rm -e CLUSTER_NAME=dse-cluster -e CLUSTER_VERSION=6.8 -e ENABLE_AUTH=true -e DEVELOPER_MODE=true -e DS_LICENSE=accept -e DSE=true -p 8081:8081 -p 8091:8091 -p 9042:9042 stargateio/coordinator-dse-next:v2

./mvnw compile quarkus:dev
./mvnw compile quarkus:dev -Dstargate.data-store.ignore-bridge=true \
-Dstargate.jsonapi.operations.vectorize-enabled=true \
-Dstargate.jsonapi.operations.database-config.local-datacenter=dc1
```

The command above will first spin the single Stargate DSE coordinator in dev that the API would communicate to.
Expand Down
49 changes: 40 additions & 9 deletions docker-compose/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker Compose scripts for Data API with DSE-6.9
# Docker Compose scripts for Data API with HCD or DSE-6.9

This directory provides two ways to start the Data API with DSE-6.9 or HCD using `docker compose`.
This directory provides two ways to start the Data API with HCD or DSE-6.9 using `docker compose`.

## Prerequisites

Expand All @@ -19,21 +19,22 @@ You can control the platform using the `-Dquarkus.docker.buildx.platform=linux/a

Follow instructions under the [Script options](#script-options) section to use the locally built image.

## Data API with DSE-6.9 cluster
## Data API with HCD or DSE-6.9 cluster

You can start a simple configuration with DSE 6.9 with the following command:
You can start a simple configuration with HCD with the following command:

```
./start_dse69.sh
./start_hcd.sh
```

You can start a simple configuration with HCD with the following command:
You can start a simple configuration with DSE 6.9 with the following command:

```
./start_hcd.sh
./start_dse69.sh
```

This convenience script verifies your Docker installation meets minimum requirements and brings up the configuration described in the `docker-compose.yml` file. The configuration includes health criteria for each container that is used to ensure the containers come up in the correct order.
This convenience script verifies your Docker installation meets minimum requirements and brings up the configuration described in the `docker-compose.yml` (DSE-6.9) or `docker-compose-hcd.yml` (HCD) file.
The configuration includes health criteria for each container that is used to ensure the containers come up in the correct order.

The convenience script uses the `-d` and `--wait` options to track the startup progress, so that the compose command exits when all containers have started and reported healthy status within a specified timeout.

Expand All @@ -42,6 +43,24 @@ We recommend doing a `docker compose pull` periodically to ensure you always hav

Once done using the containers, you can stop them using the command `docker compose down`.

## HCD or DSE-6.9 cluster WITHOUT Data API

To run local non-Docker instance of Data API, use `-d` with the script: it will prevent running of Data API container:

```
./start_hcd.sh -d
# OR
./start_dse69.sh -d
```

To run locally built Data API in Quarkus Development mode, you will use:

```
/mvnw compile quarkus:dev -Dstargate.data-store.ignore-bridge=true \
-Dstargate.jsonapi.operations.vectorize-enabled=true \
-Dstargate.jsonapi.operations.database-config.local-datacenter=dc1
```

## Script options

Both convenience scripts support the following options:
Expand All @@ -54,10 +73,22 @@ Both convenience scripts support the following options:

* You can enable reguest logging for the Data API using `-q`: if so, each request is logged under category `io.quarkus.http.access-log`

* You can start dse/hcd node only using `-d` option. This is useful when you want to start Data API locally for development.
* You can start DSE/HCD node only using `-d` option. This is useful when you want to start Data API locally for development.

* You can specify the number of cassandra node required using `-n [NUMBER]`. Default is 1.

## CQLSH

A convenient way to run `cqlsh` to connect locally is to use one of:

```
# HCD:
docker exec -it data-api-hcd-1 cqlsh -u cassandra -p cassandra
# DSE 6.9:
docker exec -it data-api-dse-1 cqlsh -u cassandra -p cassandra
```

## Notes

* The `.env` file defines variables for the docker compose project name (`COMPOSE_PROJECT_NAME`),
Expand Down

0 comments on commit 7d6306e

Please sign in to comment.