From 80839fb422bb0e17d1638803342ad12376aa403f Mon Sep 17 00:00:00 2001 From: CuriousCorrelation Date: Tue, 14 Jun 2022 17:08:31 +0530 Subject: [PATCH] docs: Update forward, await as ports subcommands https://github.com/gitpod-io/gitpod/pull/10538 PR moved `await-port` functionality to `ports await` and `forward-port`, now renamed `expose`, moved to `ports expose` Previously: - `gp forward-port ` - `gp await-port ` Now: - `gp ports expose ` - `gp ports await ` --- gitpod/docs/command-line-interface.md | 41 ++++++++++++++------------- gitpod/docs/config-start-tasks.md | 4 +-- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/gitpod/docs/command-line-interface.md b/gitpod/docs/command-line-interface.md index 7a4e9078108..963c59b5180 100644 --- a/gitpod/docs/command-line-interface.md +++ b/gitpod/docs/command-line-interface.md @@ -18,9 +18,7 @@ Usage: gp [command] Available Commands: - await-port Waits for a process to listen on a port env Controls user-defined, persistent environment variables. - forward-port Makes a port available on 0.0.0.0 so that it can be exposed to the internet help Help about any command init Create a Gitpod configuration for this project. open Opens a file in Gitpod @@ -79,23 +77,6 @@ To delete or unset an environment variable, you use `gp env -u API_ENDPOINT`. Please refer to the help output provided by `gp env --help` for more use cases of the `gp env` command. -## Forward Port - -In Gitpod, services/servers running on a port need to be _exposed_ before they become accessible from the internet. This process only works with services listening on `0.0.0.0` and not just `localhost`. -Sometimes it is not possible to make a server listen on `0.0.0.0`, e.g. because it is not your code and there are simply no means of configuration. - -In that case, `gp forward-port ` can be used to forward all traffic form a socket listing on all network interfaces to your process listening on localhost only. - -## Await Port - -When writing tasks to be executed on workspace start, one sometimes wants to wait for an http service to be available. `gp await-port` does that. - -Here's an example that will open a certain path once a service is a available: - -```sh -gp await-port 3000 && gp preview $(gp url 3000)/my/path/index.html -``` - ## sync-await In situations where you work with multiple terminals and one depends on a task in another terminal to complete, `gp sync-await ` waits until you call `gp sync-done ` in another terminal. @@ -161,3 +142,25 @@ Outputs a table-formatted list of ports along with their status, URL, name and d ```sh gp ports list ``` + +### expose + +In Gitpod, services/servers running on a port need to be _exposed_ before they become accessible from the internet. This process only works with services listening on `0.0.0.0` and not just `localhost`. +Sometimes it is not possible to make a server listen on `0.0.0.0`, e.g. because it is not your code and there are simply no means of configuration. + +In that case, `gp ports expose ` can be used to forward all traffic form a socket listing on all network interfaces to your process listening on localhost only. + +```sh +gp ports expose +``` + + +### await + +When writing tasks to be executed on workspace start, one sometimes wants to wait for an http service to be available. `gp ports await` does that. + +Here's an example that will open a certain path once a service is a available: + +```sh +gp ports await 3000 && gp preview $(gp url 3000)/my/path/index.html +``` diff --git a/gitpod/docs/config-start-tasks.md b/gitpod/docs/config-start-tasks.md index 1536c9d2923..d02de524f3d 100644 --- a/gitpod/docs/config-start-tasks.md +++ b/gitpod/docs/config-start-tasks.md @@ -171,7 +171,7 @@ tasks: Let's say you have a web app dev server that takes a moment to start up to listen on port 3000. Once it's up and running, you want to run end-to-end tests against `http://localhost:3000`. -You can achieve this with two terminals and the `gp await-port` CLI command. +You can achieve this with two terminals and the `gp ports await` CLI command. ```yaml tasks: @@ -181,7 +181,7 @@ tasks: - name: e2e Tests command: | - gp await-port 3000 + gp ports await 3000 npm run test ```