NRE Labs Community

Using the `fakecurriculum` in antidote-web

Hi All, new dev here (April 2021).

Trying to run antidote-web using the make hack script in a local dev environment. The app spins up on port 8080, but when I look in the network tab, I’m getting this error:
use-fetch.js:33 GET http://127.0.0.1:8086/exp/lesson net::ERR_CONNECTION_REFUSED

I thought that might be a setting I needed to update to point to a different local directory for lesson content, but didn’t see it in a config file that I could find. I checked the fetch call where it’s failing, and just passing the above URL with no options object.

thanks for any help,

Running Mac OS Catalina with latest Chrome Version 89.0.4389.90 (Official Build) (x86_64), also Docker Desktop for Mac 3.2.2

Thanks @mukungfu - you’re missing the antidote-core component, which is really where all the work gets done. antidote-web is just a client on top of this

There’s some updates that need to be done to this portion of the docs but you can still find some value in these pages:

You might also notice there’s a docker-compose file in the antidote-web repository that’s called when you run make hack. Uncomment the nats-server and antidote-core sections of the docker compose file, and re-run make hack and this will provide the API that antidote-web is looking for.

Note that the configuration for antidote-core referenced here only starts the API service, which means you need to populate the state database yourself with whatever is needed for front-end development. This is done via the antictl command, which is available in the antidote-core container using docker exec. Basically, this command lets you just craft arbitrary JSON files that adhere to one of the internal models, and manually place them in the internal database.

Check out antictl -h for usage, and see antidote-core/test-livelessons.json at master · nre-learning/antidote-core · GitHub for an example of a JSON blob to get you started.

Thanks for your patience; further questions are welcome, of course.

Awesome, I was able to complete these steps (where 4271e8a0c3ea is my antidote-core dockerId) :

to see that there were no lessons with:
docker exec -it 4271e8a0c3ea antictl ll list

then create the linked json content as a local file, lesson1.json & copy it into the docker instance with
docker cp lesson1.json 4271e8a0c3ea:lesson1.json

followed by the command to create
docker exec -it 4271e8a0c3ea antictl ll create lesson1.json

and the the anticlt ll list command now shows:
{"LiveLessons":{"abcdef":{"ID":"abcdef","SessionID":"atotallylegitsessionohyeah","AntidoteID":"","LessonSlug":"jinja2","LiveEndpoints":{"linux1":{"Name":"linux1","Image":"utility","Ports":[22],"LivePresentations":[{"Name":"cli","Port":22,"Type":"ssh","HepDomain":""}],"Host":"123.123.123.123","SSHUser":"","SSHPassword":""}},"CurrentStage":0,"GuideContents":"","GuideType":"","GuideDomain":"","Status":"READY","Error":false,"HealthyTests":4,"TotalTests":4,"Diagram":"a lovely diagram","Video":"baby shark","StageVideo":""}}}

A refresh of the web app is still showing as though no lessons exist
(it’s trying to call .filter() on a lessons list/array that is undefined. )

Do I need to restart a service or re run make hack?
Will manually created lessons persist across restarts or rebuilds? my guess is not likely.

More directly, what I’m trying to achieve is to have the web interface just have one sample lesson for local dev/testing, so maybe there’s a better way to do that, like running the full self-medicated setup?
I had thought maybe the make hack might have be an easier/lighter way to get a single lesson in there.

Ah - most things that don’t have to do with live state are read from a curriculum repository, like the NRE Labs curriculum. Alternatively, the antidote test curriculum will likely be better for your needs. You’ll want to clone that, and point the antidote-core config to it.

Hi @mierdin, you’ve solved this with recent updates, thank you!

Current steps for others to get lightweight front end dev environment:

  1. clone antidote-web and antidote-test-curriculum repos as siblings
  2. run make hack script in antidote-web root directory
  3. As explained in the antidote-web README.md, run
    docker exec antidote-web_antidote-core_1 antictl livelesson create /hack/dev-livelessons.json
    in another terminal to create the test lesson (this has to be done each time you re-run make hack)
  4. Load/refresh localhost:8080

Should be good to go!

This process is likely to continue to improve over time, so the best bet is likely to just check in periodically on the antidote-web README

1 Like