-
Notifications
You must be signed in to change notification settings - Fork 443
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
pid file creation as non-root #164
Comments
huh, so who was creating the pid file? It was there previously? |
Actually I have no idea. I just stumbled on this right now and will have a closer look hopefully this week. |
Strange, I upgraded to 0.7.0-M3 on Friday and haven't seen anything similar. @muuki88 Are you using Upstart or SystemV? |
@muuki88 Are you using play project? |
I'm hoping this is migration problem or the way I start the app with |
No, play server trying to create pid file from started application and you specify pidfile.path point to file that doesn't writeable for your appUser. I think that pid file should be created by start up system, systemV or upstart instead of application itself. val pidFile = Option(System.getProperty("pidfile.path")).map(new File(_)).getOrElse(new File(applicationPath.getAbsolutePath, "RUNNING_PID")) |
@kardapoltsev is correct about Play generating the pidfile. It is worth noting Upstart does away with the need for a PID file, it's only the SystemV script that needs it. |
Nice! Thanks for the research. So in fact we have a problem, when every side has too much intelligence
|
If both the application and the startup system create PID's they might not be in the same location and then you can have problems recovering from a crash. Is it worth making We then can leave Upstart requiring a little extra configuration by the user. |
I think Upstart is fine as a default. The error occurs because I changed the default behaviour. In my case a |
This is closed with #176 For play look at the Production Configuration page. Add -Dpidfile.path=/var/run/${{app_name}}/play.pid |
I don't understand what to do . |
If you using play application you should go to /etc/default/$app_name after installation and uncomment line
|
the goal of native packaging is to NOT modify files after installation, isn't it? obviously we can imagine to use puppet do deploy packages and modify config files after installation but the ideal would be to be well configured just with package installation. |
Alternatively you could provide your own template for /etc/default as suggested above. |
This is exactly what the |
thx a lot! sorry for noob questions :D I succeed in what i wanted to do thanks to your answers. 2014-05-22 10:49 GMT+02:00 Muki [email protected]:
|
There are no noob questions, only bad documentation ;) |
simple question: where is the pid when using JavaAppPackaging? |
Simple answer: nowhere. PIDs are only generated when you use the server archetype. The JavaAppPackaging type online provides start scripts. |
@muuki88 i don't think pid is only needed by server archetype. |
I have to generate the pid myself at application runtime for the JavaAppPackaging. |
I think this is out of scope for the I recommend using the server archetype as you get all these facilities for free. You can start/stop your application with a simple
this is exactly what the system-loader infrastructure of your linux system are there for. |
@muuki88 thank you,I know that with the server archetype would be good,and the problem currently is that ,we need restart the server and then redeploy it sometime,so we just go straight with the I have only one question.with the Once I confirm this ,I will try to convert our current script to the |
@hepin1989 +1 @muuki88 thanks. Indeed we need JavaAppPackaging providing pid and stopping script. |
@hepin1989
Yes. You just replace E.g.
No, but the server archetype is exactly the solution to your problem. The start script is intended to be executed by a application system that manages these applications, e.g.
If you don't install on the package level, then the
SBT Native Packager will never provide facilities to manage applications on your system, because we support such a variety of systems that it's hard enough to make things work with existing things. I highly recommend you to use onboard facilities for application life-cycle management (systemd, systemv, upstart). |
@muuki88 thanks,I means is it easily for me to upgrade a app only via |
Yes :) |
In our company, docker is not recommended. Most of applications are managed by tomcat or other web container. For breaking away from tomcat, i choose scala, netty and Play. anyway, u cant't give someone only one way or bind someone to other framework tightly. so, pid and stop script maybe choosed by use optionally. |
I think there are a few points you are confusing. I try to explain things in more detail so you get a better feeling of what I mean when I say "sbt native packager will not provide an application lifecycle management". JavaAppPackaging and JavaServerAppPackaging
You see that this features have only one purpose: managing application lifecycle on a server.
With
You can still package Implement a stop scriptFurthermore, what does it mean to implement a
all with bash/bat foo which heavily relies on your OS you are running on. You can not "not care" about your OS you are running your stuff on. Providing a stop script means implementing an application lifecycle management. It is hard enough to keep
If you use the I hope you get the point that |
@muuki88 Thank for your detail reply with patience. |
@shijinkui you're welcome :) This is really an important topic as this about the scope of sbt-native-packager.
You can use Still. I highly recommend against a custom application life cycle management. |
@shijinkui you could use scala at taobao?I don't think so . |
@hepin1989 Yeah, play creates it's own PID which makes things a little tricky sometimes. If you use play you are already using the server archetype. Play enables it by default. However you have to configure the PID location |
@hepin1989 My last scala project use play framework with the pid. Current working have no need to use it again. Play also have to much dependencies, and depend on special netty version. I work in aliyun. @muuki88 i tried that tricky way. Thanks. If plugin can generate pid by default, it will be more clean for developer. 👍 |
@shijinkui hem,you could using scala:).would you mind join our akka group(257534530) and play group(128259394) at qq? I think you could package the stop script to the package just as Play does. |
@shijinkui you need a PID if need to manage the application lifecycle (start-stop-status-restart). See my last comment above how to add these stuff in I will close the discussion here as
|
I just upgrade a project from 0.7.0-M1 to 0.7.0-M3, which means the default
appUser
is nownormalizedName
.First of all I had to
chown -R myapp:myapp /usr/share/myapp
I tried to start the app with
sudo service myapp start
which fails with errorPossible solution
I looked inside the directory and found that every non-root pid file was inside a folder which is owned by the user. So creating
/var/run/myapp
as the "pid-folder" seems a already used solution.The text was updated successfully, but these errors were encountered: