From 3a51080fba87651306ffc37c22558477f4935a4a Mon Sep 17 00:00:00 2001 From: Leandro Del Sole Date: Sun, 30 Jun 2019 09:16:56 -0300 Subject: [PATCH 1/3] Go file has changed in newer versions --- Introduction/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Introduction/README.md b/Introduction/README.md index 8754b45..96ab82f 100644 --- a/Introduction/README.md +++ b/Introduction/README.md @@ -61,7 +61,7 @@ Now get a list of the directory contents. >``` ```txt -Gopkg.toml func.go func.yaml +func.go func.yaml go.mod ``` The `func.go` file which contains your actual Go function is generated along @@ -152,7 +152,7 @@ folder name. We'll see this come into play later on. ### Other Function Files The `fn init` command generated one other file. -* `Gopkg.toml` -- the Go dep tool dependency management tool file which +* `go.mod` -- the Go dep tool dependency management tool file which specifies all the dependencies for your function. ## Deploy Your First Function From f102eef3c3c0ca5a4122f61202a4c6904dc6fbf0 Mon Sep 17 00:00:00 2001 From: Leandro Del Sole Date: Sun, 30 Jun 2019 09:23:49 -0300 Subject: [PATCH 2/3] The trigger was not generated automatically with this suffix "-trigger". The default trigger name may have changed. --- Introduction/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Introduction/README.md b/Introduction/README.md index 96ab82f..64dc7ea 100644 --- a/Introduction/README.md +++ b/Introduction/README.md @@ -125,9 +125,9 @@ version: 0.0.1 runtime: go entrypoint: ./func triggers: -- name: gofn-trigger +- name: gofn type: http - source: /gofn-trigger + source: /gofn ``` The generated `func.yaml` file contains metadata about your function and @@ -142,7 +142,7 @@ in `--runtime`. in this case `./func` * triggers--identifies the automatically generated trigger name and source. For example, this function would be executed from the URL -. Where appname is the name of +. Where appname is the name of the app chosen for your function when it is deployed. There are other user specifiable properties but these will suffice for @@ -266,8 +266,8 @@ Successfully tagged fndemouser/gofn:0.0.2 Updating function gofn using image fndemouser/gofn:0.0.2... Successfully created function: gofn with fndemouser/gofn:0.0.2 -Successfully created trigger: gofn-trigger -Trigger Endpoint: http://localhost:8080/t/goapp/gofn-trigger +Successfully created trigger: gofn +Trigger Endpoint: http://localhost:8080/t/goapp/gofn ``` All the steps to load the current language Docker image are displayed. @@ -285,7 +285,7 @@ let's us know that the function is packaged in the image Note that the containing folder name `gofn` was used as the name of the generated Docker container and used as the name of the function that container was bound to. By convention it is also used to create the trigger name -`gofn-trigger`. +`gofn`. Normally you deploy an application without the `--verbose` option. If you rerun the command a new image and version is created and loaded. @@ -392,7 +392,7 @@ We can also see the functions that are defined by an application. Since function ```sh FUNCTION NAME ID TYPE SOURCE ENDPOINT -gofn gofn-trigger 01D37X3AVGNG8G00GZJ0000003 http /gofn-trigger http://localhost:8080/t/goapp/gofn-trigger +gofn gofn 01D37X3AVGNG8G00GZJ0000003 http /gofn http://localhost:8080/t/goapp/gofn ``` The output confirms that `goapp` contains a `gofn` function which may be invoked via the @@ -402,14 +402,14 @@ call our function. ### Invoke with Curl The other way to invoke your function is via HTTP. The Fn server exposes our -deployed function at `http://localhost:8080/t/goapp/gofn-trigger`, a URL +deployed function at `http://localhost:8080/t/goapp/gofn`, a URL that incorporates our application and function trigger as path elements. Use `curl` to invoke the function: ![user input](images/userinput.png) >```sh -> curl -H "Content-Type: application/json" http://localhost:8080/t/goapp/gofn-trigger +> curl -H "Content-Type: application/json" http://localhost:8080/t/goapp/gofn >``` The result is once again the same. @@ -423,7 +423,7 @@ the function back. ![user input](images/userinput.png) >``` -> curl -H "Content-Type: application/json" -d '{"name":"Bob"}' http://localhost:8080/t/goapp/gofn-trigger +> curl -H "Content-Type: application/json" -d '{"name":"Bob"}' http://localhost:8080/t/goapp/gofn >``` The result is once again the same. From e20e67cf923ef4195fbade7f5254df1bd20cea28 Mon Sep 17 00:00:00 2001 From: Leandro Del Sole Date: Sun, 30 Jun 2019 17:38:46 -0300 Subject: [PATCH 3/3] The directory starting with "/" seems to be a root directory, but it isn't. I was in doubt if it should be only "`gofn` directory" or "`./gofn` directory". Decided for the latter because of two reasons. First the slash makes it clear we're talking about a directory. The Second is because of the output of `fn init` command. --- Introduction/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Introduction/README.md b/Introduction/README.md index 64dc7ea..e094199 100644 --- a/Introduction/README.md +++ b/Introduction/README.md @@ -34,7 +34,7 @@ In the terminal type the following: The output will be ```yaml -Creating function at: /gofn +Creating function at: ./gofn Runtime: go Function boilerplate generated. func.yaml created. @@ -43,10 +43,10 @@ func.yaml created. The `fn init` command creates an simple function with a bit of boilerplate to get you started. The `--runtime` option is used to indicate that the function we're going to develop will be written in Go. A number of other runtimes are -also supported. Fn creates the simple function along with several supporting files in the `/gofn` directory. +also supported. Fn creates the simple function along with several supporting files in the `./gofn` directory. ### Review your Function File -With your function created change into the `/gofn` directory. +With your function created change into the `./gofn` directory. ![User Input Icon](images/userinput.png) >```sh