Skip to content

Conversation

@bragaigor
Copy link

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

@bragaigor
Copy link
Author

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>
Copy link
Contributor

@mrutkows mrutkows left a 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
Copy link
Contributor

@mrutkows mrutkows Mar 12, 2021

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/
Copy link
Contributor

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>

**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
Copy link
Contributor

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>
Copy link
Contributor

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
Copy link
Contributor

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/)
Copy link
Contributor

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
Copy link
Contributor

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.
Copy link
Contributor

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
Copy link
Contributor

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:
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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)

@dgrove-oss
Copy link
Member

dgrove-oss commented Aug 15, 2022

Closing as abandoned

@dgrove-oss dgrove-oss closed this Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants