Heroku管道.在生产应用程序上运行命令(非暂存) [英] Heroku pipeline. Run commands on production app (not staging)

查看:94
本文介绍了Heroku管道.在生产应用程序上运行命令(非暂存)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用heroku管道.我设置了两个应用程序.一种用于登台,一种用于生产.两者都使用生产"作为环境变量.

I am using the heroku pipeline. I set up my two apps. One for staging, one for production. Both use "production" as the environment variable.

如果运行heroku run rails c,则可以在我的登台应用程序上访问控制台. heroku网站还允许在生产应用程序中运行控制台,但只能使用预定义的heroku run部分.这意味着如果出于任何原因我需要运行更基本的命令(例如heroku pg:reset;我知道我知道),我就不会.

If I run heroku run rails c I can access the console on my staging app. The heroku website, allows to run a console in the production app as well, but only with the predifined heroku run part. Which means if for whatever reason I need to run a more fundamental command (for example heroku pg:reset; I know I know), I can't.

有没有一种方法可以指定我要在其中运行命令的heroku应用程序?可能是heroku pg:reset production-app-name之类的东西?

So is there a way to specify which heroku app I want to run the commands at? Something like heroku pg:reset production-app-name maybe?

我正在使用cloud9作为IDE,不确定是否会有所不同.

I am using cloud9 as an IDE, not sure if that makes a difference.

推荐答案

是的,您几乎完全正确,只需在app-name之前添加--app:

Yes, you got it almost right, just add --app before the app-name:

$ heroku pg:reset --app production-app-name

实际上,如果您配置了多个应用程序(运行heroku apps列出它们),则会出现错误;例如,尝试运行更安全命令:

In fact, if you have more than one app configured (run heroku apps to list them), you will get an error; for example, try running a safer command:

$ heroku logs

如果您有多个应用程序,则输出为:

If you have more than one app, the output will be:

 ▸    Error: Multiple apps in git remotes
 ▸    Usage: heroku logs --remote production
 ▸       or: heroku logs --app production-app-name
 ▸
 ▸    Your local git repository has more than 1 app referenced in git remotes.
 ▸    Because of this, we can't determine which app you want to run this command against.
 ▸    Specify the app you want with --app or --remote.
 ▸
 ▸    Heroku remotes in repo:
 ▸    production      (production-app-name)
 ▸    staging         (staging-app-name)
 ▸
 ▸    https://devcenter.heroku.com/articles/multiple-environments

这篇关于Heroku管道.在生产应用程序上运行命令(非暂存)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