-
Notifications
You must be signed in to change notification settings - Fork 70
Introduce tutorial to deploy NodeJS runtime locally #190
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
Conversation
|
cc: @mrutkows |
The introduced tutorial uses Docker and a tranfer data tool (e.g. curl, wget or Postman). A summary of the tutorial steps are: 1. Create docker container based on core/nodejs14Action Dockerfile 2. Deploy/run the container locally 3. Create function that resides in a json file 4. Initialize the function against the deployed container using either curl, wget or Postman 5. Call/trigger function using either curl, wget or Postman Signed-off-by: Igor Braga <higorb1@gmail.com>
8363814 to
c4ad232
Compare
mrutkows
left a comment
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.
@bragaigor In general, we want all the runtimes to feature Gradle Wrapper as the simplified means for developers to build and test the runtime code (i.e., get developing the code) as the wrapper handles all installs. The manual Docker method you are adding is valuable, but should be clearly moved down as a secondary option leaving "intact" the exiting README text as it appears now as much as possible. In addition, we should avoid copying over Dockerfiles or creating artifacts which could accidentally be committed into the repo. by accident.
| git reset --hard origin/master | ||
| ``` | ||
|
|
||
| 2. Build docker |
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.
Subsection "Build the docker image"
README.md
Outdated
|
|
||
| Or in the command line you can simply type: | ||
| ``` | ||
| cp core/nodejs14Action/Dockerfile core/nodejsActionBase/ |
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.
Really do not like overwriting the Dockerfile in nodejsActionBase; is there an alternative (and one that we can make sure is part of /gitignore to avoid developers accidentally committing to the repo.?
Reorder tutorial so that Gradle instructions come first Signed-off-by: Igor Braga <higorb1@gmail.com>
8c30c7f to
6699cba
Compare
|
|
||
| **Do you want to learn more about using Node.js actions to build serverless applications?** Please see the main project documentation [here](https://github.com/apache/openwhisk/blob/master/docs/actions-nodejs.md) for that information. | ||
|
|
||
| ## Usage |
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.
Usage should remain the title. It is how you invoke this runtime from the CLI and not a "gradle" usage. Perhaps this section needs to have its title reverted and moved above either "gradle" or "docker" specific sections (and clarify that this is how you use this runtime and select the correct versions.
|
|
||
| --- | ||
|
|
||
| ## Using Gradle <a name="using_gradle"></a> |
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.
Adopting the "Build" -> "Using Gradle" section eliminates need for HTML anchor
| **Do you want to learn more about using Node.js actions to build serverless applications?** Please see the main project documentation [here](https://github.com/apache/openwhisk/blob/master/docs/actions-nodejs.md) for that information. | ||
|
|
||
| ## Usage | ||
| ## Build Runtimes |
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.
Actually, the notion of "build" (section) should be moved below sections "Usage", "Images", and "Development" as all are common/general info. not dependent on the gradle or docker (manual) builds.
Then you would have perhaps a layout like:
Usage
- NodeJS 10,12,etc.
Images
Runtimes manifest
Development
Building Runtimes
Choices are:
- Gradle (link to unique header)
- Docker (link to unique header)
Using Gradle
Prerequisites
Building
Testing
Using Docker
Prerequisites
Building
Testing
Testing functions with arguments
Example: Calculate the nth Fibonacci number
|
|
||
| ### Pre-requisites | ||
| - [Docker](https://www.docker.com/) | ||
| - [curl](https://curl.se/), [wget](https://www.gnu.org/software/wget/), or [Postman](https://www.postman.com/) |
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.
add some reason why you would choose this (manual) method over GRadle... e.g.,
"The Gradle Wrapper build method uses Docker internally to automate many functions. If you prefer building and testing with Docker directly, we have provided the following instructions"
|
|
||
| The `core/nodejsActionBase` folder contains the Node.js app server used to implement the [action interface](https://github.com/apache/openwhisk/blob/master/docs/actions-new.md#action-interface), used by the platform to inject action code into the runtime and fire invocation requests. This common code is used in all runtime versions. | ||
|
|
||
| ### Build |
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.
See layout suggested above
| cp core/nodejs14Action/Dockerfile build | ||
| ``` | ||
|
|
||
| If you follow the instructions at beginning of this tutorial [here](#build_gradle) that uses Gradle, you'll notice that Gradle takes care of this copying for us internally. Here since we just want to use docker and not worry about anything else we make create our own little build folder. |
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.
Do not refer to this page as a "tutorial"; instead add a subsection "Resetting the build"
| docker images | ||
| ``` | ||
|
|
||
| 2.2. Tag image (Optional step). Required if you’re pushing your docker image to a registry e.g. dockerHub |
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.
Subsection "(Optional) Tagging the image"
| docker tag <docker_image_ID> <dockerHub_username>/nodejs-action-v14:1.0-SNAPSHOT | ||
| ``` | ||
|
|
||
| 3. Run docker on localhost with either the following commands: |
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.
Move under "Testing" subsection
| ``` | ||
|
|
||
|
|
||
| ## Creating functions with arguments |
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.
subsection (see sugg. layout above)
| XXX_THE_END_OF_A_WHISK_ACTIVATION_XXX | ||
| ``` | ||
|
|
||
| ## Now let's create a more interesting function |
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.
subsection (see sugg. layout above)
|
Closing as abandoned |
The introduced tutorial uses Docker and a tranfer data
tool (e.g. curl, wget or Postman). A summary of the tutorial
steps are:
Dockerfile
using either curl, wget or Postman
Signed-off-by: Igor Braga higorb1@gmail.com