2016-07-22 36 views
0

部署symfony的時候對於我的Symfony應用程序在編譯PHP,我部署的heroku未能在Heroku

如果使用Heroku的,你注意它與GIT,作曲家,Heroku的工具區...等

運行要部署我的應用程序,我要合併上游我拉請求(叉git的工作流程)。到目前爲止,沒有問題,一切正常。 有一次,我合併我拉的要求,我有能力讓一個分支上游主然後把這個分支在Heroku上用,例如,下面的命令:

git push prod my-branch:master 

爲了更準確地解釋了你,這是我的git遠程當我在終端做出git remote -v

coworker  https://github.com/my-coworker-repo/my-app.git (fetch) 
coworker  https://github.com/my-coworker-repo/my-app.git (push) 
origin   https://github.com/my-origin-repo/my-app.git (fetch) 
origin   https://github.com/my-origin-repo/my-app.git (push) 
upstream  https://github.com/my-company-account/my-app.git (fetch) 
upstream  https://github.com/my-company-account/my-app.git (push) 
prod   https://git.heroku.com/limitless-peak-.....git (fetch) 
prod   https://git.heroku.com/limitless-peak-.....git (push) 

所以,當我想用​​命令git push prod my-branch:master

這個錯誤發生在Heroku上部署:

Counting objects: 41, done. Delta compression using up to 4 threads.

Compressing objects: 100% (15/15), done. Writing objects: 100% (15/15), 1.49 KiB | 0 bytes/s, done. Total 15 (delta 10), reused 0 (delta 0)

remote: Compressing source files... done. remote: Building source: remote: remote: -----> PHP app detected remote: remote: !
WARNING: Your 'composer.json' contains a non-'stable' setting

remote: for 'minimum-stability'. This may cause the installation of

remote: unstable versions of runtimes and extensions during this

deploy.

remote: It is recommended that you always use stability flags instead,

remote: even if you have 'prefer-stable' enabled. For more information, remote: see https://getcomposer.org/doc/01-basic-usage.md#stability

remote:

remote: -----> Bootstrapping...

remote:

remote: gzip: stdin: not in gzip format

remote: tar: Child returned status 1

remote: tar: Error is not recoverable: exiting now

remote: ! Push rejected, failed to compile PHP app.

remote: remote: ! Push failed

remote: Verifying deploy...

remote:

remote: ! Push rejected to my-app.

remote:

To https://git.heroku.com/my-app.git ! [remote rejected] my-branch -> master (pre-receive hook declined) error: impossible de pousser des références vers ' https://git.heroku.com/my-app.git '

如果我運行composer更新或安裝到我的heroku應用程序heroku run bash -r prod我有一個運行時允許內存限制錯誤,但我不認爲問題來自這個問題! 這是錯誤:

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in phar:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in phar:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors

這是我composer.json文件:

