Added the debugging to full ocis docker example

This commit is contained in:
Roman Perekhod
2024-07-22 13:25:17 +02:00
parent 379649f495
commit 54524567a5
7 changed files with 56 additions and 21 deletions

View File

@@ -0,0 +1,5 @@
Enhancement: Added the debugging to full ocis docker example
Added the debugging to full ocis docker example
https://github.com/owncloud/ocis/pull/9666

View File

@@ -0,0 +1,7 @@
---
services:
collaboration:
command: [ "-c", "dlv --listen=:40000 --headless=true --continue --check-go-version=false --api-version=2 --accept-multiclient exec /usr/bin/ocis collaboration server" ]
ports:
- 40001:40000

View File

@@ -0,0 +1,7 @@
---
services:
collaboration-oo:
command: [ "-c", "dlv --listen=:40002 --headless=true --continue --check-go-version=false --api-version=2 --accept-multiclient exec /usr/bin/ocis collaboration server" ]
ports:
- 40002:40002

View File

@@ -0,0 +1,7 @@
---
services:
ocis:
command: [ "-c", "ocis init || true; dlv --listen=:40000 --headless=true --continue --check-go-version=false --api-version=2 --accept-multiclient exec /usr/bin/ocis server" ]
ports:
- 40000:40000

View File

@@ -136,7 +136,7 @@ bin/ocis --log-level=$LOG_LEVEL proxy &
### Debugging the ocis in a docker container
Remote debugging is the debug mode commonly used to work with a debugger and target running on a remote machine or a container for example a wopi stack `deployments/examples/ocis_full/docker-compose.yml`.
Remote debugging is the debug mode commonly used to work with a debugger and target running on a remote machine or a container for example a wopi stack `deployments/examples/ocis_full/docker-compose.yml`. Docker compose lets us define a compose application model through multiple compose files. When doing so, compose follows certain rules to merge compose files. See [Merge and override](https://docs.docker.com/compose/compose-file/13-merge/) in the Compose Specification. Based on this rules we added the extra files `deployments/examples/ocis_full/debug-ocis.ymll`, `deployments/examples/ocis_full/debug-collaboration-collabora.yml`, `deployments/examples/ocis_full/debug-collaboration-onlyoffice.yml` that overwrites the `command` attribute and extends the `ports` attribute.
Below we describe the steps how to build the image, run the docker-compose and connect via remote debugger.
1. Build the image:
```bash
@@ -147,28 +147,16 @@ make debug-docker
```bash
export OCIS_DOCKER_TAG=debug
```
3. Change the docker-compose `ocis` or `collaboration` depends on what do you want to debug:
For example `deployments/examples/ocis_full/ocis.yml`
```yaml
ocis:
image: ${OCIS_DOCKER_IMAGE:-owncloud/ocis}:${OCIS_DOCKER_TAG:-latest}
networks:
ocis-net:
entrypoint:
- /bin/sh
# Comment out command
# command: ["-c", "ocis init || true; ocis server"]
# Replace the command and expose the port
command: [ "-c", "ocis init || true; dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /usr/bin/ocis server" ]
ports:
- 40000:40000
3. Run the docker-compose
Building the docker-compose command depends on what you want to debug, for example `ocis` and `collaboration` with the `collabora` supports.
```bash
docker compose -f docker-compose.yml -f ocis.yml -f collabora.yml -f debug-ocis.yml -f debug-collaboration-collabora.yml up -d
```
4. Run the docker-compose
5. Connect to remote `delve`
4. Connect to remote `delve`
* For the VS Code add the configuration to the `.vscode/launch.json` [https://github.com/golang/vscode-go/wiki/debugging#remote-debugging](https://github.com/golang/vscode-go/wiki/debugging#remote-debugging)
```json
{
"name": "Debug remote :40000",
"name": "Debug remote ocis :40000",
"type": "go",
"request": "attach",
"mode": "remote",
@@ -177,7 +165,28 @@ For example `deployments/examples/ocis_full/ocis.yml`
"trace": "verbose", // optional
"showLog": true // optional
},
{
"name": "Debug remote collaboration collabora :40001",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 40001,
"host": "localhost", // optional
"trace": "verbose", // optional
"showLog": true // optional
},
{
"name": "Debug remote collaboration onlyoffice :40002",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 40002,
"host": "localhost", // optional
"trace": "verbose", // optional
"showLog": true // optional
},
```
* For the Jetbrains Goland add the configuration following the docs [https://www.jetbrains.com/help/go/go-remote.html](https://www.jetbrains.com/help/go/go-remote.html)
### Gather error messages

View File

@@ -3,7 +3,7 @@ FROM amd64/alpine:3.18
ARG VERSION=""
ARG REVISION=""
RUN apk add --no-cache ca-certificates mailcap tree attr curl inotify-tools bash && \
RUN apk add --no-cache ca-certificates mailcap tree attr curl inotify-tools bash libc6-compat && \
echo 'hosts: files dns' >| /etc/nsswitch.conf
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \

View File

@@ -3,7 +3,7 @@ FROM arm64v8/alpine:3.18
ARG VERSION=""
ARG REVISION=""
RUN apk add --no-cache ca-certificates mailcap tree attr curl inotify-tools bash && \
RUN apk add --no-cache ca-certificates mailcap tree attr curl inotify-tools bash libc6-compat && \
echo 'hosts: files dns' >| /etc/nsswitch.conf
LABEL maintainer="ownCloud GmbH <devops@owncloud.com>" \