mdenet / educationplatform

Eclipse Public License 2.0
2 stars 3 forks source link

Running the platform: not working on Windows 10 #64

Closed arturboronat closed 1 year ago

arturboronat commented 1 year ago

Not able to run platform on Windows 10

Below I'm explaining the problems I experienced to install the platform on Windows 10. I explored several alternatives, and I'm reporting where I got stuck in each of them.

Working with the sources

I tried to have a go at executing the platform on my computer, both using the sources and using the containerised version.

Find below the problems I found in both cases:

Installation notes: to run education platform

Before npm run build --workspaces:

npm install -g tsc
npm install -g webpack
npm install typescript

Before running npm run start --workspace=platform, the docker daemon must be running and I executed this command from an elevated powershell terminal.

The tokenserver run but I could not access it: http://127.0.0.1:10000/ gives Cannot GET /.

Running activities

When running the Epsilon playground example given here, the page hangs because I am not running anything on port 8082. The section on external tool functions suggests that I need to run the dockerised epsilon playground.

Executing the Epsilon platform

From sources

When choosing to compile the image and run it locally I got this error:

WARNING: buildx: failed to read current commit information with git rev-parse --is-inside-work-tree

Containerised version

It executed well from the already compiled dockerised image. And I can run the Epsilon playground with its examples on port 8082.

Executing Epsilon tasks from MDENet playground

Going back to the MDENet playground, when I execute http://127.0.0.1:8082/epsilon-example/epsilon-example_activity.json NGINX fails.

So when I execute http://127.0.0.1:8080/?activities=http://127.0.0.1:8082/epsilon-example/epsilon-example_activity.json, the platforms asks me for my GitHub credentials:

Problems found

Currently, I am stuck here with the following problens:

Working with the Dockerised version

Problem from Windows (Powershell)

On Windows, I needed git config --global core.longpaths true for cloning the repo.

It did not work, probably because the setup is for Linux, it would be good to provide an alternative to start.sh for Windows.

Problem from WSL2 Ubuntu

I tried building the container on WSL Ubuntu. Unfortunately, I cannot access the Docker daemon from WSL owing to this error: curl: (7) Failed to connect to localhost port 2375: Connection refused

Enabling Expose daemon on tcp://localhost:2375 without TLS on Docker Desktop settings did not help much. The firewall has an inbound rule and seems okay. I rebooted the server and WSL several times.

barnettwilliam commented 1 year ago

Thank you for the details of running the platform on windows I'll need to take a look into some of the issues and update the readmes.

From the end of last week the platform is fully dockerised so there is now no need to build some of the tool separately and use the old launch.sh when just running the platform.

It did not work, probably because the setup is for Linux, it would be good to provide an alternative to start.sh for Windows.

The platform containers are linux based and the start.sh is copied in, so the start script shouldn't be executed by the host building it only by the running container. However, there may be some other build issue when using windows as this hasn't been tested only on Ubuntu which has been used for development. There should be no reason why windows cannot be used though.

barnettwilliam commented 1 year ago

Docker issues

The primary cause of the platform failing to run is the windows line endings of the checked out files particularly the .sh scripts. So, even though they were being copied into the containers they were no longer recognised as shell scripts. The fix is to use the .gitattributes to specify what file to normalise the line endings for and apply this to all repositories.

The fix will be included in the 64-running-the-platform-not-working-on-windows-10 branches linked to this issue.

If the repository has been previously checked out you may have to run git rm --cached -r . in the platformtools submodule so that the files are re-normalised.

Developing tools

I think the primary way to develop for the education platform should to be use educationplatform-docker as the starting point so doing something like the following.

  1. Get the educationplatform-docker example running and activities executing as expected
  2. Make changes to the platform
    1. Develop tool service.
    2. Build and run submodule tests.
    3. Create a new activity.
  3. Re-launch the platform to see the changes made.

Having the sources working will be helpful for step ii, building and running tests. Though for adding tool services the platform shouldn't need to be modified, only the platformtools and educationplatform-examples submodules would need to be modified.

Other issues

...port 2375: Connection refused

I didn't see the connection refused error that you saw, however it seems you had docker running? as you mentioned start.sh which is the cause of the container failing that was reported by docker after trying to start the platform.

One step you have to do is switch docker to build for linux using - .\DockerCli.exe -SwitchDaemon -SwitchLinuxEngine or right-clicking the systray icon and setting the option there.

I did have a lot general issues setting up docker on windows. It wouldn't work on virtualbox vm on a linux or windows host. So, I ended up having to install it directly on a non-virtualised machine. WSL is very resource intensive and uses 8GB of system memory alone. The docker desktop ui seemed to go unresponsive and sometimes hang starting docker However, once the line endings had been corrected and all old images deleted and cleaned docker system prune and system restarted it seemed to be working more reliably.

Docker is meant to make things easier by configuring the webservers for examples, the platform, and tool services and the connections among them. It also allows the configurations to be tested in an easy to reproduce way.

Your notes were very helpful, I'm updating the readme with the windows specifics.

Potential Improvements

An improvement could be to create additional native windows containers to support development on windows. In particular for the tool services as these are the largest containers because of all the maven eclipse dependencies. However, requires some development overhead.

Or recommend the use of a linux virtual machine for education platform development, I haven't had tried this on a windows host though but I believe @szschaler does this so he may be able to add if the performance is acceptable.

Token server

The token server is more like a proxy and there is no web interface so is probably running as expected. It isn't yet configured in the dockerised example, there is an open issue for adding it - mdenet/educationplatform-docker#4 .