{ 
    "name": "symfony/framework-standard-edition", 
    "license": "MIT", 
    "type": "project", 
    "description": "The \"Symfony Standard Edition\" distribution", 
    "autoload": { 
     "psr-4": { "": "src/" } 
    }, 
    "minimum-stability": "alpha", 
    "prefer-stable": true, 
    "require": { 
     "php": "~5.6.0", 
     "ext-mbstring": "*", 
     "ext-mcrypt": "*", 
     "symfony/symfony": "2.7.*", 
     "doctrine/orm": "^2.4.8", 
     "doctrine/doctrine-bundle": "~1.4", 
     "symfony/assetic-bundle": "~2.3", 
     "symfony/swiftmailer-bundle": "~2.3", 
     "symfony/monolog-bundle": "~2.8", 
     "sensio/distribution-bundle": "~4.0", 
     "sensio/framework-extra-bundle": "^3.0.2", 
     "incenteev/composer-parameter-handler": "~2.0", 
     "friendsofsymfony/user-bundle": "~2.0.0", 
     "knplabs/doctrine-behaviors": "~1.1", 
     "friendsofsymfony/jsrouting-bundle": "^1.5", 
     "jms/serializer-bundle": "^1.1", 
     "genemu/form-bundle": "2.2.*", 
     "elao/web-profiler-extra-bundle" : "~2.3", 
     "a2lix/translation-form-bundle": "^2.0", 
     "ircmaxell/password-compat": "~1.0", 
     "vich/uploader-bundle": "^0.14.0", 
     "liip/imagine-bundle": "^1.4", 
     "doctrine/data-fixtures": "^1.1", 
     "league/geotools": "@stable", 
     "winzou/state-machine-bundle": "~0.2.2", 
     "doctrine/doctrine-fixtures-bundle": "~2.2", 
     "muka/shape-reader": "dev-master", 
     "league/csv": "^8.0", 
     "ronanguilloux/isocodes": "^2.0", 
     "liuggio/excelbundle": "~2.0", 
     "presta/sitemap-bundle": "dev-master", 
     "liip/doctrine-cache-bundle": "^1.0", 
     "evheniy/robots-txt-bundle": "1.*", 
     "php-amqplib/rabbitmq-bundle": "^1.9", 
     "icicleio/icicle": "^0.9.6" 
    }, 
    "require-dev": { 
     "sensio/generator-bundle": "~2.3", 
     "heroku/heroku-buildpack-php": "*" 
    }, 
    "scripts": { 
     "pre-install-cmd": [ 
      "BetonDirect\\EntityBundle\\HerokuDatabase::populateEnvironment" 
     ], 
     "post-install-cmd": [ 
      "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" 
     ], 
     "post-update-cmd": [ 
      "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile", 
      "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget" 
     ], 
     "compile": [ 
      "php app/console assetic:dump --no-debug" 
     ] 
    }, 
    "config": { 
     "bin-dir": "bin" 
    }, 
    "extra": { 
     "symfony-app-dir": "app", 
     "symfony-web-dir": "web", 
     "symfony-assets-install": "hard-copy", 
     "incenteev-parameters": { 
      "file": "app/config/parameters.yml", 
     }, 
     "branch-alias": { 
      "dev-master": "2.7-dev" 
     }, 
     "heroku": { 
      "php-config": [ 
       "date.timezone=Europe/Paris" 
      ] 
     } 
    } 
} 

你知道問題出在哪裏可以?

而且,我已經把我的應用程序Heroku的部署(同樣的方法介紹如下)使用相同的配置,和我以前沒有這個錯誤。

當我去Heroku的日誌頁面上,我有這樣的:

2016-07-22T15:07:11.164523+00:00 heroku[slug-compiler]: Slug compilation started 

如果我走在Heroku的構建日誌視圖我有同樣的錯誤作爲終端如:

-----> PHP app detected 
!  WARNING: Your 'composer.json' contains a non-'stable' setting 
     for 'minimum-stability'. This may cause the installation of 
     unstable versions of runtimes and extensions during this deploy. 
     It is recommended that you always use stability flags instead, 
     even if you have 'prefer-stable' enabled. For more information, 
     see https://getcomposer.org/doc/01-basic-usage.md#stability 
-----> Bootstrapping... 
gzip: stdin: not in gzip format 
tar: Child returned status 1 
tar: Error is not recoverable: exiting now 
!  Push rejected, failed to compile PHP app. 
!  Push failed 
+0

你想用'minimum-stability:alpha'完成什麼? – chh

+0

@chh我把它改成'minimum-stability:「dev」',我讓作曲家更新cmd,但沒有任何改變。事實上,我似乎有一個「非穩定版」的軟件包。你怎麼看 ? –

回答

0

我找到了解決辦法。問題來自heroku-buildpacks-PHP

事實上,我必須在本地更新這個回購,然後把他推到我的heroku-app(直接在我的遠程),以便正確編譯php並在heroku服務器上部署我的應用程序。

1

PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in phar:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32 bytes) in phar:///app/.heroku/php/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors

內存限制的錯誤是由你在賽道本身運行的作曲家造成的。 dynos本身可以具有512MB或1GB的RAM,但不啓用交換。

當Heroku的處理您的Git推,然後作曲家實際上是在一個特殊的,比較強大的情況下運行具有更多的資源,所以作曲家不出來的內存運行在那裏。對於具有很多依賴性的應用程序,Composer需要在GB RAM的北邊運行纔是正常的。

+0

我理解這個關於composer和dynos的過程,我使用這個例子。請注意,我已經使用我的帖子中描述的方法將我的應用放在heroku上。在它運行良好之前,現在我在嘗試部署時出現此錯誤(推送失敗),並且我不明白爲什麼,因爲我從一開始就具有相同的配置(例如,沒有更新Composer包) –