planetarium / NineChronicles.Headless

A headless node of NineChronicles game network, powered by Libplanet.
https://planetarium.github.io/NineChronicles.Headless/
GNU Affero General Public License v3.0
35 stars 37 forks source link

Libplanet.Headless contain Swarm<T>.BlockDemand make docker buit failed. #652

Closed nedondev closed 3 years ago

nedondev commented 3 years ago

I use clone repository and try docker build with command: docker build -t 9c --build-arg COMMIT=1 .

Result:

Step 15/21 : RUN dotnet publish NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj     -c Release     -r linux-x64     -o out     --self-contained     --version-suffix $COMMIT
 ---> Running in 26591421c47d
Microsoft (R) Build Engine version 16.7.2+b60ddb6f4 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /app/Lib9c/.Libplanet/Libplanet.Stun/Libplanet.Stun.csproj (in 20.27 sec).
  Restored /app/Lib9c/.Libplanet/Libplanet.Extensions.Cocona/Libplanet.Extensions.Cocona.csproj (in 20.27 sec).
  Restored /app/Lib9c/Lib9c/Lib9c.csproj (in 155 ms).
  Restored /app/NineChronicles.RPC.Shared/NineChronicles.RPC.Shared/NineChronicles.RPC.Shared.csproj (in 96 ms).
  Restored /app/NineChronicles.Headless/NineChronicles.Headless.csproj (in 24.02 sec).
  Restored /app/Libplanet.Headless/Libplanet.Headless.csproj (in 3.69 sec).
  Restored /app/NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj (in 24.2 sec).
  Restored /app/Lib9c/.Libplanet/Libplanet.RocksDBStore/Libplanet.RocksDBStore.csproj (in 280 ms).
  Restored /app/Lib9c/.Libplanet/Libplanet/Libplanet.csproj (in 4.29 sec).
  Restored /app/Lib9c/.Libplanet/Libplanet.Explorer/Libplanet.Explorer.csproj (in 3.72 sec).
  Restored /app/Lib9c/.Libplanet/Libplanet.Analyzers/Libplanet.Analyzers.csproj (in 8.1 sec).
  NineChronicles.RPC.Shared -> /app/NineChronicles.RPC.Shared/NineChronicles.RPC.Shared/.bin/netstandard2.0/NineChronicles.RPC.Shared.dll
  Libplanet.Stun -> /app/Lib9c/.Libplanet/Libplanet.Stun/bin/Release/netstandard2.0/Libplanet.Stun.dll
  Libplanet.Stun -> /app/Lib9c/.Libplanet/Libplanet.Stun/bin/Release/netcoreapp3.1/Libplanet.Stun.dll
  Libplanet -> /app/Lib9c/.Libplanet/Libplanet/bin/Release/netstandard2.0/Libplanet.dll
  Libplanet -> /app/Lib9c/.Libplanet/Libplanet/bin/Release/netcoreapp3.1/Libplanet.dll
  Libplanet.RocksDBStore -> /app/Lib9c/.Libplanet/Libplanet.RocksDBStore/bin/Release/netstandard2.0/Libplanet.RocksDBStore.dll
  Libplanet.Analyzers -> /app/Lib9c/.Libplanet/Libplanet.Analyzers/bin/Release/netstandard2.0/Libplanet.Analyzers.dll
  Lib9c -> /app/Lib9c/Lib9c/.bin/netstandard2.0/Lib9c.dll
Hosting/LibplanetNodeService.cs(569,28): error CS1061: 'Swarm<T>' does not contain a definition for 'BlockDemand' and no accessible extension method 'BlockDemand' accepting a first argument of type 'Swarm<T>' could be found (are you missing a using directive or an assembly reference?) [/app/Libplanet.Headless/Libplanet.Headless.csproj]
Hosting/LibplanetNodeService.cs(572,67): error CS1061: 'Swarm<T>' does not contain a definition for 'BlockDemand' and no accessible extension method 'BlockDemand' accepting a first argument of type 'Swarm<T>' could be found (are you missing a using directive or an assembly reference?) [/app/Libplanet.Headless/Libplanet.Headless.csproj]
  Libplanet.Extensions.Cocona -> /app/Lib9c/.Libplanet/Libplanet.Extensions.Cocona/bin/Release/netstandard2.0/Libplanet.Extensions.Cocona.dll
  Libplanet.Explorer -> /app/Lib9c/.Libplanet/Libplanet.Explorer/bin/Release/netcoreapp3.1/Libplanet.Explorer.dll
  Successfully created package '/app/Lib9c/.Libplanet/Libplanet.Extensions.Cocona/bin/Release/Libplanet.Extensions.Cocona.1.0.0-test.nupkg'.
The command '/bin/sh -c dotnet publish NineChronicles.Headless.Executable/NineChronicles.Headless.Executable.csproj     -c Release     -r linux-x64     -o out     --self-contained     --version-suffix $COMMIT' returned a non-zero code: 1

I investigate code and other project. I found that Swarm\<T>.BlockDemand have been remove from libplanet, so Code checking BlockDemand from LibplanetNodeService.cs should be removed. Currently I don't know if remove impact program.

area363 commented 3 years ago

Hi, which branch are you using to build the docker image? Also, did you update all the submodules associated with this repo? Generally, the issue above occurs when the submodules haven't been updated. This can be done by running git submodule update --init --recursive from the top path of your local NineChronicles.Headless repo.

nedondev commented 3 years ago

I use development branch to build docker.

$ git branch
* development

When I didn't update submodules. It will become this error.

$ docker build -t 9c --build-arg COMMIT=1 .

Sending build context to Docker daemon  966.7kB
Step 1/21 : FROM mcr.microsoft.com/dotnet/core/sdk:3.1 AS build-env
 ---> 0c5f4737c8eb
Step 2/21 : WORKDIR /app
 ---> Running in d38ea991e9a1
Removing intermediate container d38ea991e9a1
 ---> 98c3bab685d9
Step 3/21 : ARG COMMIT
 ---> Running in 00ecc1290512
Removing intermediate container 00ecc1290512
 ---> e604c013a802
Step 4/21 : COPY ./Lib9c/Lib9c/Lib9c.csproj ./Lib9c/
COPY failed: stat /var/snap/docker/common/var-lib-docker/tmp/docker-builder435267965/Lib9c/Lib9c/Lib9c.csproj: no such file or directory
nedondev commented 3 years ago

I solve this issue when change branch to rc-v100070 with recently added merge request.

nedondev commented 3 years ago

I changed branch with command:

git checkout -t remotes/origin/rc-v100070

If anyone can't update submodules because not configure ssh on Github may be use HTTPS instead:

git rm Lib9c &&\
git rm NineChronicles.RPC.Shared &&\
git submodule add https://github.com/planetarium/lib9c.git Lib9c &&\
git submodule add https://github.com/planetarium/NineChronicles.RPC.Shared.git NineChronicles.RPC.Shared &&\
git submodule update --init --recursive