Skip to content

Commit

Permalink
feat(deployment): added Elasticsearch HQ deployment when --dev option…
Browse files Browse the repository at this point in the history
… is used

Signed-off-by: Alberto Codutti <alberto.codutti@eurotech.com>
  • Loading branch information
Coduz committed Jan 12, 2024
1 parent d642476 commit 3438f87
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 5 deletions.
33 changes: 28 additions & 5 deletions deployment/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,20 +109,43 @@ export IMAGE_VERSION=1.0.0-M5

### Enabling development mode

`kapua-sql` container can optionally enable its web admin console. To enable it, provide the `--dev` option.
Development mode deploys some development components to help development and debugging.

To enable it, provide the `--dev` option.

Example:

```bash
./docker-deploy.sh --dev
```

With this mode, you can access a web browser on http://localhost:8181/ to see the H2 web admin console, that has to be configured with the settings previously shown in the "Accessing components" subsection.
We propose an image to simplify this configuration phase:
Following ports/components will be available:

| Application/Service | Endpoint |
|-----------------------|-----------------|
| H2 Web Admin console | localhost:8181 |
| Elasticsearch Browser | localhost:55000 |

#### Notes

##### H2 Web Admin Console

The parameters to connect to H2 DB instance are the following

| Parameter | Value |
|----------------|--------------------------------------|
| Saved Settings | Generic H2 (Server) |
| Driver Class | org.h2.Driver |
| Driver Class | org.h2.Driver |
| JDBC URL | jdbc:h2:tcp://localhost:3306/kapuadb |
| User Name | kapua |
| Password | kapua |

It is to be noted that as an alternative of the web console you can, of course, use whatever database tool you like, for example DBeaver https://dbeaver.io/

![WebBrowserH2Sett](kapua-webBrowserH2Settings.png "WebBrowser H2 settings")
#### Elasticsearch Browser

It is to be noted that as an alternative of the web console you can, of course, use whatever database tool you like, for example "dbeaver" https://dbeaver.io/
Deployed component is already configured to connect to Elasticsearch instance.

---

Expand Down
12 changes: 12 additions & 0 deletions deployment/docker/compose/extras/docker-compose.es-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3.1'

services:
es-hq:
container_name: es-hq
image: elastichq/elasticsearch-hq
ports:
- "55000:5000"
depends_on:
- es
environment:
- HQ_DEFAULT_URL=http://es:9200
Binary file removed deployment/docker/kapua-webBrowserH2Settings.png
Binary file not shown.
1 change: 1 addition & 0 deletions deployment/docker/unix/docker-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ docker_compose() {
if [[ "$3" == true ]]; then
echo "Dev mode enabled!"
COMPOSE_FILES+=(-f "${SCRIPT_DIR}/../compose/extras/docker-compose.db-dev.yml")
COMPOSE_FILES+=(-f "${SCRIPT_DIR}/../compose/extras/docker-compose.es-dev.yml")
fi

# SSL
Expand Down
4 changes: 4 additions & 0 deletions deployment/docker/unix/docker-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ docker_common() {
docker_logs() {
declare -a COMPOSE_FILES;

if [[ "$(docker ps | grep elastichq/elasticsearch-hq)" != "" ]] ; then
COMPOSE_FILES+=(-f "${SCRIPT_DIR}/../compose/extras/docker-compose.es-dev.yml")
fi

if [[ "$(docker ps | grep kapua/kapua-keycloak)" != "" ]] ; then
COMPOSE_FILES+=(-f "${SCRIPT_DIR}/../compose/sso/docker-compose.keycloak.yml")
fi
Expand Down
4 changes: 4 additions & 0 deletions deployment/docker/unix/docker-undeploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ docker_common() {
docker_undeploy() {
declare -a COMPOSE_FILES;

if [[ "$(docker ps | grep elastichq/elasticsearch-hq)" != "" ]] ; then
COMPOSE_FILES+=(-f "${SCRIPT_DIR}/../compose/extras/docker-compose.es-dev.yml")
fi

if [[ "$(docker ps | grep kapua/kapua-keycloak)" != "" ]] ; then
COMPOSE_FILES+=(-f "${SCRIPT_DIR}/../compose/sso/docker-compose.keycloak.yml")
fi
Expand Down
2 changes: 2 additions & 0 deletions deployment/docker/win/docker-deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ If($dev) {
Write-Host "Dev mode enabled!"
$compose_files+="-f"
$compose_files+=$(Join-Path $script_dir .. compose extras docker-compose.db-dev.yml)
$compose_files+="-f"
$compose_files+=$(Join-Path $script_dir .. compose extras docker-compose.es-dev.yml)
}

docker-compose -f $(Join-Path $script_dir .. compose docker-compose.yml) $compose_files up -d
Expand Down

0 comments on commit 3438f87

Please sign in to comment.