Skip to content

Commit

Permalink
Support deploying bash in Cloud Foundry via GoTTY
Browse files Browse the repository at this point in the history
Added a manifest file that is used by default by Cloud Foundry's cli
`cf push` command. This manifest causes GoTTY to launch bash and allow
it to accept keystrokes. We do not use GoTTY's -c parameter to force use
of credentials, because that requires that the user update the manifest
file before `cf push`, and also have the utilities to generate secure
password on her machine. We use the alternative method to obscure the
access to this app by recommending (in README) to use the --random-route
option.

Updated code to listen on environment variable PORT. This overrides
logic that purportedly supports choosing a different port via environment
variable GOTTY_PORT. But since that doesn't really work (see issue yudai#122)
it's okay for us to hack this to support Cloud Foundry.
  • Loading branch information
gurjeet committed Nov 1, 2016
1 parent ddbaa98 commit 2ee1ab5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ If you have a Go language environment, you can install GoTTY with the `go get` c
$ go get github.com/yudai/gotty
```

## Cloud Foundry Deployment

```sh
$ cf push --random-route
```

# Usage

```
Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func (app *App) Run() error {
path += "/" + generateRandomString(app.options.RandomUrlLength)
}

endpoint := net.JoinHostPort(app.options.Address, app.options.Port)
endpoint := net.JoinHostPort(app.options.Address, os.Getenv("PORT"))

wsHandler := http.HandlerFunc(app.handleWS)
customIndexHandler := http.HandlerFunc(app.handleCustomIndex)
Expand Down
8 changes: 8 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
applications:
- name: gotty
command: gotty -w bash
memory: 128m
env:
GOPACKAGENAME: main
TERM: "xterm-256color"

0 comments on commit 2ee1ab5

Please sign in to comment.