Skip to content

Commit

Permalink
docs: clarify steps to verify node app in VM (#652)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

---------

Co-authored-by: Michael DuBelko <[email protected]>
  • Loading branch information
tigarmo and medubelko authored Jul 25, 2024
1 parent 8042e14 commit d09ad13
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/tutorial/code/node-app/task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
19 changes: 16 additions & 3 deletions docs/tutorial/node-app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d09ad13

Please sign in to comment.