Skip to content

Commit 976921b

Browse files
authored
Merge pull request #80 from DataKitchen/obs-compose
feat: Install Observability using docker compose
2 parents fb98a23 + ad36be8 commit 976921b

File tree

12 files changed

+756
-1093
lines changed

12 files changed

+756
-1093
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dk-*-credentials.txt
99

1010
# Docker
1111
docker-compose.yml
12-
docker-compose.yaml
12+
obs-docker-compose.yml
1313

1414
# Logs
1515
testgen_demo.log

README.md

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,11 @@ And it allows you to <b>make fast, safe development changes</b>.
4949

5050
#### Requirements for TestGen & Observability
5151

52-
| Software | Tested Versions | Command to check version |
53-
|-------------------------|-------------------------|-------------------------------|
54-
| [Python](https://www.python.org/downloads/) <br/>- Most Linux and macOS systems have Python pre-installed. <br/>- On Windows machines, you will need to download and install it. | 3.9, 3.10, 3.11, 3.12 | `python3 --version` |
55-
| [Docker](https://docs.docker.com/get-docker/) <br/>[Docker Compose](https://docs.docker.com/compose/install/) | 26.1, 27.5, 28.1 <br/> 2.34, 2.35, 2.36 | `docker -v` <br/> `docker compose version` |
52+
| Software | Tested Versions | Command to check version |
53+
|-------------------------|-----------------------------------------|-------------------------------|
54+
| [Python](https://www.python.org/downloads/) <br/>- Most Linux and macOS systems have Python pre-installed. <br/>- On Windows machines, you will need to download and install it. | 3.9, 3.10, 3.11, 3.12, 3.13 | `python3 --version` |
55+
| [Docker](https://docs.docker.com/get-docker/) <br/>[Docker Compose](https://docs.docker.com/compose/install/) | 26.1, 27.5, 28.5 <br/> 2.38, 2.39, 2.40 | `docker -v` <br/> `docker compose version` |
5656

57-
#### Additional Requirements for Observability only
58-
59-
| Software | Tested Versions | Command to check version |
60-
|-------------------------|-------------------------|-------------------------------|
61-
| [Minikube](https://minikube.sigs.k8s.io/docs/start/) | 1.33, 1.34, 1.35 | `minikube version` |
62-
| [Helm](https://helm.sh/docs/intro/install/) | 3.15, 3.16, 3.17 | `helm version` |
6357

6458
### Download the installer
6559

@@ -96,17 +90,11 @@ Once the installation completes, verify that you can login to the UI with the UR
9690

9791
### Install the Observability application
9892

99-
The installation downloads the latest Helm charts and Docker images for Observability and deploys the application on a new minikube cluster. The process may take 5~30 minutes depending on your machine and network connection.
93+
The installation downloads the latest Docker images for Observability and deploys the application using Docker. The process may take 5~15 minutes depending on your machine and network connection.
10094
```shell
10195
python3 dk-installer.py obs install
10296
```
103-
#### Bind HTTP ports to host machine
104-
105-
This step is required to access the application when using Docker driver on Mac or Windows. It may also be useful for installations on remote machines to access the UI from a local browser.
10697

107-
```shell
108-
python3 dk-installer.py obs expose
109-
```
11098
The `--port` option may be used to set a custom localhost port for the application (default: 8082).
11199

112100
Verify that you can login to the UI with the URL and credentials provided in the output. Leave this process running, and continue the next steps on another terminal window.
@@ -162,15 +150,9 @@ Upgrade the app to latest version: `python3 dk-installer.py tg upgrade`
162150

163151
### DataOps Observability
164152

165-
The [minikube](https://minikube.sigs.k8s.io/docs/commands/) and [kubectl](https://kubernetes.io/docs/reference/kubectl/) command line tools can be used to operate the Observability application.
166-
167-
Inspect the pods: `kubectl get pods`
168-
169-
Get pod logs: `kubectl logs <POD ID>`
170-
171-
Stop the app: `minikube stop`
153+
Stop the app: `docker compose -f obs-docker-compose.yml obs down`
172154

173-
Restart the app: `minikube start`
155+
Restart the app: `docker compose -f obs-docker-compose.yml up`
174156

175157
## Remove Demo Data
176158

demo/demo/main.py

Lines changed: 29 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,45 @@
1+
import signal
2+
13
from demo_helper import Config
2-
from observability_demo import run_obs_demo, delete_obs_demo
4+
from observability_demo import run_obs_demo, delete_obs_demo
35
from heartbeat_demo import run_heartbeat_demo
4-
from testgen_demo import run_tg_demo, delete_tg_demo
6+
from testgen_demo import run_tg_demo, delete_tg_demo
57
from argparse import ArgumentParser
68

79

8-
def init_args() -> ArgumentParser:
9-
parser = ArgumentParser(
10-
description="""
11-
This is a tool to create a demo of DataOps Observability & TestGen.
12-
""",
13-
)
14-
subparsers = parser.add_subparsers(title="subcommands")
10+
def init_parser() -> ArgumentParser:
11+
parser = ArgumentParser(description="This is a tool to create a demo of DataOps Observability & TestGen.")
12+
subparsers = parser.add_subparsers(title="subcommands", required=True)
1513

16-
obs_run_parser = subparsers.add_parser(
17-
"obs-run-demo",
18-
description="Run the Observability demo",
19-
)
20-
obs_run_parser.set_defaults(action="obs-run-demo")
21-
22-
obs_delete_parser = subparsers.add_parser(
23-
"obs-delete-demo",
24-
description="Delete data created by the Observability demo",
14+
commands = (
15+
("obs-run-demo", "Run the Observability demo", run_obs_demo),
16+
("obs-delete-demo", "Delete data created by the Observability demo", delete_obs_demo),
17+
("obs-heartbeat-demo", "Run the Observability Heartbeat demo", run_heartbeat_demo),
18+
("tg-run-demo", "Run the TestGen demo", run_tg_demo),
19+
("tg-delete-demo", "Delete data created by the TestGen demo", delete_tg_demo),
2520
)
26-
obs_delete_parser.set_defaults(action="obs-delete-demo")
2721

28-
obs_heartbeat_parser = subparsers.add_parser(
29-
"obs-heartbeat-demo",
30-
description="Run the Observability Heartbeat demo",
31-
)
32-
obs_heartbeat_parser.set_defaults(action="obs-heartbeat-demo")
22+
for cmd, desc, func in commands:
23+
sub_parser = subparsers.add_parser(cmd, description=desc)
24+
sub_parser.set_defaults(func=func)
3325

34-
tg_run_parser = subparsers.add_parser(
35-
"tg-run-demo",
36-
description="Run the TestGen demo",
37-
)
38-
tg_run_parser.set_defaults(action="tg-run-demo")
39-
40-
tg_delete_parser = subparsers.add_parser(
41-
"tg-delete-demo",
42-
description="Delete data created by the TestGen demo",
43-
)
44-
tg_delete_parser.set_defaults(action="tg-delete-demo")
26+
return parser
27+
28+
29+
def init_signal_handler():
30+
def _keyboard_interrupt(_signum, _frame):
31+
raise KeyboardInterrupt
32+
33+
# Docker sends SIGTERM on Ctrl-C, so we raise a KeyboardInterrupt
34+
signal.signal(signal.SIGTERM, _keyboard_interrupt)
4535

46-
return parser.parse_args()
4736

4837
def main():
49-
args = init_args()
38+
init_signal_handler()
39+
args = init_parser().parse_args()
5040
config = Config()
51-
52-
if args.action == "obs-run-demo":
53-
run_obs_demo(config)
54-
elif args.action == "obs-delete-demo":
55-
delete_obs_demo(config)
56-
elif args.action == "obs-heartbeat-demo":
57-
run_heartbeat_demo(config)
58-
elif args.action == "tg-run-demo":
59-
run_tg_demo(config)
60-
elif args.action == "tg-delete-demo":
61-
delete_tg_demo(config)
62-
else:
63-
print(f"Command [{args.action}] not recognized.")
41+
args.func(config)
6442

6543

6644
if __name__ == "__main__":
67-
main()
45+
main()

0 commit comments

Comments
 (0)