From d09ad13493b8dc0cbb95db7285ef4a6d8a166f67 Mon Sep 17 00:00:00 2001 From: Tiago Nobrega Date: Thu, 25 Jul 2024 16:07:13 -0300 Subject: [PATCH] docs: clarify steps to verify node app in VM (#652) * docs: clarify steps to verify node app in VM Add a paragraph with `curl` instructions for the case where the tutorial is being performed on a Multipass VM. Fixes #626 * Apply suggestions from code review Co-authored-by: Michael DuBelko --------- Co-authored-by: Michael DuBelko --- docs/tutorial/code/node-app/task.yaml | 4 ++++ docs/tutorial/node-app.rst | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/docs/tutorial/code/node-app/task.yaml b/docs/tutorial/code/node-app/task.yaml index 58da9cfa6..7ce2b4b99 100644 --- a/docs/tutorial/code/node-app/task.yaml +++ b/docs/tutorial/code/node-app/task.yaml @@ -38,6 +38,10 @@ execute: | # Wait for a bit for the app to come online retry -n 5 --wait 2 curl localhost:8000 + # [docs:curl-localhost] + curl http://localhost:8000 + # [docs:curl-localhost-end] + curl localhost:8000 | MATCH "Hello World from inside the rock" # [docs:stop-container] diff --git a/docs/tutorial/node-app.rst b/docs/tutorial/node-app.rst index 83c4131ab..fb1e78306 100644 --- a/docs/tutorial/node-app.rst +++ b/docs/tutorial/node-app.rst @@ -116,9 +116,22 @@ service: 2023-10-30T12:37:33.663Z [pebble] Service "app" starting: node server.js 2023-10-30T12:37:33.864Z [app] Running on http://0.0.0.0:8080 -Next, open your web browser and navigate to ``http://localhost:8000``. You -should see a blank page with a "Hello World from inside the rock!" message. -Success! +Next we'll verify that the Node.js app is up and running. If you're working on +a regular Ubuntu system, open your web browser and go to +``http://localhost:8000``. You should see a blank page with a +"Hello World from inside the rock!" message. Success! + +If, instead, you're working in a Multipass VM, you can +open another shell into the VM and access the app with curl: + +.. literalinclude:: code/node-app/task.yaml + :language: bash + :prepend: multipass shell rock-dev + :start-after: [docs:curl-localhost] + :end-before: [docs:curl-localhost-end] + :dedent: 2 + +This should also print "Hello World from inside the rock!" to the terminal. You can now stop the running container by either interrupting it with CTRL+C or by running the following in another terminal: