chainpoint / chainpoint-gateway

Chainpoint Gateway
https://chainpoint.org
Apache License 2.0
27 stars 12 forks source link

Docker Alpine Redux #28

Closed grempe closed 4 years ago

grempe commented 5 years ago

Pull request to incorporate @filoozom Dockerfile changes. Currently this is throwing runtime errors when built/run on macOS.

grempe commented 5 years ago

@filoozom I was attempting to more fully pull your Dockerfile changes for Alpine into this repo. I made some required changes to the Makefile to allow things to potentially work (those changes are now included on develop branch and this feature branch is based off of that).

However, when attempting to run and build it fails on macOS Docker Engine.

...
Successfully built 23b43bbceab0
Successfully tagged gcr.io/chainpoint-registry/chainpoint-node:latest
mkdir -p ./.data/rocksdb && chmod 777 ./.data/rocksdb
docker-compose up -d --no-build
Creating network "chainpoint-node-src_chainpoint-node" with driver "bridge"
Creating chainpoint-node-src_chainpoint-node_1 ... done
docker-compose logs -f -t | grep chainpoint-node
Attaching to chainpoint-node-src_chainpoint-node_1
chainpoint-node_1  | 2018-12-17T21:29:20.210030131Z yarn run v1.12.3
chainpoint-node_1  | 2018-12-17T21:29:20.287419061Z $ node server.js
chainpoint-node_1  | 2018-12-17T21:29:21.137592949Z INFO : App : Starting : Version 1.5.3
chainpoint-node_1  | 2018-12-17T21:29:22.422293739Z Illegal instruction
chainpoint-node_1  | 2018-12-17T21:29:22.432487881Z error Command failed with exit code 132.
chainpoint-node_1  | 2018-12-17T21:29:22.432828260Z info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The full output (7000k lines) is:

https://gist.github.com/grempe/2cf0a47edccb8a15ed3ba0f5f940c881

If you could try running this in the context of the Makefile provided (e.g. make up && make logs) and help debug the Dockerfile you provided that would be helpful. If we can get this clean we'll release it for all Node operators.

Thanks.

filoozom commented 5 years ago

Looks like you're simply using an old version of https://github.com/level/rocksdb:

verbose 1.628 Performing "GET" request to "https://registry.yarnpkg.com/level-rocksdb/-/level-rocksdb-3.0.1.tgz".
verbose 1.688 Performing "GET" request to "https://registry.yarnpkg.com/rocksdb/-/rocksdb-3.0.1.tgz".

The minimum version should be 3.0.2.

filoozom commented 5 years ago

It did work on npm, does yarn do things differently? It should be published, as level-rocksdb has "rocksdb": "^3.0.0" in its package.json, which covers 3.0.2.

jacohend commented 5 years ago

@michael-iglesias When you get a chance, could you see if you can replicate the mac docker build failure mentioned above? The image builds fine on the linux docker engine.

filoozom commented 5 years ago

I just tried on MacOS and it worked without any issues. I got the right rocksdb version too (3.0.3).

Is there a reason why the JOBS=max was dropped? (see https://github.com/chainpoint/chainpoint-node-src/pull/23/files#r227073397)

Also, I don't know too much about yarn, but it would be nice to have the build logs as that's the longest step and it's nice to be able to follow progress and make sure it didn't hang. npm showed those logs by default.

filoozom commented 5 years ago

Actually never mind, I forgot to discard the last commit and am getting 3.0.1 without it. Strange.

In the Docker image:

$ cat yarn.lock | grep rocksdb
level-rocksdb@^3.0.1:
  resolved "https://registry.yarnpkg.com/level-rocksdb/-/level-rocksdb-3.0.1.tgz#1b65f32cf1fdd6127b0e88b6b455761607870802"
    rocksdb "^3.0.0"
rocksdb@^3.0.0:
  resolved "https://registry.yarnpkg.com/rocksdb/-/rocksdb-3.0.1.tgz#87a774ab39b7589ab31b1d8fcf92cfecc0d8ca0f"

Locally after yarn add level-rocksdb:

level-rocksdb@^3.0.1:
  resolved "https://registry.yarnpkg.com/level-rocksdb/-/level-rocksdb-3.0.1.tgz#1b65f32cf1fdd6127b0e88b6b455761607870802"
    rocksdb "^3.0.0"
rocksdb@^3.0.0:
  resolved "https://registry.yarnpkg.com/rocksdb/-/rocksdb-3.0.3.tgz#04c26f4c9a71ae124049a7fb3112948906749c07"

Well, obviously it's because of the yarn.lock. I guess a yarn upgrade level-rocksdb is in order.


Also @jacohend, the issue is not during the build but during execution.