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

Trying to Deploy the debian package on Ubuntu AMI #673

Closed
allnash opened this issue Sep 23, 2015 · 5 comments
Closed

Trying to Deploy the debian package on Ubuntu AMI #673

allnash opened this issue Sep 23, 2015 · 5 comments

Comments

@allnash
Copy link

allnash commented Sep 23, 2015

sudo tail -f /var/log/upstart/<app_name>.log

Oops, cannot start the server.
java.io.FileNotFoundException: /usr/share/app_name/RUNNING_PID (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)
at play.core.server.ProdServerStart$.createPidFile(ProdServerStart.scala:131)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:45)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:27)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Oops, cannot start the server.
java.io.FileNotFoundException: /usr/share/app_name/RUNNING_PID (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)
at play.core.server.ProdServerStart$.createPidFile(ProdServerStart.scala:131)
at play.core.server.ProdServerStart$.start(ProdServerStart.scala:45)
at play.core.server.ProdServerStart$.main(ProdServerStart.scala:27)
at play.core.server.ProdServerStart.main(ProdServerStart.scala)

When I check in terminal
$id <app_name>
uid=999(app_name) gid=999(app_name) groups=999(app_name)

What is the issue it seems like the ustart script does this at the End
exec sudo -u <app_name> bin/<app_name>

Am I missing something?

@Daxten
Copy link

Daxten commented Nov 3, 2015

I have a quite similar problem, it seems that play 2.4.3 packaging is not working atm.
it uses sudo -u {appname} ./bin/{appname} in the upstart script (/etc/init/{appname}.conf, but never creates the user {appname} for me, because of that there are permission problems (for me with writing to h2 database file)
delete the -u {appname} part (the app runs as root then) and it is fixed.

I think this is a bug in sbt-native-packager

@muuki88
Copy link
Contributor

muuki88 commented Nov 3, 2015

You have to configure the pid file for play. Otherwise play will try to create one in the executing directory, which is /usr/share/<packageName> where only root as write access (which is correct).

See the docs how to configure this. Also mentioned on the how to deploy#native-packager docs at the playframework.

@muuki88 muuki88 closed this as completed Nov 3, 2015
@muuki88
Copy link
Contributor

muuki88 commented Nov 3, 2015

@Daxten running your app as root is never a good idea. Your app can basically compromise your complete system.

@Daxten
Copy link

Daxten commented Nov 3, 2015

sure, but that doesn't fix the issue that the user doesn't exist and my app can't write to the database file :)

@muuki88
Copy link
Contributor

muuki88 commented Nov 3, 2015

The JavaServerAppPackaging does create the user in the postinstall routine. How do you setup/install your AMI/app

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

No branches or pull requests

3 participants