Skip to content
This repository has been archived by the owner on Jun 10, 2022. It is now read-only.

Convert rest to a npm installable lib or a binary #593

Open
fboucquez opened this issue Mar 24, 2021 · 2 comments
Open

Convert rest to a npm installable lib or a binary #593

fboucquez opened this issue Mar 24, 2021 · 2 comments
Labels
P3 Issue Low severity cosmetic issues with minor inconvenience

Comments

@fboucquez
Copy link
Collaborator

fboucquez commented Mar 24, 2021

Atm, catapult-rest is installed (in the docker image or in a node) like it's a dev machine. In the manual node setup process (not bootstrap), the node admin needs to clone the repo, install nodejs, npm install and run the inde.js script (like a regular developer).

I would like to change this so catapult rest can be installed with an npm install -g command (like a cli tool) or by downloading prepackaged binaries (like we have with the supernode agent).

Also, it's not easy to run rest in different working dirs using relative paths to configuration and server certificates. We would need to improve this. If we do this, Bootstrap can be used for barebone configuration without updating the current docker-compose absolute paths used in the rest.json

https://github.com/nemtech/symbol-bootstrap/blob/main/config/rest-gateway/rest.json.mustache#L38

@fboucquez fboucquez added the P3 Issue Low severity cosmetic issues with minor inconvenience label Mar 24, 2021
@gimre-xymcity
Copy link
Member

why ? that doesn't make much sense imo, especially that (besides docker) in most cases you probably do NOT want to do npm install **-g**

@fboucquez
Copy link
Collaborator Author

fboucquez commented Mar 25, 2021

My thinking,

The current option is like described in https://deploy-preview-623--nemtech.netlify.app/guides/network/running-a-symbol-node-manually.html#build-and-run-the-rest-gateway. It's pretty much a development setup in a target node/image

A node/target machine (or a new docker image) needs to:

Option A) Git clone. Current one:

  1. Install nodejs
  2. Install git
  3. install yarn
  4. Clone repo
  5. Check out the right tag like v.2.3.5 (@segfaultxavi this is missed in the manual rest doc)
  6. Go to the repo folder, ./yarn_setup.sh
  7. Go to the ./rest folder , yarn build
  8. node _build/index.js resources/rest.json (not easy to run in different working dirs and different rest.json paths)

Upgrades: checkout the new tag and rebuild everything.

Option B) NPM dependency:

  1. Install nodejs
  2. npm install -g [email protected]
  3. catapult-rest mypathto/rest.json

Upgrades: npm install -g catapult-rest@latest/aNewVersion

Option C) Pre-packaged binaries:

Similar to how node admins can install the agents manually.
https://docs.symbolplatform.com/guides/network/supernode-enrollment.html#manually

  1. wget https://catapult-rest.someurl.amazonaws.com/packages/2.3.5/catapult-rest-linux.bin
  2. chmod +x catapult-rest-linux.bin
  3. ./catapult-rest-linux.bin mypathto/rest.json

Upgrades: wget the new binary from the latest url

With C, the rest docker image can be standard ubuntu with just a binary file. It's faster to download, tthe base image would be shared between rest and server.

This is not a change I would like to implement so soon. We may be doing it while doing the rest typescript, catbuffer, and shared SDK refactoring.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P3 Issue Low severity cosmetic issues with minor inconvenience
Projects
None yet
Development

No branches or pull requests

2 participants