Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Play application containerized with version 1.7.0 does not start #177

Closed
olivierlemasle opened this issue Feb 10, 2019 · 3 comments
Closed

Comments

@olivierlemasle
Copy link
Contributor

olivierlemasle commented Feb 10, 2019

Latest version (1.7.0) does not work for Play Framework projects, because Play has no permission to write the PID in /opt/docker/RUNNING_PID.

To reproduce the bug, simply follow the steps in https://developer.lightbend.com/docs/lightbend-orchestration/current/getting-started/sbt-play-minikube.html (with rp 1.7.0 installed).

Deployment succeeds, however accessing the server gives an error "502 Bad Gateway" and the pod has these logs:

Oops, cannot start the server.
java.nio.file.AccessDeniedException: /opt/docker/RUNNING_PID
	at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
	at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
	at sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
	at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:434)
	at java.nio.file.Files.newOutputStream(Files.java:216)
	at play.core.server.ProdServerStart$.createPidFile(ProdServerStart.scala:159)
	at play.core.server.ProdServerStart$.start(ProdServerStart.scala:49)
	at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
	at play.core.server.ProdServerStart.main(ProdServerStart.scala)

Creating the image with docker:publishLocal and running it manually gives the same error.

I suppose it may be related to sbt/sbt-native-packager#1198 or to the recent changes on Docker image building.

@eed3si9n
Copy link
Contributor

Which version of reactive-cli are you using? rp 1.7.0 should put -Dplay.server.pidfile.path=/dev/null to workaround this - lightbend/reactive-cli#197
You can also put the following in build.sbt to make the working directory writable:

import com.typesafe.sbt.packager.docker.DockerChmodType
dockerChmodType := DockerChmodType.UserGroupWriteExecute

@olivierlemasle
Copy link
Contributor Author

@eed3si9n Using reactive-cli 1.7.0:

$ rp version
rp (Reactive CLI) 1.7.0
jq support: Available

As I wrote in the original message, you can reproduce the issue with the simple steps of https://developer.lightbend.com/docs/lightbend-orchestration/current/getting-started/sbt-play-minikube.html.

In this case, lightbend/reactive-cli#197 does not fix the issue because AkkaClusterBootstrapping is not enabled, so -Dplay.server.pidfile.path=/dev/null is not added.

I've also tried your workaround (using DockerChmodType.UserGroupWriteExecute) but it does not seem to work. I suppose it's sbt/sbt-native-packager#1198:

When I log into the container:

bash-4.4$ whoami 
whoami: unknown uid 1001

eed3si9n added a commit to lightbend/reactive-cli that referenced this issue Feb 11, 2019
Ref lightbend/sbt-reactive-app#177

#197 added `-Dplay.server.pidfile.path=/dev/null`, but only when Akka Clustering was enabled. This adds that for all cases.
@eed3si9n
Copy link
Contributor

Hopefully this is now fixed with updates to rp (lightbend/reactive-cli#201) and sbt-reactive-app.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants