-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: add a nodejs tutorial #397
Conversation
The tutorial builds a simple "hello world" webapp and showcases using a package-repository to install newer node. Fixes #369
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran this in a fresh Jammy VM:
ubuntu@racy-chinook:~$ sudo lxd init --auto
ubuntu@racy-chinook:~$ sudo snap install docker
docker 20.10.24 from Canonical✓ installed
ubuntu@racy-chinook:~$ sudo snap install rockcraft --edge --classic
rockcraft (edge) 0+git.36080ac from Sergio Schvezov ⭐ (sergiusens) installed
ubuntu@racy-chinook:~$ mkdir my_rock
ubuntu@racy-chinook:~$ cd my_rock/
ubuntu@racy-chinook:~/my_rock$ mkdir src
ubuntu@racy-chinook:~/my_rock$ nano src/package.json
ubuntu@racy-chinook:~/my_rock$ nano src/server.js
ubuntu@racy-chinook:~/my_rock$ nano rockcraft.yaml
ubuntu@racy-chinook:~/my_rock$ nano rockcraft.yaml
ubuntu@racy-chinook:~/my_rock$ rockcraft pack
At this point it failed because of Docker being inconsiderate on the network.
Using the standard workaround:
sudo iptables -F FORWARD
sudo iptables -P FORWARD ACCEPT
I got further, but I hadn't prepped sufficient disk space, so I'll have to come back to it.
It's probably out of scope for this tutorial, but should we add some documentation for troubleshooting this particular issue? It seems like it'd be pretty common for Rockcraft in particular.
With the suggested changes above, it works. (Including not separately installing skopeo.) |
@lengau while working on the review fixes I remembered that craft-parts has an npm plugin (doh), so in the interest of dogfooding it I updated the actual project to use it (it's now way simpler). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super neat! nice. thanks.
I only have one request, but it should be ok after that :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went through the tutorial, worked great for me!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the changes
hello, i have a feeling about the tutorial, so the application is pretty simple ( good point) but i think we can explain a little more the section we add on the rockcraft.yaml. One example is the service section, we can say " this part is defined to do this.... and if you application crash....". WDYT? |
@SamirPS it's tough because a guideline of tutorials in Diátaxis is to keep explanations to a minimum, which is very hard to do sometimes. I already thought I put too much in but a tech author reviewed it and seems to be fine. |
I checked with other people, and they said your tutorial is good. So I will only ask, if possible, could you please add the full rockcraft.yaml file at the end to help people to copy paste the yaml file. |
Sure. I had to update the notation to extract the snippets so that the whole file is "clean", but I put the whole rockcraft.yaml file at the end of the "Project Setup" section |
The tutorial builds a simple "hello world" webapp and showcases using the
npm
plugin.Fixes #369