2013-03-08 28 views
6

Heroku上的我的app slug大小表示222 mb。相當龐大,超過了200MB的允許範圍。Heroku S size大小爲222 MB/Play Framework 2.1/

因此,我檢查這些東西:

  • 檢查我的源代碼大小:89.9莫知道80.2莫來源於發揮應用程序的目標文件夾

  • 檢查我的.gitignore文件,以確保遊戲的應用程序的目標文件夾以及被排除在外。在這裏我的.gitignore文件:

.DS_Store   
logs 
project/project  
project/target 
target     // target well precised here 
tmp  
.history  
dist  
/.idea  
/*.iml //space here otherwise appears as a comment here  
/out  
/.idea_modules  
/.classpath  
/.project  
/RUNNING_PID  
/.settings 

檢查我的SBT常春藤緩存大小:100,9莫

這裏的每個文件夾的大小(左側)詳細:

MikaPc:緩存米卡$杜-xak |排序-n |尾-50
個1664 ./org.neo4j/neo4j/docs 1664 ./org.neo4j/neo4j/docs/neo4j-1.9.M05-javadoc.jar
1668 ./org.neo4j/neo4j-kernel/docs
1668。 /org.neo4j/neo4j-kernel/docs/neo4j-kernel-1.9.M05-javadoc.jar
1680 ./org.springframework/spring-test 1748 ./org.neo4j/neo4j
1752 ./org.aspectj/aspectjweaver /罐子
1752 ./org.aspectj/aspectjweaver/jars/aspectjweaver-1.7.1.jar
1860 ./org.springframework/spring-jdbc
1888 ./org.springframework.data/spring-data -commons
1980 ./org.scala-sbt/main/jars
1980年./org.scala-sbt/main/jars/main-0.12.2.jar
1992年./org.scala-sbt/main
2100 ./org.springframework/spring-context/docs
2100 ./org.springframework/spring-context/docs/spring-context-3.2.0.RELEASE-javadoc.jar 2104 ./com.sun.jersey 2348./org.springframework/spring-core
2356 ./ org.springframework.data/spring-data-neo4j
2404 ./org.springframework/spring-beans
2776 ./org.apache.lucene/lucene-core
2800 ./org.springframework/spring-web
個2808 ./org.springframework/spring-webmvc
2812 ./org.aspectj/aspectjweaver/docs
2812 ./org.aspectj/aspectjweaver/docs/aspectjweaver-1.7.1-javadoc.jar 2844 ./org .apache.lucene 3016 ./org.neo4j/neo4j-kernel/jars
3820 ./org.springframework/spring-context
4356 ./org.neo4j/neo4j-cypher/jars
4356 ./org.neo4j /neo4j-cypher/jars/neo4j-cypher-1.9.M05.jar
4436 ./org.specs2/specs2_2.10/docs
4436 ./org.specs2/specs2_2.10/docs/specs2_2.10-1.13 。1-SNAPSHOT-javadoc.jar 4584 ./org.scalaz/scalaz-core_2.10/docs
4584 ./org.scalaz/scalaz-core_2.10/docs/scalaz-core_2.10-7.0-SNAPSHOT-javadoc的.jar 4824 ./org.neo4j/neo4j-cypher 5712 ./org.neo4j/neo4j-kernel
5936 ./org.aspectj/aspectjweaver
6024 ./org.springframework.data 6484 ./org.aspectj
6520 ./org.specs2/specs2_2.10/jars
6520 ./org.specs2/specs2_2.10/jars/specs2_2.10-1.13.1-SNAPSHOT.jar
6812 ./org.scala-sbt 8288 ./org.scalaz/scalaz-core_2.10/jars
8288 ./org.scalaz/scalaz-core_2.10/jars/scalaz-core_ 2.10-7.0-SNAPSHOT.jar 11500 ./org.specs2/specs2_2.10 11524 ./org.specs2
13132 ./org.scalaz/scalaz-core_2.10 13140 ./org.scalaz
15832 ./org .neo4j 23500 ./org.springframework
98552。

我SBT構建文件包含以下依存關係:

val appDependencies = Seq(
    jdbc, 
    anorm, 
    "org.springframework" % "spring-aop" % "3.2.0.RELEASE", 
    "org.springframework" % "spring-aspects" % "3.2.0.RELEASE", 
    "org.springframework" % "spring-beans" % "3.2.0.RELEASE", 
    "org.springframework.data" % "spring-data-commons-core" % "1.4.1.RELEASE", 
    "org.springframework" % "spring-expression" % "3.2.0.RELEASE", 
    "org.springframework" % "spring-jdbc" % "3.2.0.RELEASE", 
    "org.springframework" % "spring-orm" % "3.2.0.RELEASE", 
    "org.springframework" % "spring-test" % "3.2.0.RELEASE", 
    "org.springframework" % "spring-tx" % "3.2.0.RELEASE", 
    "org.springframework.data" % "spring-data-neo4j" % "2.2.0.RELEASE" excludeAll(
     ExclusionRule(organization = "com.sun.jdmk"), 
     ExclusionRule(organization = "com.sun.jmx"), 
     ExclusionRule(organization = "javax.jms") 
    ), 
    "org.neo4j" % "neo4j" % "1.9.M05" excludeAll(
     ExclusionRule(organization = "org.neo4j", name="neo4j-kernel") 
    ), 
    "org.neo4j" % "neo4j-kernel" % "1.9.M05" % "test" classifier "tests" classifier "", 
    "asm" % "asm-all" % "3.1", 
    "org.springframework.data" % "spring-data-neo4j-rest" % "2.1.0.RELEASE" excludeAll(
     ExclusionRule(organization = "org.neo4j") 
    ), 
    "org.neo4j" % "neo4j-rest-graphdb" % "1.9.M04", 
    "org.scalaz" %% "scalaz-core" % "7.0-SNAPSHOT" withSources(), 
    "org.specs2" %% "specs2" % "1.13.1-SNAPSHOT" % "test" withSources(), 
    "org.mockito" % "mockito-all" % "1.9.0" %"test", 
    "securesocial" %% "securesocial" % "master-SNAPSHOT" withSources() 
) 

我能做什麼來減少這種巨大的段塞大小?即使我刪除了一些文檔和罐子來源,尺寸也會很大。

這真的似乎發揮應用程序的目標文件夾被髮送。儘管.gitignore文件

當然,我用這個buildpack已經建立了我的Heroku應用程序:https://github.com/heroku/heroku-buildpack-scala

而且,是有辦法在SBT(或播放配置)中是否精確,某些特定的相關性(如Specs2(測試)不應該在Heroku生產環境中下載?

編輯---------

我在Heroku上推我已經運行下面的命令來顯示實際尺寸:

MikaPc:wwa Mika$ heroku run bash  
Running `bash` attached to terminal... up, run.9266   
~ $ du -h --apparent-size --max-depth 2  
5.3K ./test/resources   
12K ./test/unit   
5.6K ./test/functional   
6.5K ./test/context   
8.5K ./test/acceptance   
5.2K ./test/integration   
47K ./test   
5.0K ./app/helpers   
33K ./app/controllers   
11K ./app/models   
161K ./app/assets   
34K ./app/views   
8.0K ./app/applicationservices   
5.0K ./app/repositories   
20K ./app/utils   
281K ./app    
8.7M ./target/scala-2.10   
1.4M ./target/resolution-cache   
143K ./target/streams    
60M ./target/staged   
71M ./target   
1.1M ./.sbt_home/bin   
834K ./.sbt_home/.sbt   
1.9M ./.sbt_home   
30K ./public/images    
171K ./public/javascripts   
9.6K ./public/stylesheets   
214K ./public   
4.0K ./.ivy2/cache   
8.0K ./.ivy2   
1.1M ./.jdk/bin   
19M ./.jdk/lib   
203K ./.jdk/include   
227M ./.jdk/jre   
247M ./.jdk    
2.8M ./project/target   
20K ./project/project    
53M ./project/boot   
56M ./project   
12K ./conf   
375M .   

375莫壓縮前我想象結局高達222Mo .. hum

而獲勝者是:227M ./.jdk/jre採取部分slu size大小。它是否正常?

回答

6

Heroku最近改變了我們在您的應用中部署的JDK的構建方式。現在比以前大很多。我們還提高了slu size大小的限制,所以這不會妨礙您的應用程序,而不會使發佈速度稍慢。

我們將更新文檔以匹配實際的電流限制。

+0

瞭解:)非常感謝! – Mik378 2013-03-09 18:38:55

+0

期待更新的文檔。 – adib 2013-03-13 04:30:56

+0

@adib最終發生的是我們找到了一種減小打包的JDK大小的方法。在推出新版本時,您應該看到顯着減少的中彈大小。如果沒有,請聯繫Heroku支持。 – friism 2013-03-13 05:16:10