Skip to content
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

Doc: How to use nodejs with node_modules properly ? #84

Open
hoh opened this issue Sep 16, 2021 · 1 comment
Open

Doc: How to use nodejs with node_modules properly ? #84

hoh opened this issue Sep 16, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@hoh
Copy link
Member

hoh commented Sep 16, 2021

No description provided.

@hoh hoh added the documentation Improvements or additions to documentation label Sep 16, 2021
@hoh
Copy link
Member Author

hoh commented Nov 12, 2021

An example used for an internal project:

1. Build the JS

$ cd project
$ docker run --rm -ti -v $(pwd):/opt/project node bash
# cd /opt/project
# npm i
# npm run build

Setup to run in a VM

$ cp .env.defaults dist/
$ cat >> run.sh << EOF
#!/bin/sh
cd /opt
ls
node /opt/index.js
EOF

Upload the node_modules

$ mksquashfs node_modules node_modules.squashfs
$ aleph upload node_modules.squashfs

And obtain the item_hash for the next step.

Build and upload the program

$ aleph program ../my-project/project/dist/ "run.sh" --runtime VVV
Add volume ? [y/N] y
Description: node_modules
Mount: /opt/node_modules
Persist on VM host ? [y/N] 
Ref: WWW
Use latest version ? [Y/n] 

Add volume ? [y/N] y
Description: data
Mount: /data
Persist on VM host ? [y/N] y
Volume name: data
Size in MiB: 1000

Add volume ? [y/N] 
Your program has been uploaded on Aleph .

Available on:
  https://aleph.sh/vm/XXX
  https://yyy.aleph.sh
Visualise on:
  https://explorer.aleph.im/address/ETH/ZZZ/message/PROGRAM/XXX

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant