Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to generate deb file in play 2.2-RC2 #37

Closed
fayimora opened this issue Sep 20, 2013 · 28 comments
Closed

Unable to generate deb file in play 2.2-RC2 #37

fayimora opened this issue Sep 20, 2013 · 28 comments
Labels

Comments

@fayimora
Copy link
Contributor

Hello,

Play! framework 2.2.x comes with the native packager bundled in. I generated a new project and tried to generate a deb but my efforts were futile. The command fails saying the description field has a blank line. Please see the image below for the full error.
screen shot 2013-09-18 at 00 07 50

I added a couple of description fields but sbt complained that the key couldn't be found. Error in image below.
screen shot 2013-09-18 at 20 44 56

I fixed this by explicitly importing com.typesafe.sbt.packager.Keys._. This solved the second problem - keys were now valid. However, I still was unable to generate the deb package 😦.

My build.sbt can be found here.

I posted this on the play mailing list but I was told to try here.

I'll really appreciate any help I can get on this.

Cheers,
Fayi

@jsuereth
Copy link
Member

Sorry that the error is a bit confusing. It's something I've been meaning to fix up, but haven't had the time.

If you want to create native packages, you need to add the necessary metadata for that packaging system. E.g. Debian requires a few extra pieces:

  • packageDescription
  • packageSummary or packageSummary in Linux (since windows summary has different string restrictions)
  • maintainer in Debian - All debian packages require a listed "maintainer", just a name <email>.

You should check the usage in the readme to see the required metadata you need for bare-minimum packages:

https://github.com/sbt/sbt-native-packager#usage

You can also read our documentation for more advanced options:

http://www.scala-sbt.org/sbt-native-packager/linux.html - Generic packaging setting for linux
http://www.scala-sbt.org/sbt-native-packager/debian.html - Specific debian settings.

Any recommendations on (1) how to improve the documentation (2) how to improve error messages are more than welcome!

Let me know if I can help in any other way :)

@fayimora
Copy link
Contributor Author

@jsuereth So I went back and tried every possible setting but my efforts were still futile. I still have no idea what's going on. I checked the control file and it truly doesn't have a description. That's weird considering I have set a description in my build.sbt 😦

Any thing else I can try?

Cheers

Raw Links
new build.sbt => https://gist.github.com/6641111
control file => https://gist.github.com/fayimora/6641154

@jsuereth
Copy link
Member

After modifying your build, did you type "reload" on the console? Your build.sbt file should work. I'm about to head out for the weekend, but I can respond via email. Later in the weekend, I can try it out myself to help you out.

If you'd like example projects that make debians, most of them are sbt 0.12.4, which use the old .scala format, but I can send those to you.

@jsuereth
Copy link
Member

Hre's the project which makes debian files for sbt itself, if that helps. https://github.com/sbt/sbt-launcher-package

@fayimora
Copy link
Contributor Author

Yes I did reload(after cleaning), even restarted sbt lol. Yes if you could
generate a fresh 2.2 project and try it out, that would be really helpful.

Fayi

On 20 September 2013 18:57, Josh Suereth notifications@github.com wrote:

Hre's the project which makes debian files for sbt itself, if that helps.
https://github.com/sbt/sbt-launcher-package


Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-24828785
.


Fayimora Femi-Balogun
Computer Science Student

@fayimora
Copy link
Contributor Author

Just for the record, the command I'm running is debian:package-bin

On 20 September 2013 19:04, Fayimora Femi-Balogun fayi@fayimora.com wrote:

Yes I did reload(after cleaning), even restarted sbt lol. Yes if you could
generate a fresh 2.2 project and try it out, that would be really helpful.

Fayi

On 20 September 2013 18:57, Josh Suereth notifications@github.com wrote:

Hre's the project which makes debian files for sbt itself, if that helps.
https://github.com/sbt/sbt-launcher-package


Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-24828785
.


Fayimora Femi-Balogun
Computer Science Student


Fayimora Femi-Balogun
Computer Science Student

@jsuereth
Copy link
Member

yeah, that's the appropriate command. everything looks correct. I have ~ 10 minutes before I turn into a pumpkin (goign away for the weekend). I'll see if I can duplicate quickly.

@fayimora
Copy link
Contributor Author

Thanks thanks 💃

