gpt4 book ai didi

ruby-on-rails - 不使用 CLI 将 schema.rb 部署到 Heroku

转载 作者:行者123 更新时间:2023-11-29 13:17:26 25 4
gpt4 key购买 nike

我正在使用我大学的 ISP,它阻塞了 5000 端口,所以我不能 rake db:setup 到 heroku。我最近运行了 heroku rake db:reset 以便我可以创建一个新数据库,但现在我不知道如何设置它。有什么简单的方法可以做到这一点?我看过很多关于 heroku pg:push 的文章,但我似乎无法弄清楚我需要为此添加什么。如果我的 5000 端口被阻止,我该如何设置我的 postgres 数据库?

编辑:当运行 heroku run rake db:migrate 时,我收到以下错误消息:ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000

编辑 2:这是对 dig rendezvous.runtime.heroku.com

的响应

`

<<>> DiG 9.8.3-P1 <<>> rendezvous.runtime.heroku.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49376
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 13, ADDITIONAL: 5

;; QUESTION SECTION:
;rendezvous.runtime.heroku.com. IN A

;; ANSWER SECTION:
rendezvous.runtime.heroku.com. 450 IN CNAME ec2-50-19-103-36.compute-1.amazonaws.com.
ec2-50-19-103-36.compute-1.amazonaws.com. 604800 IN A 50.19.103.36

;; AUTHORITY SECTION:
compute-1.amazonaws.com. 1 IN NS pdns1.ultradns.net.
compute-1.amazonaws.com. 1 IN NS ns4.p31.dynect.net.
compute-1.amazonaws.com. 1 IN NS pdns3.ultradns.org.
compute-1.amazonaws.com. 1 IN NS u4.amazonaws.com.
compute-1.amazonaws.com. 1 IN NS u3.amazonaws.com.
compute-1.amazonaws.com. 1 IN NS ns3.p31.dynect.net.
compute-1.amazonaws.com. 1 IN NS ns2.p31.dynect.net.
compute-1.amazonaws.com. 1 IN NS pdns5.ultradns.info.
compute-1.amazonaws.com. 1 IN NS u6.amazonaws.com.
compute-1.amazonaws.com. 1 IN NS u1.amazonaws.com.
compute-1.amazonaws.com. 1 IN NS ns1.p31.dynect.net.
compute-1.amazonaws.com. 1 IN NS u5.amazonaws.com.
compute-1.amazonaws.com. 1 IN NS u2.amazonaws.com.

;; ADDITIONAL SECTION:
pdns1.ultradns.net. 1970 IN A 204.74.108.1
pdns1.ultradns.net. 1970 IN AAAA 2001:502:f3ff::1
ns3.p31.dynect.net. 69968 IN A 208.78.71.31
pdns3.ultradns.org. 12753 IN A 199.7.68.1
pdns3.ultradns.org. 43539 IN AAAA 2610:a1:1015::1

;; Query time: 72 msec
;; SERVER: 152.19.240.8#53(152.19.240.8)
;; WHEN: Sat Oct 28 19:50:08 2017
;; MSG SIZE rcvd: 500`

最佳答案

好的,我正在阅读 Heroku documentation我发现了这个:

The heroku run command opens a connection to Heroku on port 5000. If your local >network or ISP is blocking port 5000, or you are experiencing a connectivity issue, you will see an error similar to:

  $ heroku run rails console
Running rails console attached to terminal...
Timeout awaiting process

You can test your connection to Heroku by trying to connect directly to rendezvous.runtime.heroku.com on port 5000 using telnet. A successful session will look like this:

  $ telnet
rendezvous.runtime.heroku.com 5000 Trying 50.19.103.36...
Connected to ec2-50-19-103-36.compute-1.amazonaws.com.
Escape character >is '^]'

If you do not get this output, your computer is being blocked from accessing our services. We recommend contacting your IT department, ISP, or firewall manufacturer to move forward with this issue.

您使用的是什么代理?您的 ISP 阻止端口 5000 的说法很可能是正确的,因为 heroku run 不执行 HTTP 调用,而是使用 TCP 通过端口 5000 连接并使用自己的协议(protocol)。

我找到了这个 Stackoverflow post提到通过在后台运行命令来解决这个问题:

$ heroku run:detached rake db:migrate

然后跟踪日志以查看发生了什么:

$ heroku logs -p run.1 -t   

除此之外,我不知道有什么可以绕过 5000 端口上的阻止。

关于ruby-on-rails - 不使用 CLI 将 schema.rb 部署到 Heroku,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46994765/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com