Rails应用程序可以部署而不使用Heroku Toolbelt吗?如果是这样,怎么样? [英] Can a Rails app be deployed without using Heroku Toolbelt? If so, how?

查看:115
本文介绍了Rails应用程序可以部署而不使用Heroku Toolbelt吗?如果是这样,怎么样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在不使用Heroku ToolBelt的情况下部署Rails应用程序。可能吗?如果是这样,怎么样?我只能使用Heroku仪表板;我不允许使用任何其他云服务:(



我必须运行PostgreSQL命令,添加附加组件并设置配置变量以及可能的其他任务Heroku Toolbelt在生产环境中部署应用程序。



错误:

  user @ xx〜/ Desktop / github / blog(master)
$ git push git@heroku.com:herokugui.git master
Permission denied(publickey)。
fatal:Could not从远程存储库中读取

请确保您具有正确的访问权限
并存在存储库

我不想使用Heroku Toolbelt,这就是为什么我使用Git命令在Heroku上部署代码的原因,我无法使用Git命令将代码推送到Heroku。在没有toolbelt的情况下执行此任务吗?



另一个问题是:有没有办法在Heroku GUI上运行PostgreSQL命令?如果是这样,怎么做? b $ b

解决方案

这并不容易(就像Heroku toolbelt一样),但它是可能的。它至少涉及到你的Heroku仪表板,所以确保你可以访问它。



首先,你需要一个密钥。如果你在Linux机器上(就像我),那么在你的主目录中,你应该有一个名为 .ssh 的文件夹(它可能是隐藏,点击 Ctrl + H 来再次显示Linux)和文件 id_rsa.pub 。首先,您需要先生成您的SSH密钥。

  ssh-keygen -t rsa 

这会提示你输入一个文件夹,默认是好的,只需点击 Enter ,然后输入密码(两次)以防止您的密钥被您的计算机上的任何人访问:没有密码短语,它是未加密的,并且任何人都可以免费使用该设备。

b
$ b

完成后,找到您的公钥文件: id_rsa.pub 注意:不是 id_rsa ,它是一个私钥,您可能不想将它提供给任何人,这很像您未来的Heroku密码,除了它对于密码来说非常大。打开 id_rsa.pub ,您应该看到如下内容:

  ssh- rsa aWhOLELotofUnreadABLEGibbERishWHiCHiSactUALLyYourPubLIcKeY ... 

您需要在Heroku仪表板的 SSH密钥。您可以在 Heroku文档中找到关于键的更多信息。确保Heroku通过发出以下内容认出你:

  ssh -v git@heroku.com 

它应该说明你已经过身份验证。



现在为 git 地址。我假设你知道 git 的方法,所以我会保持简短:你需要从你的应用程序名称派生你的存储库地址。 Heroku通常会产生奇怪的(但有些诗意的)名字,如 falling-wind-1624 shielded-fjord-1858 。我将以第一个为例,这是你如何将它的地址添加为git remote:

  git remote add heroku git@heroku.com:falling-wind-1624.git 

我会解释一下它在下面。因此,这里的工具栏所做的只是使用您的应用程序名称,它只是通过向Heroku服务器添加路径来以相同的方式构建URL。完成之后,您应该能够推送您的代码:

  git push heroku master 

我上面命名了一个Heroku remote heroku ,这就是为什么我使用 heroku 这里命名,你可以任意命名,然后使用它。一旦你推动了代码,其余的由你决定。


I want to deploy rails app without using Heroku ToolBelt. Is it possible? If so, how? I'm only allowed to use Heroku dashboard; I'm not allowed to use any other cloud service :(

I have to run PostgreSQL commands, adding add-ons and setting configuration variables and possibly other tasks for which we have Heroku Toolbelt to deploy a application in production environment.

Error:

user@xx ~/Desktop/github/blog (master)
$ git push git@heroku.com:herokugui.git master
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I don't want to use Heroku Toolbelt. That's why I am using Git commands to deploy code on Heroku. I am not able to push code to Heroku using Git commands. Is it possible to do this task without the toolbelt?

Another question I have is: is there any way to run PostgreSQL commands on Heroku GUI? If so, how?

解决方案

It's not easy (as with Heroku toolbelt), but it's possible. It involves hanging around your Heroku dashboard at least, so make sure you can access it.

First off, you need a key. If you're on a Linux machine (as me), then in your home directory you should have a folder named .ssh (it may be hidden, hit Ctrl+H to reveal, again, if Linux) and a file id_rsa.pub in there. If not, you need to generate your SSH key first.

ssh-keygen -t rsa

That will prompt you for a folder, default is fine, just hit Enter, then enter the passphrase (twice) to protect your key from being accessed by anyone else on your computer: without a passphrase it's unencrypted and free for anyone to take and use from that machine.

Once that is done, locate your public key file: id_rsa.pub. Note: not id_rsa, it's a private key, you may not want to give it to anyone, it's much like your future Heroku password, except for it's insanely large for a password. Open id_rsa.pub, you should see stuff like:

ssh-rsa aWhOLELotofUnreadABLEGibbERishWHiCHiSactUALLyYourPubLIcKeY...

You need to enter that line into your account settings in Heroku dashboard, under SSH Keys. You can find more info on keys here, in Heroku docs. Make sure Heroku actually recognizes you by issuing this:

ssh -v git@heroku.com

It should state you're authenticated.

Now for the git address. I assume you know your way around git, so I'll keep it short: you'll need to derive your repository address from your app name. Heroku usually generates weird (yet somewhat poetic) names like falling-wind-1624 or shielded-fjord-1858. I'll take the first one as an example, this is how you add its address as a git remote:

git remote add heroku git@heroku.com:falling-wind-1624.git

I'll explain a bit of it below. So what the toolbelt does here, is to use your app name only, it just builds the URL the same way by adding a path to Heroku server. Once that's done, you should be able to push your code:

git push heroku master

I've named a Heroku remote heroku, above, that's why I'm using heroku name here, you can name it whatever you want and use this afterwards. Once you've pushed the code, the rest is up to you.

这篇关于Rails应用程序可以部署而不使用Heroku Toolbelt吗?如果是这样,怎么样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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