No commit activity in last 3 years
No release in over 3 years
CF command line extension to allow console access to an app container via a secure WebSocket
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

console-websocket-cf-plugin

This is a CF plugin for connecting to the STDIN / STDOUT of a remote process (rails console for example) on Cloud Foundry whilst simultaneously running the intended application in the same container. It uses a binary written in Go on the server side to provide the websocket connection and also serve the application itself, if you wish to serve that up too.

TL;DR example

1 - Install the console-websocket-cf-plugin gem

$ gem install console-websocket-cf-plugin

2 - Copy the pre-built linux binary from the Github repo in to the root of your Rails app

$ cd my_rails_app
$ wget https://github.com/danhigham/console-websocket-cf-plugin/blob/master/console-server/console-server-linux-amd64?raw=true

3 - Modify the application manifest, note the 'command' property

---
applications:
- name: rails-console-test
  memory: 256M
  instances: 1
  host: rails-console-test
  domain: cfapps.io
  path: .
  command: ./console-server-linux-amd64 -console-process="rails c" -main-process="bundle exec rails s -p 8080"

The processes that are started by the console-server binary are completely configurable, you could for example just run 'bash' for the console process. If you wish to make the application available, mounted at /, then it needs to be bound to port 8080, this is the port console-server expects to proxy requests to.

4 - Push the app

$ cf push --reset

5 - Start a console

$ cf console <app name>

Of course you could chose to launch 'bash' and then start 'rails c' from within the shell itself, this is my preferred method. In fact, 'bash' is the default for the -console-process option if it is omitted!

NOTE: At the moment, "exit" tells the plugin to kill the websocket connection and finish the session.