Skip to content

Commit

Permalink
docs: Update forward, await as ports subcommands
Browse files Browse the repository at this point in the history
gitpod-io/gitpod#10538 PR
moved `await-port` functionality to `ports await`
and `forward-port`, now renamed `expose`,
moved to `ports expose`

Previously:
- `gp forward-port <port>`
- `gp await-port <port>`

Now:
- `gp ports expose <port>`
- `gp ports await <port>`
  • Loading branch information
CuriousCorrelation committed Jun 14, 2022
1 parent 2424bf2 commit 80839fb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
41 changes: 22 additions & 19 deletions gitpod/docs/command-line-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <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 <name>` waits until you call `gp sync-done <name>` in another terminal.
Expand Down Expand Up @@ -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 <port>` 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 <port>
```


### 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
```
4 changes: 2 additions & 2 deletions gitpod/docs/config-start-tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -181,7 +181,7 @@ tasks:
- name: e2e Tests
command: |
gp await-port 3000
gp ports await 3000
npm run test
```

Expand Down

0 comments on commit 80839fb

Please sign in to comment.