Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move convox switch client side #691

Merged
merged 5 commits into from Jun 17, 2016
Merged

move convox switch client side #691

merged 5 commits into from Jun 17, 2016

Conversation

ddollar
Copy link
Contributor

@ddollar ddollar commented May 26, 2016

reads current rack from (in order):

--rack (not added to commands yet)
./.convox/rack
~/.convox/rack
$CONVOX_RACK

convox switch now returns the current rack name

convox switch <rack> now updates ~/.convox/rack

CLI Release Playbook

@ddollar
Copy link
Contributor Author

ddollar commented May 26, 2016

convox switch

@nzoschke
Copy link
Contributor

Testing this... I see some regressions and surprises:

  • convox switch dev-east no longer works. It requires the personal/ org name prefix
  • Switching in another terminal affects the first terminal
$ go install github.com/convox/rack/cmd/convox
$ convox login
Logged in successfully.

$ convox switch
Use `convox racks` to list your available racks and `convox switch <rack>` to select one.

$ convox racks
RACK                   STATUS     
convox/staging         running    
convox/demo            running    
convox/production      running    
personal/dev-east      running    

$ convox switch dev-east
ERROR: no such rack: dev-east

$ convox switch personal/dev-east
Switched to personal/dev-east

$ convox apps
APP           STATUS 
httpd         running

@matthewford
Copy link

seems like a fair trade-off to me 😄

@snario
Copy link

snario commented Jun 12, 2016

Can't wait for this to be released 👍 :)

@matthewford
Copy link

matthewford commented Jun 15, 2016

This is causing no end of issued for me when we have multiple builds running and then deploying from the CLI on CircleCI.

Sometimes mid deploy the rack will switch so the app will not deploy cleanly or build (or it will build but not promote the build).

@nzoschke
Copy link
Contributor

Picking this up again, and on second review I think it's pretty close as-is

@nzoschke
Copy link
Contributor

I think the order of precedence for CONVOX_RACK is incorrect. It should take override ~/.convox/rack as an explicit default for the current terminal session.

@ddollar
Copy link
Contributor Author

ddollar commented Jun 15, 2016

+1

@nzoschke
Copy link
Contributor

nzoschke commented Jun 15, 2016

Rebased and changed the precedence. In testing I think that CONVOX_RACK should also override ./.convox/rack the same way --rack would.

This could still use:

  • Adding --rack to the help
  • Supporting convox switch foo without an org

@nzoschke
Copy link
Contributor

Demo - Switch Command

$ rm ~/.convox/rack 
$ convox switch
Use `convox racks` to list your available racks and `convox switch <rack>` to select one.

$ convox switch foo
ERROR: Rack not found. Try one of:
convox/staging                    running    
convox/demo                       running    
convox/production                 running    
personal/dev-east                 running    
personal/staging                  running

$ convox switch dev-east
Switched to personal/dev-east

$ convox switch
personal/dev-east

$ convox apps
APP        STATUS 
httpd      running
httpd-old  running
rails      running

$ convox switch staging
ERROR: You have access to multiple racks with that name, try one of the following:
convox/staging
personal/staging

$ convox switch personal/staging
Switched to personal/staging

$ convox switch convox/staging
Switched to convox/staging

Demo - --rack flag

$ convox apps --help
convox apps: list deployed apps

Usage:
  convox apps <command> [args...]

Subcommands: (convox apps help <subcommand>)
  create  create a new application
  delete  delete an application
  info    see info about an app
  params  list advanced parameters for an app
  help, h 

Options:
  --rack value, -r value  Rack name. Inferred from CONVOX_RACK, ./convox/rack or ~/.convox/rack if not specified.
  --help, -h      show help

$ convox switch
convox/staging

$ convox apps
APP              STATUS 
console-staging  running
site-staging     running

$ convox apps --rack dev-east
APP        STATUS 
httpd      running
httpd-old  running
rails      running

$ convox apps -r dev-east
APP        STATUS 
httpd      running
httpd-old  running
rails      running

Demo - CONVOX_RACK env var

$ convox switch
convox/staging

$ convox apps
APP              STATUS 
console-staging  running
site-staging     running

$ CONVOX_RACK=dev-east convox apps
APP        STATUS 
httpd      running
httpd-old  running
rails      running

Demo -- ./convox/rack file

$ cd httpd

$ convox switch
convox/staging

$ convox builds
ERROR: no such app: httpd

$ mkdir .convox
$ echo personal/dev-east > .convox/rack

$ convox builds
ID           STATUS    RELEASE      STARTED      ELAPSED  DESC
BVFZQPTJJNV  complete  RTAYZHUSGCJ  1 week ago   22s 

$ convox builds --rack convox/staging
ERROR: no such app: httpd

$ CONVOX_RACK=convox/staging convox builds
ERROR: no such app: httpd

@MiguelMoll
Copy link
Contributor

I noticed when logging into my local dev rack from Console, convox switch is still pointing to a Console rack.

⟩ convox switch
convox/demo


⟩ convox login 192.168.99.100
Logged in successfully.


⟩ convox switch
convox/demo


⟩ convox rack
Name     dev
Status   running
Version  20160615213630
Region   us-east-1
Count    3
Type     t2.small

@nzoschke
Copy link
Contributor

Trying to think about what the convox login behavior should be... It could automatically switch to a rack, but it would have to guess which one when logging into console.

@nzoschke
Copy link
Contributor

On second thought... I don't think we need to change convox login behavior right now.

I don't think too many people are moving between console and a single rack other than for development. So as long as the behavior is coherent for those of us logged into console its a big improvement.

@MiguelMoll
Copy link
Contributor

Latest changes lgtm 👍

@nzoschke
Copy link
Contributor

This needs documentation. A PS1 helper would be very nice too

ddollar and others added 4 commits June 17, 2016 09:56
reads current rack from (in order):

--rack (not added to commands yet)
./convox/rack
~/.convox/rack
$CONVOX_RACK
…X_RACK takes precedence over prior app or switch setting
@mwarkentin
Copy link
Contributor

mwarkentin commented Jun 17, 2016

+1 for a PS1 helper.. the question comes up every once in a while and I provide my hacked version using the API. :)

@nzoschke
Copy link
Contributor

Docs are here: https://github.com/convox/site/pull/177

@nzoschke nzoschke merged commit f476983 into master Jun 17, 2016
@ddollar ddollar deleted the client-switch branch June 30, 2016 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants