Skip to content

Commit

Permalink
Add local docker compose debugging (#1564)
Browse files Browse the repository at this point in the history
* add local docker compose debugging

* add ignores to server/api-server

* add helper setup.sh for local docker-compose

* ports onlly on localhost

* add client launch config

* add api server launch
  • Loading branch information
hacktobeer authored Nov 4, 2024
1 parent cb8757e commit cb804a2
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 4 deletions.
70 changes: 66 additions & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,61 @@
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Worker",
"name": "Attach debugpy Worker",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port":10000
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/home/turbinia"
}
]
},
{
"name": "Attach debugpy Server",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port":20000
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/home/turbinia"
}
]
},
{
"name": "Attach debugpy API Server",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port":30000
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/home/turbinia"
}
]
},
{
"name": "Turbinia API Client",
"type": "debugpy",
"request": "launch",
"cwd": "${workspaceFolder}",
"program": "turbinia/api/cli/turbinia_client/turbiniacli_tool.py",
"args": "${input:apiClientCommand}",
"console": "integratedTerminal",
},
{
"name": "Attach k8s Worker",
"type": "cloudcode.kubernetes",
"request": "attach",
"language": "Python",
Expand All @@ -14,7 +68,7 @@
"remoteRoot": "/home/turbinia"
},
{
"name": "Attach to Server",
"name": "Attach k8s Server",
"type": "cloudcode.kubernetes",
"request": "attach",
"language": "Python",
Expand All @@ -26,7 +80,7 @@
"remoteRoot": "/home/turbinia"
},
{
"name": "Attach to API Server",
"name": "Attach k8s API Server",
"type": "cloudcode.kubernetes",
"request": "attach",
"language": "Python",
Expand All @@ -37,5 +91,13 @@
"localRoot": "${workspaceFolder}",
"remoteRoot": "/home/turbinia"
}
]
],
"inputs": [
{
"id": "apiClientCommand",
"type": "promptString",
"description": "API Client Command",
"default": "config list"
}
]
}
3 changes: 3 additions & 0 deletions docker/api_server/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ build
__pycache__
.cache
turbinia.egg-info
conf/
redis-data/
evidence/
7 changes: 7 additions & 0 deletions docker/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ services:
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
- TURBINIA_EXTRA_ARGS=${TURBINIA_EXTRA_ARGS}
ports:
- 127.0.0.1:20000:20000

turbinia-api-server:
#image: "turbinia-api-server-dev" # Use this for local development and comment out below line
Expand All @@ -41,6 +43,9 @@ services:
- TURBINIA_EXTRA_ARGS=${TURBINIA_EXTRA_ARGS}
expose:
- "8000"
ports:
- 127.0.0.1:30000:30000
- 127.0.0.1:8000:8000

turbinia-worker:
#image: "turbinia-worker-dev" # Use this for local development and comment out below line
Expand All @@ -56,6 +61,8 @@ services:
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
- TURBINIA_EXTRA_ARGS=${TURBINIA_EXTRA_ARGS}
ports:
- 127.0.0.1:10000:10000

# Uncomment below in case you want to run a second worker on the same host.
# turbinia-worker2:
Expand Down
6 changes: 6 additions & 0 deletions docker/local/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
mkdir redis-data
mkdir evidence
mkdir conf
chmod 777 conf evidence redis-data
sed -f docker/local/local-config.sed turbinia/config/turbinia_config_tmpl.py > conf/turbinia.conf
3 changes: 3 additions & 0 deletions docker/server/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ charts
__pycache__
.cache
turbinia.egg-info
conf/
redis-data/
evidence/
3 changes: 3 additions & 0 deletions docker/worker/Dockerfile.dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ charts
__pycache__
.cache
turbinia.egg-info
conf/
redis-data/
evidence/

0 comments on commit cb804a2

Please sign in to comment.