Reputation:
I am trying to run two instances of the same Play application in order to transparently upgrade the application in the future.
When I launch the first instance, everything goes fine obviously. When I launch the start 9525
command to launch the second instance of the application on port 9525, I get the following error:
Play server process ID is 8909
This application is already running (Or delete .../RUNNING_PID file)
Any idea how to work around this?
Upvotes: 4
Views: 2841
Reputation: 55798
This Play's doc already describes using of Apache for 'transparent upgrading'. In general you need to start two instances in two separate folders
At the beginning:
dist
package inside your folder with apps sourcesinstance1
instance1
on desired port for an example 9998
it will be your every-day instanceAfter changes, when you want to redeploy app transpalently:
dist
and unzip it to other folder ie. instance2
9999
instance1
instance2
to instance1
instance1
and stop application on instance2
Of course creating simple shell script which will perform all steps at once will be great helper for you.
TIP:
To avoid often re-deployment, especially when you need just to replace/modify some public and static contents like CSS or images, you can also use Apache common vhost
for handling these resources. Just create a vhost
for some folder as a subdomain ie. http://static.domain.tld
or better with separate domain: http://my-cdn.tld
so you can use a path like:
<img src="http://static.domain.tld/images/photo.png" alt="" />
instead of
<img src="/public/images/photo.png" alt="" />
The benefits:
And finally, from my experience, nginx is faster than Apache. So if only task for HTTP server in your case is load-balancing the Play's apps, consider using nginx it's just lighter.
Upvotes: 5