[2.0] When deployed on Ubuntu 10.04 cant detach from console

938 views
Skip to first unread message

Thomas Felix

unread,
May 4, 2012, 4:37:16 AM5/4/12
to play-fr...@googlegroups.com
Hi everyone,

yesterday I tried to deploy my app in production mode on a Ubuntu 10.04 vServer box. I have problems with compiling it on my vServer because of memory issues. Sometimes it works, sometimes it fails, so my approach is to do a

play clean compile dist

on my Windows machine and put the resulting .zip on the server. There I try to invoke the start script like the docs said. Everything fine so far. But the doc says:

"If you type Ctrl+D, the Play console will quit, but the created server process will continue running in background."

This does not work for me, I see the console output of the play server and pressing Ctrl+D does nothing. Ctrl+C actually kills the whole server. I am using Putty on Windows to ssh to this machine. Could this be the problem? My solution so far was to type Ctrl+Z to suspend the foreground job und put it in the background with bg command. Is this the right solution (if so, why its not in the doc? :D)?

Oh and in case you are interested what I have done with the framework: www.university-bash.org ;) Next thing I try is the i18n feature and a translation to german.

best regards!
Thomas

GrailsDeveloper

unread,
May 4, 2012, 5:08:43 AM5/4/12
to play-fr...@googlegroups.com
Have you tried Ctrl-D and Enter?

Allen

unread,
May 4, 2012, 5:18:51 AM5/4/12
to play-fr...@googlegroups.com
in your app directory, you have first to enter "play".
Then you will reach the play console mode.

It is different from the "console" or shell of your server.

Then you can use "start" to start the app.
After that you are be able to push CTRL+D to detach.

Here in the docs its described including a screenshot.

Best,
Allen


Am Freitag, 4. Mai 2012 10:37:16 UTC+2 schrieb Thomas Felix:

Thomas Felix

unread,
May 4, 2012, 5:45:25 AM5/4/12
to play-fr...@googlegroups.com
@Allen: Well yeah but as I stated I dont compile on my server because of the lack of memory so you will see that play clean COMPILE fails. ;) Doing it with play clean dist will create a .ZIP file with no need to install the play framework on the server so I dont have the play command aviable ^^ All work is done via a auto generated start shell script which does not what is stated in the same doc you posted but a few paragraphs above, "using the start command".

@GrailDev: I try this with enter.

Thomas Felix

unread,
May 4, 2012, 5:51:59 AM5/4/12
to play-fr...@googlegroups.com
No does not work with Ctrl + D followed by enter, it simply gives me a new line like in the screenshot attached. The process still stays in the foreground.
server-shell.png

Allen

unread,
May 4, 2012, 6:08:58 AM5/4/12
to play-fr...@googlegroups.com
oh, sorry, I did overseen this with the console.

As you directly on the command line of the server, the CTRL+D will not work. Also you cannot put the process in background by starting with an "&" at the end of the line, because the job will die if you do a logout. Working with nohup etc. is not recommended.

I would try to make a init.d script, this way also after a server reboot the app comes automatically up.

Best,
Allen

Thomas Felix

unread,
May 4, 2012, 7:56:28 AM5/4/12
to play-fr...@googlegroups.com
Thank you, I think somewhere in the mailing group saw a init script anyways, I dont have much experience in shell scripting but I will read and try something out. =)

Have a nice day

biesior

unread,
May 4, 2012, 8:09:56 AM5/4/12
to play-fr...@googlegroups.com
I'm using this command to start manually unziped dist on Debian:

nohup /home/someuser/play20apps/some-app-1.0-SNAPSHOT/start -Dport=34567 -Xms64m -Xmx128m

after that you can just close terminal's window and Play will be still working (do not use CTRL+C cause you will kill the app's process!).

to stop the app login again (or in new window) and use two commands:

cd /home/someuser/play20apps/some-app-1.0-SNAPSHOT/
kill `cat RUNNING_PID`

Leon Radley

unread,
May 4, 2012, 2:24:27 PM5/4/12
to play-fr...@googlegroups.com
I started work on a Ubuntu upstart script. I havent had the time to test it yet. But it's based on another one of my gists for v 1.2.4 which works great.

Give it a go and see if it works.

https://gist.github.com/2204773

Leon Radley

unread,
May 7, 2012, 8:08:35 AM5/7/12
to play-fr...@googlegroups.com
I've finally come around to deploying my first play2 app and did some work on the play2 upstart script. it now works great!

I've updated the gist!

biesior

unread,
May 7, 2012, 8:15:41 AM5/7/12
to play-fr...@googlegroups.com
Thx :)

Ian Lawrence

unread,
May 7, 2012, 8:27:23 AM5/7/12
to play-fr...@googlegroups.com
Hi

sudo apt-get install screen

"Screen is a full-screen window manager that multiplexes a physical
terminal between several processes, typically interactive shells. "

http://www.gnu.org/software/screen/

Regards


--
http://ianlawrence.info

Ben McCann

unread,
May 7, 2012, 8:17:17 PM5/7/12
to play-fr...@googlegroups.com, irlaw...@googlemail.com
I've been using supervisor.

Thomas Felix

unread,
May 9, 2012, 9:10:50 AM5/9/12
to play-fr...@googlegroups.com
Yeah I just tested it on my vServer, its working for me! Nice work. I have modified it slightly to use my standalone version since I dont compile on the server but deploy play with play dist from my workstation. The gist is https://gist.github.com/2643660 ;) many thanks!

Leon Radley

unread,
May 9, 2012, 10:19:28 AM5/9/12
to play-fr...@googlegroups.com
Awesome!

Some new developments.

I've been testing using https://github.com/mislav/git-deploy to do a heroku style git push deploy, and it's working great.

Though there where some problems. First sbt takes a whooooole lot of memory the default is 1.5gb of it. So I had to push that down a bit.
And the second hurdle was to be able to start and stop the service without beeing root I had to allow sudo to work with start and stop

by adding this to the /etc/sudoers file

myuser ALL=(ALL) NOPASSWD: /sbin/start play, /sbin/stop play

and in the deploy/before_restart script i have

#!/usr/bin/env bash
sudo stop play

and in the deploy/restart script
#!/usr/bin/env bash
sudo start play

git-deploy is still in it's infancy and they are talking about making the script synchronous instead of async so that you can get the log output of the sbt task.. we'll see what happens there.

I like the simplicity of using git as a deployment strategy, but it doesn't feel like your using it right... somewhat like using a screwdriver as a hammer.

Instead I'd like to build something like fabric or capistrano for sbt.

I'll see what I can come up with :) 

Jeroen Rosenberg

unread,
May 14, 2012, 8:49:44 AM5/14/12
to play-fr...@googlegroups.com, irlaw...@googlemail.com
Hi Ben,

I've tried supervisor for controlling my play2 app's lifecycle, since I'm also using capistrano for deployment. It's working fine for starting my app, but it's not able to stop it properly (although supervisor thinks it is). Is it working for you and if so how did you manage? Thnx in advance.

Best,

J

Ben McCann

unread,
May 14, 2012, 11:16:38 AM5/14/12
to play-fr...@googlegroups.com
Hi Jeroen,

Stopping works just fine for me.  I do "supervisorctl stop myproject".  I'm using supervisor 3.0a8-1.1 on Ubuntu 12.04.

-Ben


--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/OkEcIT1EytUJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Reply all
Reply to author
Forward
0 new messages