@jsuereth
Copy link
Member

Huh, odd. SO I took the reactive stocks app (https://github.com/typesafehub/reactive-stocks) and modified build.sbt:

import com.typesafe.sbt.SbtNativePackager._
import com.typesafe.sbt.packager.Keys._

name := """reactive-stocks"""

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.2.1",
  "com.typesafe.akka" %% "akka-slf4j" % "2.2.1",
  "org.webjars" %% "webjars-play" % "2.2.0",
  "org.webjars" % "bootstrap" % "2.3.1",
  "org.webjars" % "flot" % "0.8.0",
  "com.typesafe.akka" %% "akka-testkit" % "2.2.1" % "test"
)

play.Project.playScalaSettings

description in Linux := "The description"

packageDescription in Linux := "The description"

packageSummary := "A package summary"

maintainer := "Fayimora <fayi@fayimora.com>"

Then did a clean and debian:package-bin ->

[reactive-stocks] $ debian:packageBin
[info] Packaging /home/jsuereth/reactive-stocks/target/scala-2.10/reactive-stocks_2.10-1.0-SNAPSHOT-sources.jar ...
[info] Done packaging.
[info] Wrote /home/jsuereth/reactive-stocks/target/scala-2.10/reactive-stocks_2.10-1.0-SNAPSHOT.pom
[info] Main Scala API documentation to /home/jsuereth/reactive-stocks/target/scala-2.10/api...
[info] Packaging /home/jsuereth/reactive-stocks/target/scala-2.10/reactive-stocks_2.10-1.0-SNAPSHOT.jar ...
[info] Done packaging.
model contains 37 documentable templates
[info] Main Scala API documentation successful.
[info] Packaging /home/jsuereth/reactive-stocks/target/scala-2.10/reactive-stocks_2.10-1.0-SNAPSHOT-javadoc.jar ...
[info] Done packaging.
[info] dpkg-deb: building package `reactive-stocks' in `/home/jsuereth/reactive-stocks/target/reactive-stocks-1.0-SNAPSHOT.deb'.
[success] Total time: 10 s, completed Sep 20, 2013 2:15:48 PM

Not sure what to say.... Can you reproduce following my example? It could be something else "fun" in your local project :)

@fayimora
Copy link
Contributor Author

I'll clone the reactive-stocks app now and try

@fayimora
Copy link
Contributor Author

oh no! It didn't work!!! Same error. Something with my Mac maybe? 😦

@jsuereth
Copy link
Member

Huh... what version of dpkg?

I use it from ubuntu. What did you install to try on mac, I can do that
next week.
On Sep 20, 2013 2:23 PM, "Fayimora Femi-Balogun" notifications@github.com
wrote:

oh no! It didn't work!!! Same error. Something with my Mac maybe? [image:
😦]


Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-24830676
.

@fayimora
Copy link
Contributor Author

@jsuereth I installed dpkg with Homebrew

@fayimora
Copy link
Contributor Author

