From d973058264bc519c8a1dbfcabecde590d8c37304 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ey=C3=BE=C3=B3r=20Magn=C3=BAsson?= Date: Fri, 7 Sep 2018 13:14:18 +0200 Subject: [PATCH 1/2] fix(call-command): print correct protocol --- garden-cli/src/commands/call.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/garden-cli/src/commands/call.ts b/garden-cli/src/commands/call.ts index a25077cf8d..afda77c4b4 100644 --- a/garden-cli/src/commands/call.ts +++ b/garden-cli/src/commands/call.ts @@ -122,7 +122,7 @@ export class CallCommand extends Command { const method = "get" const entry = ctx.log.info({ - msg: chalk.cyan(`Sending HTTP GET request to `) + url + "\n", + msg: chalk.cyan(`Sending ${matchedEndpoint.protocol.toUpperCase()} GET request to `) + url + "\n", entryStyle: EntryStyle.activity, }) From cc4de6d470342640f9810d23abe39eac0efa1b2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ey=C3=BE=C3=B3r=20Magn=C3=BAsson?= Date: Fri, 7 Sep 2018 13:14:53 +0200 Subject: [PATCH 2/2] docs: update simple-project after TLS changes --- docs/examples/README.md | 2 +- docs/examples/simple-project.md | 16 ++++++++-------- .../services/go-service/webserver/main.go | 2 +- .../services/go-service/webserver/main.go | 5 +++-- .../services/node-service/app.js | 2 +- .../services/go-service/garden.yml | 4 ++-- .../services/go-service/webserver/main.go | 4 ++-- .../simple-project/services/node-service/app.js | 4 ++-- .../services/node-service/garden.yml | 4 +++- 9 files changed, 23 insertions(+), 20 deletions(-) diff --git a/docs/examples/README.md b/docs/examples/README.md index 9342f33681..1fcbf2b2eb 100644 --- a/docs/examples/README.md +++ b/docs/examples/README.md @@ -1,6 +1,6 @@ # Examples The source code for the examples in this section can be found in our Github repository under the -[examples directory](https://github.com/garden-io/garden/examples/). +[examples directory](https://github.com/garden-io/garden/tree/master/examples). * [Simple Project](./simple-project.md) \ No newline at end of file diff --git a/docs/examples/simple-project.md b/docs/examples/simple-project.md index 0a804a7704..60b9842968 100644 --- a/docs/examples/simple-project.md +++ b/docs/examples/simple-project.md @@ -17,7 +17,7 @@ This tutorial assumes that you have already have a running [installation of Gard ## Clone the example repo -The code for this tutorial can be found on Github in our [examples repo](https://github.com/garden-io/garden/examples). We'll use the [simple-project-start](https://github.com/garden-io/garden/examples/simple-project-start) example and work our way from there. The complete version is under [simple-project](https://github.com/garden-io/garden/examples/simple-project). +The code for this tutorial can be found in our Github repository under the [examples directory](https://github.com/garden-io/garden/tree/master/examples). We'll use the [simple-project-start](https://github.com/garden-io/garden/tree/master/examples/simple-project-start/) example and work our way from there. The complete version is under [simple-project](https://github.com/garden-io/garden/tree/master/examples/simple-project). First, let's clone the examples repo, change into the directory, and take a look inside: ```sh @@ -113,7 +113,7 @@ module: - name: http containerPort: 8080 endpoints: - - path: / + - path: /hello-node port: http ``` The [services](../guides/configuration.md#Services) directive is specific to container modules, and defines the services exposed by the module. In this case, our containerized Node.js server. The sub-directives tell Garden how to start the service and which endpoints to expose. @@ -132,11 +132,11 @@ Garden can now deploy our service to a local Kubernetes cluster: $ garden deploy ``` -To verify that everything is working, we can call the service at the `/hello` endpoint defined in `/services/node-service/app.js`: +To verify that everything is working, we can call the service at the `/hello-node` endpoint defined in `/services/node-service/app.js`: ```sh -$ garden call node-service/hello -✔ Sending HTTP GET request to http://simple-project.local.app.garden/hello +$ garden call node-service/hello-node +✔ Sending HTTP GET request to http://simple-project.local.app.garden/hello-node 200 OK @@ -161,7 +161,7 @@ module: - name: http containerPort: 80 endpoints: - - path: / + - path: /hello-go port: http ``` @@ -193,7 +193,7 @@ Calling our `go-service` from our `node-service` is straightforward from within const request = require('request-promise') // Unless configured otherwise, the hostname is simply the service name -const goServiceEndpoint = `http://go-service/`; +const goServiceEndpoint = `http://go-service/hello-go`; app.get('/call-go-service', (req, res) => { // Query the go-service and return the response @@ -223,7 +223,7 @@ $ garden call node-service/call-go-service 200 OK { - "message": "Hello from Go!" + "message": "Hello from Go!" } ``` diff --git a/examples/local-tls/services/go-service/webserver/main.go b/examples/local-tls/services/go-service/webserver/main.go index e40f941df8..2171b4e268 100644 --- a/examples/local-tls/services/go-service/webserver/main.go +++ b/examples/local-tls/services/go-service/webserver/main.go @@ -6,7 +6,7 @@ import ( ) func handler(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello %s from Go!", r.URL.Path[1:]) + fmt.Fprint(w, "Hello from Go!") } func main() { diff --git a/examples/simple-project-start/services/go-service/webserver/main.go b/examples/simple-project-start/services/go-service/webserver/main.go index e40f941df8..e42f18095d 100644 --- a/examples/simple-project-start/services/go-service/webserver/main.go +++ b/examples/simple-project-start/services/go-service/webserver/main.go @@ -6,11 +6,12 @@ import ( ) func handler(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello %s from Go!", r.URL.Path[1:]) + fmt.Fprint(w, "Hello from Go!") } + func main() { - http.HandleFunc("/", handler) + http.HandleFunc("/hello-go", handler) fmt.Println("Server running...") http.ListenAndServe(":80", nil) diff --git a/examples/simple-project-start/services/node-service/app.js b/examples/simple-project-start/services/node-service/app.js index c26e6cb158..fce7dee2e0 100644 --- a/examples/simple-project-start/services/node-service/app.js +++ b/examples/simple-project-start/services/node-service/app.js @@ -1,6 +1,6 @@ const express = require('express'); const app = express(); -app.get('/hello', (req, res) => res.send('Hello from Node service!')); +app.get('/hello-node', (req, res) => res.send('Hello from Node service!')); module.exports = { app } diff --git a/examples/simple-project/services/go-service/garden.yml b/examples/simple-project/services/go-service/garden.yml index 0a12e9b8f0..df101f5ff8 100644 --- a/examples/simple-project/services/go-service/garden.yml +++ b/examples/simple-project/services/go-service/garden.yml @@ -8,5 +8,5 @@ module: - name: http containerPort: 80 endpoints: - - path: / - port: http + - path: /hello-go + port: http \ No newline at end of file diff --git a/examples/simple-project/services/go-service/webserver/main.go b/examples/simple-project/services/go-service/webserver/main.go index e40f941df8..3115511eff 100644 --- a/examples/simple-project/services/go-service/webserver/main.go +++ b/examples/simple-project/services/go-service/webserver/main.go @@ -6,11 +6,11 @@ import ( ) func handler(w http.ResponseWriter, r *http.Request) { - fmt.Fprintf(w, "Hello %s from Go!", r.URL.Path[1:]) + fmt.Fprint(w, "Hello from Go!") } func main() { - http.HandleFunc("/", handler) + http.HandleFunc("/hello-go", handler) fmt.Println("Server running...") http.ListenAndServe(":80", nil) diff --git a/examples/simple-project/services/node-service/app.js b/examples/simple-project/services/node-service/app.js index 2811e91908..6df390404c 100644 --- a/examples/simple-project/services/node-service/app.js +++ b/examples/simple-project/services/node-service/app.js @@ -3,9 +3,9 @@ const request = require('request-promise') const app = express(); // Unless configured otherwise, the hostname is simply the service name -const goServiceEndpoint = `http://go-service/`; +const goServiceEndpoint = `http://go-service/hello-go`; -app.get('/hello', (req, res) => res.send('Hello from Node service!')); +app.get('/hello-node', (req, res) => res.send('Hello from Node service!')); app.get('/call-go-service', (req, res) => { // Query the go-service and return the response diff --git a/examples/simple-project/services/node-service/garden.yml b/examples/simple-project/services/node-service/garden.yml index 3de8a8092d..d919e03574 100644 --- a/examples/simple-project/services/node-service/garden.yml +++ b/examples/simple-project/services/node-service/garden.yml @@ -9,7 +9,9 @@ module: - name: http containerPort: 8080 endpoints: - - path: / + - path: /hello-node + port: http + - path: /call-go-service port: http dependencies: - go-service