diff --git a/changelog/unreleased/added-full-docker-debug.md b/changelog/unreleased/added-full-docker-debug.md new file mode 100644 index 0000000000..f9ab65e630 --- /dev/null +++ b/changelog/unreleased/added-full-docker-debug.md @@ -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 diff --git a/deployments/examples/ocis_full/debug-collaboration-collabora.yml b/deployments/examples/ocis_full/debug-collaboration-collabora.yml new file mode 100644 index 0000000000..dd8fd49a43 --- /dev/null +++ b/deployments/examples/ocis_full/debug-collaboration-collabora.yml @@ -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 diff --git a/deployments/examples/ocis_full/debug-collaboration-onlyoffice.yml b/deployments/examples/ocis_full/debug-collaboration-onlyoffice.yml new file mode 100644 index 0000000000..0adc78a44e --- /dev/null +++ b/deployments/examples/ocis_full/debug-collaboration-onlyoffice.yml @@ -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 diff --git a/deployments/examples/ocis_full/debug-ocis.yml b/deployments/examples/ocis_full/debug-ocis.yml new file mode 100644 index 0000000000..64a5c86a69 --- /dev/null +++ b/deployments/examples/ocis_full/debug-ocis.yml @@ -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 diff --git a/docs/ocis/development/debugging.md b/docs/ocis/development/debugging.md index eb1f3ee309..5d7f1bdd92 100644 --- a/docs/ocis/development/debugging.md +++ b/docs/ocis/development/debugging.md @@ -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 diff --git a/ocis/docker/Dockerfile.linux.amd64 b/ocis/docker/Dockerfile.linux.amd64 index 8915608d82..ff3cf2eae4 100644 --- a/ocis/docker/Dockerfile.linux.amd64 +++ b/ocis/docker/Dockerfile.linux.amd64 @@ -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 " \ diff --git a/ocis/docker/Dockerfile.linux.arm64 b/ocis/docker/Dockerfile.linux.arm64 index aabf5110e3..3ff8907f0b 100644 --- a/ocis/docker/Dockerfile.linux.arm64 +++ b/ocis/docker/Dockerfile.linux.arm64 @@ -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 " \