【问题标题】:Heroku Slug size at 222 MB / Play Framework 2.1 /Heroku Slug 大小为 222 MB / Play Framework 2.1 /
【发布时间】:2013-02-24 00:11:56
【问题描述】:

我在 Heroku 上的应用 slug 大小显示为 222 mb。相当大,超过了允许的 200MB。

因此,我检查了以下内容:

  • 检查我的源代码大小:89,9 Mo知道80,2 Mo来自播放应用的目标文件夹 .

  • 检查我的 .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 ivy 缓存大小:100,9 Mo

这里详细说明每个文件夹的大小(在左侧):

MikaPc:cache Mika$ du -xak .|sort -n|tail -50
第1664章 第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章 2844 ./org.apache.lucene 3016 ./org.neo4j/neo4j-kernel/jars
第3820章 ./org.springframework/spring-context
第4356章 ./org.neo4j/neo4j-cypher/罐子
第4356章 ./org.neo4j/neo4j-cypher/jars/neo4j-cypher-1.9.M05.jar
第4436章 ./org.specs2/specs2_2.10/docs
第4436章 第4584章 ./org.scalaz/scalaz-core_2.10/docs
第4584章 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章 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()
  )

我可以做些什么来减少这个巨大的蛞蝓大小?即使我删除了一些文档和 jar 源,大小也会很大。

似乎确实发送了播放应用程序的目标文件夹..尽管有.gitignore文件

当然,我已经使用这个 buildpack 创建了我的 Heroku 应用程序:https://github.com/heroku/heroku-buildpack-scala

此外,有没有办法在 SBT(或播放配置)中精确,在 Heroku 生产环境中不应该下载像 Specs2(测试)这样的特定依赖项?

编辑 ---------

我运行了以下命令来显示我在 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 Mo 我想最终会达到 222Mo .. 嗡嗡声

获胜者是:227M ./.jdk/jre 参与了蛞蝓大小。这……正常吗?

【问题讨论】:

    标签: scala heroku sbt playframework-2.1


    【解决方案1】:

    Heroku 最近改变了我们为您的应用部署的 JDK 的构建方式。它现在比以前大很多。我们还提高了 slug 大小限制,因此这不会妨碍您的应用,只会让发布速度变慢一些。

    我们将更新文档以匹配当前的实际限制。

    【讨论】:

    • 明白 :) 非常感谢!
    • @adib 最后发生的事情是我们找到了一种方法来减小打包的 JDK 的大小。在推送新版本时,您应该会看到 slug 大小显着减小。如果没有,请联系 Heroku 支持。
    • @friism Play Framework 2.1 "todolist" 教程最终有 119.9MB 的 slug 大小(刚刚完成教程并在几秒钟前推送)。希望你能尽快大幅提高 slug 的上限。
    • @friism 确实!我刚刚发布了我自己的应用程序的新版本,以下是数字:Repo 大小:186 MB 和 Slug 大小:200 MB 的 148 MB。令人敬畏的缩小,远非极限!太棒了:)
    • @adib 使用更新的更小的 JDK,您还在担心会达到 200 MB 的限制吗?
    猜你喜欢
    • 2012-05-17
    • 2014-10-20
    • 1970-01-01
    • 2011-11-12
    • 1970-01-01
    • 2015-07-23
    • 2021-09-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多