git push heroku master需要永远

Vic*_*net 2 ruby git ruby-on-rails heroku

我正在使用基于Ubuntu 12.04的VM(ruby 1.9.2p290和rails 3.1.0),我的应用程序在本地完美运行.我正在使用git,当我尝试git push heroku master它时它不起作用:

git push heroku master

我得到:"计数对象:435,完成.压缩对象:100%(215/215),完成.写入对象:100%(435/435),73.35 KiB,完成.总计435(delta 171),重用435( delta 171)"

它永远不会完成,因此它不会向heroku推送任何内容.终端待命永远.我是heroku的新手,对不起,如果问题很明显:)

操作系统信息:

工作[1] +运行git push heroku master&

ps -x

PID TTY STAT TIME COMMAND

1078?Ssl 0:00 gnome-session --session = ubuntu

1135?Sl 0:00/usr/bin/VBoxClient --clipboard

1147?Sl 0:00/usr/bin/VBoxClient --display

1154?Sl 0:00/usr/bin/VBoxClient --seamless

1162?Sl 0:19/usr/bin/VBoxClient --draganddrop

1167?Ss 0:00/usr/bin/ssh-agent/usr/bin/dbus-launch --exit-with-s

1171?S 0:00/usr/bin/dbus-launch --exit-with-session gnome-sessio

1172?Ss 0:01 // bin/dbus-daemon --fork --print-pid 5 --print-addres

1246?Sl 0:00/usr/bin/gnome-keyring-daemon --start --components = se

1250?Sl 0:02/usr/lib/gnome-settings-daemon/gnome-settings-daemon

1329?S 0:00/usr/lib/gvfs/gvfsd

1334?Sl 0:00/usr/lib/gvfs // gvfs-fuse-daemon -f /home/ubuntu/.gvfs

1401?Sl 0:03 metacity

1417?S 0:00/usr/lib/i386-linux-gnu/gconf/gconfd-2

1421?小号

1426?Sl 0:01 unity-2d-panel

1427?Sl 0:07 unity-2d-shell

1430?S 0:00/usr/lib/pulseaudio/pulse/gconf-helper

1447?Sl 0:01/usr/lib/bamf/bamfdaemon

1450?Sl 0:00/usr/lib/gnome-settings-daemon/gnome-fallback-mount-h

1453?Sl 0:02鹦鹉螺-n

1455?Sl 0:00/usr/lib/policykit-1-gnome/polkit-gnome-authenticatio

1457?Sl 0:00 bluetooth-applet

1468?Sl 0:00 nm-applet

1482?S 0:00/usr/lib/gvfs/gvfs-gdu-volume-monitor

1500?Sl 0:00/usr/lib/gvfs/gvfs-afc-volume-monitor

1504?S 0:00/usr/lib/gvfs/gvfs-gphoto2-volume-monitor

1518?S 0:00/usr/lib/gvfs/gvfsd-trash --spawner:1.9/org/gtk/gvf

1521?Sl 0:01/usr/lib/unity/unity-panel-service

1523?Sl 0:00/usr/lib/dconf/dconf-service

1539?Sl 0:00/usr/lib/indicator-datetime/indicator-datetime-servic

1541?Sl 0:00/usr/lib/indicator-printers/indicator-printers-servic

1543?Sl 0:00/usr/lib/indicator-messages/indicator-messages-servic

1545?S1 0:00/usr/lib/indicator-session/indicator-session-service

1547?Sl 0:00/usr/lib/indicator-application/indicator-application-

1549?Sl 0:00/usr/lib/indicator-sound/indicator-sound-service

1574?S 0:00/usr/lib/geoclue/geoclue-master

1591?S 0:00/usr/lib/ubuntu-geoip/ubuntu-geoip-provider

1597?Sl 0:00/usr/lib/gnome-disk-utility/gdu-notification-daemon

1603?S 0:00/usr/lib/gvfs/gvfsd-metadata

1609?Sl 0:00/usr/lib/indicator-appmenu/hud-service

1620?Sl 0:00/usr/lib/unity-lens-applications/unity-applications-d

1622年?Sl 0:00/usr/lib/unity-lens-files/unity-files-daemon

1624?Sl 0:00/usr/lib/unity-lens-music/unity-music-daemon

1626年?Sl 0:00/usr/bin/python/usr/lib/unity-lens-video/unity-lens-

1653年?Sl 0:00/usr/bin/zeitgeist-daemon

1661年?Sl 0:00心灵感应指标

1668年?Sl 0:00/usr/lib/zeitgeist/zeitgeist-fts

1672年?Sl 0:00 zeitgeist-datahub

1676年?S 0:00/bin/cat

1682年?Sl 0:00/usr/lib/telepathy/mission-control-5

1701?Sl 0:00 gnome-screensaver

1703?Sl 0:00/usr/bin/python/usr/lib/unity-scope-video-remote/uni

1728年?Sl 0:05 gnome-terminal

1734年?S 0:00 gnome-pty-helper

1738 pts/2 Ss 0:00 bash

1796年?Sl 0:00更新通知程序

1954 pts/2 S 0:00 git push heroku master

1955 pts/2 S 0:00 ssh git@heroku.com git-receive-pack'polar-island-471

1959 pts/2 R + 0:00 ps -x

Aar*_*son 6

推送到Heroku可以超时的原因有很多.根据我的经验,最常见的原因是由于网站大小和网站大小,我的意思是3件事:你的git仓库的大小,你的网站大小被推送到Heroku(git repo - 被忽略的文件),以及你使用的宝石的大小.Heroku在容纳大型站点(或者长时间运行的进程)方面并不是特别强大,如果你变得太大,你可能会导致你的推送暂停/超时和间歇性,这可能是令人困惑的.

.git文件夹 我让网站变得无法解释地大,并且随着时间的推移,我看到项目根目录中的.git文件夹已经增长到600mb.谢天谢地,我注意到heroku部署喋喋不休中的警告警告我,我的git repo太大了.无论如何,由于该文件夹是由幕后的git管理的,我最终开始使用新的git repo并将我的代码移到它上面,这使我的网站缩小了90%.

.slugignore 导致我的网站变得足够大以至于超时的另一个陷阱是允许日志,我的临时目录和我的solr索引目录之类的东西被包含在项目中.在我的.slugignore文件中排除了所有这些文件夹后,推送变得非常快.是的,你可以使用.gitignore获得相同的基本效果,但有些东西我喜欢通过git管理,但在推送到heroku时会忽略.那时.slugignore就派上用场了.

宝石 通过完成上述步骤,我将我的网站缩小到合理的大小,但仍然偶尔会有超时.然后我意识到宝石也会影响你的网站规模.所以我从我的gemfile中删除了一些未使用的宝石,并且我能够将我的slug编译时间从900秒减少到250秒,并且我的总体部署时间从15分钟以上,频繁超时到10分钟以下.对于每次部署而言不必等待这么长时间并且冒出一半时间的风险超时,这是多么轻松.

根据您的特定设置,任何或所有这些因素都会对您造成伤害.就我而言,我做错了什么.但是,即使您没有超时,您仍可能希望尽可能地修剪您的网站以缩短部署时间.

如何使heroku不吮吸 http://www.stormconsultancy.co.uk/blog/development/6-ways-to-get-more-bang-for-your-heroku-buck-while-making-your-rails-现场超活泼的/