Debian `dpkg' package management program version 1.17.1 (darwin-amd64).

@fayimora
Copy link
Contributor Author

Hi @jsuereth, have you been able to take a look at this?

@jsuereth
Copy link
Member

No I haven't. I am now back from travel, but I haven't had a chance to install homebrew on the mac laptop I use for testing. Like I said, this does work on my ubuntu box. I'm doing another week of cleanup, so I may have time to dig into this mac issue. It all depends on whether or not I fix the open windows issues quickily :). Any further help here appreciated. I'm also trying to write documentation for how I do testing in my dev environment, so you can experience the power of sbt :)

@fayimora
Copy link
Contributor Author

Nice Nice. Thanks for the hard work. I'll try to contribute the little I
can(still an sbt newbie 😄 )

Fayi

On 14 October 2013 14:49, Josh Suereth notifications@github.com wrote:

No I haven't. I am now back from travel, but I haven't had a chance to
install homebrew on the mac laptop I use for testing. Like I said, this
does work on my ubuntu box. I'm doing another week of cleanup, so I may
have time to dig into this mac issue. It all depends on whether or not I
fix the open windows issues quickily :). Any further help here appreciated.
I'm also trying to write documentation for how I do testing in my dev
environment, so you can experience the power of sbt :)


Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-26256138
.


Fayimora Femi-Balogun
Computer Science Student

@gbougeard
Copy link
Contributor

Hi,

I'm getting the same issue : blank line in value of Description

but in french :
[error] dpkg-deb : erreur : analyse du fichier '/home/gbougeard/git/play-fam/target/fam-1.0-SNAPSHOT/DEBIAN/control' vers la ligne 8 paquet 'fam' :
[error] ligne vide dans la valeur du champ « Description »

I'm using ubuntu (freshly updated to 13.10) and here is my Build.scala file : https://gist.github.com/gbougeard/7046408

@paddymahoney
Copy link

I had the same issue-what resolved this problem for me was the addition of a setting for the key
..., packageDescription in Debian := "some setting", ...

@jsuereth
Copy link
Member

Ah, right. It's not apparent from the plugin, but you have to specify a few defaults to ensure that you can make the native packages. Things we can't autogenerate, like description. What I should do, is add some validation that warns you what is missing and what sbt setting will fix it, rather than relying on dpkg-deb to tell you and have you understanding the mapping between sbt + dpkg-deb. SO, I'm going to fix this with a broader enhancement of validations for every attribute we try to use, and better error messages.

Sound like a good plan? Thanks to everyone for the detailed diagnosis, particularly @paddymahoney for the solution.

@paddymahoney
Copy link

@fayimora So you may also run a 'show packageDescription' and 'inspect packageDescription' - I found that the order in which I appended my project specific settings to the playScalaSettings was causing the values that I supplied for packageDescription in Debian := "My package description" to be overwritten. ie, in my play.Project, changing
...
settings = Seq(someProjectSettings) ++ playScalaSettings
to
settings = playScalaSettings ++ Seq(someProjectSettings)

allowed my settings to be preserved.

@fayimora
Copy link
Contributor Author

Hey @paddymahoney did you try this with a Mac? I swapped the order in my build.sbt but nothing changed.

Here is my build.sbt => https://gist.github.com/7089882

@paddymahoney
Copy link

Didn't try it with a Mac - on linux myself.

What is the result of running 'show packageDescription' within your
play_deb project? If you are getting that error, I suspect that it is the
empty string.

-Patrick

On 21 October 2013 15:57, Fayimora Femi-Balogun notifications@github.comwrote:

Hey @paddymahoney https://github.com/paddymahoney did you try this with
a Mac? I swapped the order in my build.sbt but nothing changed.

Here is my build.sbt => https://gist.github.com/7089882


Reply to this email directly or view it on GitHubhttps://github.com//issues/37#issuecomment-26750632
.

@gbougeard
Copy link
Contributor

Hi succeed i creating a .deb in play 2.2.0 with debian:packageBin but when I try to run the binary deployed (after install it with dpkg -i) I have the followingg error (in french):
/usr/bin/play-fam
Erreur : impossible de trouver ou charger la classe principale play.core.server.NettyServer

I can translate to :
Error: unable to find or load main class play.core.server.NettyServer.

Did I miss something? Any idea?

@jsuereth
Copy link
Member

jsuereth commented Nov 8, 2013

Sorry for not responding before. I don't have many ideas, besides saying you should try to run with -d and see what the command line looks like. If the classpath is off, that would cause the error. I can't really debug any more without more info (the -d information is a start).

@gbougeard
Copy link
Contributor

Sorry too! I fixed it adding the right line in plugins.sbt :
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.3")

After that, I was able to launch my app with sudo (root access is needed to create the PID file).

Now may I create a feature request to generate a service like the play2 UbuntuPackager (https://github.com/lunatech-labs/play2-ubuntu-package) ? Or maybe there is a config option for that?

@jsuereth
Copy link
Member

jsuereth commented Nov 8, 2013

Funny you mention that.....

Have you seen: https://github.com/sbt/sbt-native-packager#java-server-application-experimental

I believe this was contributed back from one of those plugins :) You should be able to create an upstart service from play by adding the java_server settings to your build.

@gbougeard
Copy link
Contributor

Great! I'm gonna test it right now!
I'm also gonna migrate from the Build.scala to the build.sbt file

@muuki88 muuki88 closed this as completed in acfd080 Feb 1, 2014
muuki88 added a commit that referenced this issue Feb 1, 2014
Fix #37 Adding meaningful logging, when packageDescription in Debian is
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants