Skip to content
This repository has been archived by the owner on Jul 11, 2020. It is now read-only.

Using Rails console or running scripts

David Radcliffe edited this page Apr 20, 2019 · 2 revisions

NOTE: You will need to have a working kubectl before you can run these.

Staging Rails console:

kubectl exec -n rubygems-staging --context rubygems $(kubectl get pods -l name=unicorn --field-selector=status.phase=Running -n rubygems-staging --context rubygems -o jsonpath={.items[0].metadata.name}) -it -- rails console

Production Rails console:

kubectl exec -n rubygems-production --context rubygems $(kubectl get pods -l name=unicorn --field-selector=status.phase=Running -n rubygems-production --context rubygems -o jsonpath={.items[0].metadata.name}) -it -- rails console

Staging run script

kubectl exec -n rubygems-staging --context rubygems $(kubectl get pods -l name=unicorn --field-selector=status.phase=Running -n rubygems-staging --context rubygems -o jsonpath={.items[0].metadata.name}) -it -- script/some-script arg1 arg2 etc

Production run script

kubectl exec -n rubygems-production --context rubygems $(kubectl get pods -l name=unicorn --field-selector=status.phase=Running -n rubygems-production --context rubygems -o jsonpath={.items[0].metadata.name}) -it -- script/some-script arg1 arg2 etc