| heroku run rails c -a powr-staging | kubectl exec -it deployments/web -n staging -- rails c | rails console access | Use kubectl get all -n {namespace} to get {POD_NAME} and replace that with pod name (including brackets). Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.md |
| heroku run rails c -a powr-staging --type=worker | kubectl exec -it deployments/sidekiq -n staging -- rails c | rails console access | Use kubectl get all -n {namespace} to get {POD_NAME} and replace that with pod name (including brackets). Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.md |
| heroku run bash -a powr-outlet | kubectl exec -it deployments/outlet -n staging -- bash | rails console access | Use kubectl get all -n {namespace} to get {POD_NAME} and replace that with pod name (including brackets). Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.md |
| heroku run bash -a powr-counter | kubectl exec -it deployments/counter -n staging -- bash | rails console access | Use kubectl get all -n {namespace} to get {POD_NAME} and replace that with pod name (including brackets). Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.md |
| heroku run bash -a powr-review-app-149 | kubectl exec -it deployments/pr-149 -n pr-149 -- bash | rails console access | Checkout pull request URL on github to get pr_number and replace pr-149 with pr-{pr_number} for your prapp |
| heroku run rails c -a powr-review-app-149 | kubectl exec -it deployments/pr-149 -n pr-149 -- rails c | rails console access | Checkout pull request URL on github to get pr_number and replace pr-149 with pr-{pr_number} for your prapp |
| heroku config:set DATABASE_URL=something -a powr-staging | kubectl -n staging set env $DATABASE_URL=something {POD_NAME} | change env variable | Use kubectl get all -n {namespace} to get {POD_NAME} and replace that with pod name (including brackets). Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.mdImportant Notes:1. Changes to env variable trigger redeploy of that particular pod2. Setting env is not permanent, they will be defaulted after nearest redeploy to that cluster3. to preserve new value of environment variable also change that on GH Secrets by going to: https://github.com/powrful/powr/settings/secrets/actions and edit DATABASE_URL, so changes will remain applied after new deploy |
| hard rollback WEB to previous deploy | kubectl -n {branch_name} set image deployment/web \web=ghcr.io/powrful/alpha/web:$(curl sha.api.powr-staging.io/api/v1/powrful/{branch_name}/web\?get=1) | hard rollback to previous docker image tag | Important Notes:1. Manual update will only live until next deploy2. To make changes permanent revert the last merge on the corresponding branch |
| hard rollback COUNTER to previous deploy | kubectl -n {branch_name} set image deployment/counter \web=ghcr.io/powrful/alpha/web:$(curl sha.api.powr-staging.io/api/v1/powrful/{branch_name}/web\?get=1) | hard rollback to previous docker image tag | Important Notes:0. replace {branch_name} with branch name, e.g. alpha, staging or main1. Manual update will only live until next deploy2. To make changes permanent revert the last merge on the corresponding branch3. Hard rollback feature isn't available for pr-apps |
| hard rollback OUTLET to previous deploy | kubectl -n {branch_name} set image deployment/outlet \web=ghcr.io/powrful/alpha/web:$(curl sha.api.powr-staging.io/api/v1/powrful/{branch_name}/web\?get=1) | hard rollback to previous docker image tag | Important Notes:0. replace {branch_name} with branch name, e.g. alpha, staging or main1. Manual update will only live until next deploy2. To make changes permanent revert the last merge on the corresponding branch3. Hard rollback feature isn't available for pr-apps |
| heroku logs -t -a powr-staging | kubectl logs deployments/web -n staging | tail rails, sidekiq, nginx logs | Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.md Other option is to use web interface, just go to https://console.cloud.google.com/logs/query;cursorTimestamp=2022-04-26T16:37:35.517368Z?authuser=0&project=powr-staging to see logs of all pods of powr-staging or powr-prod projects. You could also use filter logs with queries: https://cloud.google.com/logging/docs/view/query-library |
| heroku logs -t -a powr-prod | kubectl logs deployments/web -n main | tail rails, sidekiq, nginx logs | Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.md Other option is to use web interface, just go to https://console.cloud.google.com/logs/query;cursorTimestamp=2022-04-26T16:37:35.517368Z?authuser=0&project=powr-staging to see logs of all pods of powr-staging or powr-prod projects. You could also use filter logs with queries: https://cloud.google.com/logging/docs/view/query-library |
| heroku run rake some_task | kubectl exec -n staging -it deployments/sidekiq -- bundle exec rake some_task | run rake tasks | Replace {NAMESPACE} with a proper namespace that are named according to source branch on a github repo: main and staging for production and staging respectively. To get full pod name use kubectl get all -n {NAMESPACE}. Further read: https://powr.gitlab.io/docs/kube/test-code-inside-container-correct.md |
| heroku ps:restart web -a powr | kubectl -n staging rollout restart deployment web | restart dynos | For our installation {SHORT_POD_NAME} is either web, sidekiq, outlet, counter or ingress. This command is kubectl context dependent, so please check if your instance isn't looking on production. Further read: https://powr.gitlab.io/docs/kube/run-kubectl-on-your-machine |
| heroku ps:restart web -a powr --type=worker | kubectl -n staging rollout restart deployment sidekiq | restart dynos | For our installation {SHORT_POD_NAME} is either web, sidekiq, outlet, counter or ingress. This command is kubectl context dependent, so please check if your instance isn't looking on production. Further read: https://powr.gitlab.io/docs/kube/run-kubectl-on-your-machine |