Liza Shakury
Liza Shakury

Reputation: 738

Play change RUNNING_PID file path

I am trying to store the RUNNING_PID file at /var/run instead of root directory. Tried all the options suggested at: Another SO question about the subject

and the solution play suggest in their documnetation: Play additional configuration

Yet when I start my app the RUNNING_PID file is created in root directory and the /var/run/play.pid remains empty

Upvotes: 4

Views: 2903

Answers (3)

Mayur Chavan
Mayur Chavan

Reputation: 1051

Below worked for me in Play 2.8 (🍾🍾):

Add this property to you application.conf present in conf directory:

play.server.pidfile.path=/var/run/RUNNING_PID

Note: It will try to create a file under /var/run and if you don't want/have the right to write to the filesystem i.e you are running your application in Kubernetes (1.20) pod change it to /dev/null.

play.server.pidfile.path=/dev/null

Hope this helps, Cheers (🍾🍾).

Upvotes: 1

Charles Foster
Charles Foster

Reputation: 338

Create a "play" user and group in Linux, so it runs in a secure fashion.

In the SystemD service file, and within [Service] area use:

[Service]

# Create the Directory /var/run/play (which Play will have write permissions to)
RuntimeDirectory=play
RuntimeDirectoryMode=0710

User=play
Group=play

In the ExecStart, specifically pass the system property "pidfile.path":

ExecStart=/opt/play-1.0.0/bin/play -Dconfig.file=/path/to/my/application.conf \
                                   -Dpidfile.path=/var/run/play/play.pid

Upvotes: 1

mkurz
mkurz

Reputation: 2826

Put

play.server.pidfile.path=/var/run/RUNNING_PID

in your application.conf

Upvotes: 4

Related Questions