Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerfile and VSCode launch scripts to run logcabin build in docker container. #239

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

unmeshjoshi
Copy link

Building logcabin code with correct dependency versions is a hassle. Using docker container helps as we can control the versions being used.
VSCode with its remote development pack allows to have code on our machine (with whatever OS version) but run it in a docker container. This pull request has a Docker file and VSCode launch scripts to be able to build and run logcabin code in docker container.

@ongardie
Copy link
Member

ongardie commented Jul 23, 2020

Thanks @unmeshjoshi. This looks like a good idea at first glance. Just to set expectations, it might be a (long) while before I get to reviewing and merging this. Hopefully others will see it here in the meantime.

README.md Outdated

Running with Docker
======================
Getting all the dependencies right to build and run logcabin can be an issue. Its easier to run it with a docker container where dependency versions are managed properly. There is a dockerfile which can be used as following
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small formatting nitpicks. I'm not sure if they are enforced but it couldn't hurt to match the rest of the file.

  1. Looks like all the section headers have a new line after them.
  2. Looks like a column length limit is respected except for URLs (probaly 80).

Overall I was able to build in the docker container specified here.

I did get 1 unit test failure when running tests in the container.

root@acd8a7262ee0:/logcabin# ./build/test/test 
[==========] Running 423 tests from 58 test cases.
1595531506.861324 RPC/Address.cc:213 in refresh() WARNING[12:thread 1]: Unknown error from getaddrinfo("qqq", "81"): Temporary failure in name resolution
[----------] 10 tests from RPCClientRPCTest
[ RUN      ] RPCClientRPCTest.waitForReply_timeout
build/RPC/ClientRPCTest.cc:159: Failure
Value of: rpc.waitForReply(__null, __null, ClientRPC::Clock::now() + std::chrono::seconds(10))
  Actual: TIMEOUT
Expected: ClientRPC::Status::OK
Which is: OK
[==========] 423 tests from 58 test cases ran. (15939 ms total)
[  PASSED  ] 422 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] RPCClientRPCTest.waitForReply_timeout

 1 FAILED TEST

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the column width.
I tried to reproduce this error but could not. I tried two things.

  1. Limiting resources to docker container to see if it fails some tests.

docker run --rm -it --memory 128m --cpuset-cpus 0 --cpus=0.5 -v $(pwd):/logcabin logcabin-dev:latest /bin/bash -c /logcabin/build/test/test

This test depends on timing, so failures are likely under heavy load, valgrind, etc.
[==========] 601 tests from 67 test cases ran. (5724 ms total)
[ PASSED ] 600 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] ClientClientImplExactlyOnceTest.keepAliveThreadMain_TimingSensitive

  1. Trying turning off the internet. This fails RPCAddressTest
    uild/RPC/AddressTest.cc:184: Failure
    Value of: googleDNS
    Actual: "Unspecified"
    Expected: "8.8.8.8:80"
    This test requires connectivity to the Internet for a DNS lookup. Alternatively, you can point google-public-dns-a.google.com to 8.8.8.8 in your /etc/hosts file.
    [==========] 601 tests from 67 test cases ran. (173608 ms total)
    [ PASSED ] 600 tests.
    [ FAILED ] 1 test, listed below:
    [ FAILED ] RPCAddressTest.refresh

But with enough resources, and internet connectivity, all the tests passed in multiple runs.

1. Install VSCode https://code.visualstudio.com/
2. Install remote development extension for VSCode from https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.vscode-remote-extensionpack
3. Open logcabin folder.
4. Run/Debug by executing Run menu.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only scratched the surface using vscode and the remote development plugin. Run/Debug in the Run menu gave me a permission denied error. Related, I had to run all the docker commands with sudo. Is there a configuration step that I'm missing?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added an instruction in README to add user to docker group after docker installation, so that you do not need to run sudo. That should remove the permission denied errors.

@nhardt
Copy link
Contributor

nhardt commented Jul 24, 2020

Thanks for the additional instructions. That worked for me.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants