Subterfuge-Revived / Remake-Backend

Server side validation and API
Creative Commons Zero v1.0 Universal
10 stars 1 forks source link

Utilize the Core CLI tool #16

Open QuinnBast opened 4 years ago

QuinnBast commented 4 years ago

To verify and validate incoming events we will need to install dotnet & be able to run the cli tool. This will probably need to be added to the DockerFile. These are the steps I took to do so on my raspberry pi:

  1. Get the latest link for dot net core 3.1 from the microsoft website https://dotnet.microsoft.com/download/dotnet-core/3.1

  2. Select version 3.1 and copy the "Direct Link" URL. Replace future occurances of {directLink} with this link.

  3. Navigate to a folder of your choice where you would like to download dotnet to. Make note of the current folder path at this point. Replace future occurances of {path} with your current path.

  4. Download dotnet: wget {directLink}

  5. Create a directory to extract the tar: mkdir dotnet-arm32

  6. Unzip to the directory: tar zxf dotnet-sdk-3.1.102-linux-arm.tar.gz -C dotnet-arm32/

  7. Allow using the dotnet command globally by setting the PATH: export DOTNET_ROOT={path}/dotnet-arm32/ export PATH=$PATH:{path}/dotnet-arm32/

  8. Verify the installation worked: dotnet --info

  9. Run the Core CLI with dotnet <cli.dll> <arguments>

A download for the Cli tool can be found in the Core repositories's Releases

griendt commented 4 years ago

I installed .NET from within the current Docker container. First I did it the way Microsoft recommended, namely:

wget https://packages.microsoft.com/config/ubuntu/19.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
apt-get update
apt-get install apt-transport-https
apt-get update
apt-get install dotnet-sdk-3.1

I could confirm that the installation was successful:

root@4638a1db4806:/var/www# dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.201
 Commit:    b1768b4ae7

Runtime Environment:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.201/

Host (useful for support):
  Version: 3.1.3
  Commit:  4a9f85e9f8

.NET Core SDKs installed:
  3.1.201 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

However, when downloading the CLI DLL and trying to run it, I get the following error:

root@4638a1db4806:/var/www/Remake-Core-0.1.0# dotnet SubterfugeCoreCLI.dll
A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/var/www/Remake-Core-0.1.0/'.
Failed to run as a self-contained app. If this should be a framework-dependent app, add the /var/www/Remake-Core-0.1.0/SubterfugeCoreCLI.runtimeconfig.json file specifying the appropriate framework.

I did a quick Google search but the only thing I can find is something about project files. I assume (and hope) I would not need to have the source code of the Core present in my container to use the DLL?

QuinnBast commented 4 years ago

Oh right, you will also need to download the SubterfugeCore.dll as well. The Cli references that dll. As long as both are in the same directory I think it should work

QuinnBast commented 4 years ago

Update on this. It appears that with the creation of the DLL there are some dependency files that get output along with the dll. I didn't realize these were required. On the next Core release, I will add these files to it.

image

Additionally, after exeucting with all the dependencies I got the following error, which says "framework version 2.1 was not found."

image

It appears the link I provided above is the wrong version of dotnet and they aren't backwards compatible. Here's a link to version 2.1 which is the correct version of dotnet to be compatible.

griendt commented 4 years ago

Great work!

As soon as there is a suitable Core release available I'll be sure to give it another go.

QuinnBast commented 4 years ago

New release here. Download Release.zip to get all the files you need.