Ringloop / mr-plow

Minimal memory usage, cloud native logstash alternative
Apache License 2.0
28 stars 3 forks source link

47 vscode enhs #49

Closed giubacc closed 2 years ago

giubacc commented 2 years ago

Hi, This is a first attempt to show you the remote container's attach capabilities of VS. I suggest you to read first the updated README.md to have a high level user's expectations for this enh. This enh has been created within a linux env and it heavily rely on bash capabilities. I expect this patch to currently not work from MS Windows (some discussion about this will be eventually required). I had been able to start the full composition: mr-plow + postgres + elastic + kibana; but I hadn't been able to successfully launch the test suite; it seems to me that every integration test source has service's ips and ports hardcoded. Also it seems to me that documentation in general is lacking of information on how to correctly execute the tests.

DarioBalinzo commented 2 years ago

Hi @giubacc, I will try the proposed solution soon in the next days, thanks for contributing!

for tests you can have a look here: https://github.com/Ringloop/mr-plow/blob/main/.github/workflows/ci.yml#L49

Right now tests have a simpler configuration regarding ES, because the assumption was that ES was listening on localhost, standard 9200 port and no pwd.

All tests have an initalization of a default es client https://github.com/Ringloop/mr-plow/blob/main/test/insert_integration_test.go#L40 defining the standard settings for test, we can modify this if we need to change something.

We can also add more info on how to run tests in the docs, maybe after trying this feature I will open a separate issue

DarioBalinzo commented 2 years ago

I tried to execute locally on ubuntu, but I'm getting this:

[2022-03-10T21:06:38.586Z] Remote-Containers 0.224.2 in VS Code 1.65.2 (c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1).
[2022-03-10T21:06:38.586Z] Start: Resolving Remote
[2022-03-10T21:06:38.598Z] Setting up container for folder or workspace: /home/dario/go/Mr-Plow
[2022-03-10T21:06:38.604Z] Start: Check Docker is running
[2022-03-10T21:06:38.605Z] Start: Run: docker version --format {{.Server.APIVersion}}
[2022-03-10T21:06:38.670Z] Stop (65 ms): Run: docker version --format {{.Server.APIVersion}}
[2022-03-10T21:06:38.671Z] Server API version: 1.41
[2022-03-10T21:06:38.671Z] Stop (67 ms): Check Docker is running
[2022-03-10T21:06:38.683Z] Start: Run: git rev-parse --show-cdup
[2022-03-10T21:06:38.695Z] Stop (12 ms): Run: git rev-parse --show-cdup
[2022-03-10T21:06:38.697Z] Running the initializeCommand from devcontainer.json...

[2022-03-10T21:06:38.699Z] Start: Run: /bin/sh -c /bin/bash /home/dario/go/Mr-Plow/.devcontainer/icstart.sh /home/dario/go/Mr-Plow
[2022-03-10T21:06:38.803Z] 42cb0f8c8cc1   mr-plow-docker_default       bridge    local
596fb08f5e1e   mr-plow-docker_elastic       bridge    local
[2022-03-10T21:06:38.809Z] mr-plow network already exist
[2022-03-10T21:06:38.811Z] Stop (112 ms): Run: /bin/sh -c /bin/bash /home/dario/go/Mr-Plow/.devcontainer/icstart.sh /home/dario/go/Mr-Plow
[2022-03-10T21:06:38.812Z] 
[2022-03-10T21:06:38.812Z] Start: Run: docker ps -q -a --filter label=vsch.local.folder=/home/dario/go/Mr-Plow --filter label=vsch.quality=stable
[2022-03-10T21:06:38.897Z] Stop (85 ms): Run: docker ps -q -a --filter label=vsch.local.folder=/home/dario/go/Mr-Plow --filter label=vsch.quality=stable
[2022-03-10T21:06:38.898Z] Start: Run: docker inspect --type container 19debff71495
[2022-03-10T21:06:38.988Z] Stop (90 ms): Run: docker inspect --type container 19debff71495
[2022-03-10T21:06:38.991Z] Start: Starting container
[2022-03-10T21:06:38.991Z] Start: Run: docker start 19debff71495b6845aaddfbf3d3e9f2cbc810a0bc34ba5234758bb1a1dce3219
[2022-03-10T21:06:39.128Z] Stop (137 ms): Run: docker start 19debff71495b6845aaddfbf3d3e9f2cbc810a0bc34ba5234758bb1a1dce3219
[2022-03-10T21:06:39.137Z] Command failed: docker start 19debff71495b6845aaddfbf3d3e9f2cbc810a0bc34ba5234758bb1a1dce3219
[2022-03-10T21:06:39.138Z] Error response from daemon: network mr-plow not found
Error: failed to start containers: 19debff71495b6845aaddfbf3d3e9f2cbc810a0bc34ba5234758bb1a1dce3219
[2022-03-10T21:06:39.138Z] Exit code 1

Do you have any suggestion? probably there is something related on network setup

giubacc commented 2 years ago

Hi @DarioBalinzo, thanks to have had the time to try this. The log you posted is indeed very strange: first you have the mr-plow network already exist log and then a Error response from daemon: network mr-plow not found. Keep in mind that the very first thing VSCode should do is to execute the line 8 of devcontainer.json file: "initializeCommand": "/bin/bash ${localWorkspaceFolder}/.devcontainer/icstart.sh ${localWorkspaceFolder}". This should ensure docker engine to create the mr-plow network. The devcontainer should then be attached to that network when VSCode invokes the docker run command. I would suggest to try to execute docker network ls and see if mr-plow network is actually present. Please, also update your local repository with the latest changes.