Skip to content

Commit

Permalink
docs: update test-scenes.md
Browse files Browse the repository at this point in the history
  • Loading branch information
xzchaoo committed Apr 27, 2023
1 parent d6e338c commit 15735c8
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions docs/src/en/dev-guide/test/test-scenes.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Notice

These test scenes are mainly used in the development and testing phase and <span style="color:red;">are not suitable for production</span>.

# Common scene shell scripts

There are many commonly used scripts under directory of each scene.

### up.sh

`up.sh` deploys current scene using docker-compose.

```bash
Expand All @@ -13,14 +16,24 @@ build=1 debug=1 up.sh

up.sh shell options:

| Option | Description |
|---|---|
| Option | Description |
|---------|-----------------------------------------------------------------------------------------------------------------------------------------|
| build=1 | Build image(named `holoinsight/server:latest`) from source code.<br>This image exists in local docker, and is not pushed to Docker Hub. |
| debug=1 | Enable debug mode:<br>- Enable JVM remote debugger<br>- Start MySQL/MongoDB/Kibana Web UI |
| debug=1 | Enable debug mode:<br>- Enable JVM remote debugger<br>- Start MySQL/MongoDB/Kibana Web UI |

> You can generate Markdown tables using [Tables Generator](https://www.tablesgenerator.com/markdown_tables).
### after.sh

If this file exists and is executable, `up.sh` will call it after `docker-compose up`.
We use this script to do the following things:

- Install `HoloInsight agent` into `HoloInsight server`, `demo-client` and `demo-server`
- Run Python scripts in `HoloInsight server` in background to generate demo logs
- Run ttyd `HoloInsight server` in background for easy access to server

### status.sh

`status.sh prints status of current deployed scene.

```text
Expand All @@ -45,24 +58,30 @@ scene-default_server_1 /entrypoint.sh Up (healthy)
```

### down.sh

`down.sh` stops and removes current deployed scene.

### server-exec.sh

`server-exec.sh` is aliased to `docker exec -w /home/admin/logs/holoinsight-server -it ${server_container_id} bash`

### mysql-exec.sh

`server-exec.sh` is aliased to `docker exec -it ${mysql_container_id} mysql -uholoinsight -pholoinsight -Dholoinsight`

### server-update.sh

`server-update.sh` rebuilds HoloInsight server fat jar, copies the fat jar into server container, and then restarts server process.

# Test scenes

### scene-default

![scene-default deployment](/resources/images/dev-guide/test/scene-default.jpg)
> Running this scene consumes about 5GB of memory.
The `scene-default` scene contains the following components:

- HoloInsight server
- [CeresDB](https://github.com/ceresdb/ceresdb)
- MySQL
Expand All @@ -72,17 +91,21 @@ The `scene-default` scene contains the following components:
- [HoloInsight OTEL Collector](https://github.com/traas-stack/holoinsight-collector)

This scene also deploys several test applications for better integration testing and better demonstration effects.

- demo-client
- demo-server
- demo-redis

`demo-client` and `demo-server` have `skywalking-java-agent` enabled. They will report trace datum to `HoloInsight OTEL Collector`.

After the container is started, the deployment script will copy HoloInsight-agent into it and execute agent in background using sidecar mode.
After all containers are started, the deployment script will copy HoloInsight-agent into it and execute agent in background using sidecar
mode.
Some Python scripts are mounted into `/home/admin/test` directory of `HoloInsight server`. In after.sh

Currently, running this test scene consumes about 5GB of memory.

Example:

```text
build=1 debug=1 ./test/scenes/scene-default/up.sh
Expand Down Expand Up @@ -147,11 +170,16 @@ scene-default_server_1 /entrypoint.sh Up (healthy)
```

# Misc

## Update database
There is a service named `mysql-data-init` in `docker-compose.yaml`. It is used to initialize database tables and pre-populate some data for its test scene.

There is a service named `mysql-data-init` in `docker-compose.yaml`. It is used to initialize database tables and pre-populate some data for
its test scene.
This service does three things:
1. mounts `server/extension/extension-common-flyway/src/main/resources/db/migration` to `/sql/0migration` in container

1. mounts `server/extension/extension-common-flyway/src/main/resources/db/migration` to `/sql/0migration` in container
2. mounts `${test_scene_dir}/data.sql` to `/sql/1data/V999999__data.sql` in container
3. executes all sql scripts lexicographically under `/sql` in container

Most scenes will choose to reuse the `data.sql` of scene-default, and the docker-compose of these scenes will refer to the `data.sql` of scene-default instead of copying a copy to their own directory.
Most scenes will choose to reuse the `data.sql` of scene-default, and the docker-compose of these scenes will refer to the `data.sql` of
scene-default instead of copying a copy to their own directory.

0 comments on commit 15735c8

Please sign in to comment.