/srv/irclogs.ubuntu.com/2012/11/26/#upstart.txt

=== Md_ is now known as Md
fission6i just wrote my first upstart script for uwsgi, how cna i test it?15:54
SpamapSfission6: put it in /etc/init/uwsgi.conf and run 'sudo start uwsgi'16:01
SpamapSfission6: you can also do 'init-checkconf uwsgi'16:02
fission6thanks SpamapS 16:02
fission6'init-checkconf uwsgi' complains there is no file16:02
fission6do i need to do 'init-checkconf uwsgi.conf'16:03
SpamapSfission6: yeah, may even want to do /etc/init/uwsgi.conf16:05
fission6yea i just tried that, ERROR: failed to ask Upstart to check conf file16:06
fission6SpamapS: http://dpaste.org/NuSvR/16:10
SpamapSfission6: I've not used init-checkconf much.. so forgive me for not knowing how to address that :-P16:10
fission6hmm maybe someone else knows, seems like it would be fundemental issue16:18
fission6SpamapS: how do you check if your upstart script works then?16:23
SpamapSfission6: start it16:27
SpamapSfission6: errors will show up in syslog16:27
fission6nice thnaks16:29
fission6am i going to get burnt if i upgrade from 1.3 to 1.418:16
fission6is symlinking from etc/init/ to a folder iwth a conf a bad idea?19:32
=== chris|| is now known as chris|
fission6can you symblink to a upstart from /etc/init20:04
SpamapSfission6: no20:19
SpamapSfission6: for a number of reasons, the files need to be there, on the root disk, in /etc/init20:19
=== jMCg_ is now known as jMCg
fission6ok20:33
fission6any ideas why restart for my job doesn;t work but start and stop do20:55
SpamapSfission6: the upstart restart command is.. a little weird21:09
SpamapSfission6: if you use 'service foo restart', that should do a stop/start21:10
fission6really?21:18
fission6whats up with that, let me try21:18
fission6did not work21:20
fission6i find htis weird, would have though it just does a stop start, which both work21:20
SpamapSfission6: it does, but it does it really fast, and without running post-stop21:26
SpamapSor pre-stop, I forget21:26
SpamapSfission6: anyway, its possible you need a post-stop which makes sure your service is dead21:26
fission6?21:34
fission6seems odd 21:34
fission6and convoluted21:34
fission6SpamapS: can you start multiple processes with a single conf?22:29
SpamapSfission6: yes, through use of the instance keyword22:52
fission6i want to be clear SpamapS i want to start two seperate daemons, one to start a queueing peice and one for uwsgi 22:56
SpamapSfission6: ah, make that two .confs then22:58
SpamapSfission6: one can be 'start on started x' and 'stop on stopping x' so they'll act as one.22:58
SpamapSfission6: though IMO, its better to have things de-coupled unless they absolutely must be coupled22:59
fission6hm22:59
fission6i'd prefer a master script to start up the queying celeryd process then uwsgi web app process22:59
fission6i'd prefer one conf23:00
SpamapShow are they related? sounds like they aren't.23:01
fission6SpamapS: ^23:01
fission6welll one wouldn't run without the other23:01
fission6celery does all the tasks associated with the web app uwsgi, such as email sending23:01
SpamapSyou can have 1 conf, but you'll have to use pidfiles and daemonize things yourself23:02
fission6so you can't have multiple 'exec' or multiple script stanzas?23:03
SpamapSfission6: 2 confs has some real advantages. For instance, when the uwsgi segfaults, respawn can start it back up again.. it doesn't have to then stop celery, then start them both... which is more complicated and error prone23:03
fission6so maybe 2 scripts and 1 maste script to start each on of them?23:05
JanCupstart .conf files aren't scripts, they are configuration files  ☺23:07
JanCif one of the two processes depends on the other, then you define such a dependency in the configuration of those jobs, otherwise you just start them in parallel...23:08
fission6so it sounds like what i am doing shouldn't be done in one sript23:09
fission6err conf file23:09
JanCmost likely not23:10
fission6JanC: do you work with web apps by chance and Upstart confs, whats the nature of most of the confs23:10
ee99eeHi, I'm having a problem where this script is hanging after "start myapp": http://pastebin.com/nXSd79yP23:10
ee99eewhen I run the command (minus "exec" of course) manually, it starts up just fine, so I know the command is at least correct23:11
ee99eeI've tried expect in all 3 modes, and it doesn't affect it in any way23:11
ee99eesuggestions?23:11
JanCfission6: I currently don't really work with webapps that need their own upstart jobs, no23:11
ee99eeis there a way to mayb debug that it's even getting to that point?23:14
ee99eeor see what's going on at all?23:14
ee99eebecause "start myapp" just goes to a new line and hangs23:14
fission6maybe look into syslog23:15
JanCyou can enable logging (in recent upstart versions)23:15
JanCper-job logging actually23:16
ee99eehmm23:16
JanClogging for upstart itself can also be enabled with a kernel parameter or using initctl23:16
JanCoh, and I think when using start-stop-daemon, yous certainly don't want to use expect fork/daemon23:18
ee99eeI tried commenting it out too23:18
JanCwell, you probably don't want to use the --background option for start-stop-daemon23:20
ee99eeok let me try that23:20
ee99eesame thing23:21
JanCas the manpage says, you should use that only in a last resort  ☺23:21
ee99eeyeah :-/23:21
fission6why is exec used in script stanza?23:22
ee99eeinstead of script stanza, you mean?23:22
JanCthe 1st respawn line is also obsolete of course23:24
ee99eeahh, thanks23:25
JanCyou might also want to check the logs of the application23:26
ee99eethe application isn't even being started... I looked, but there isn't even a process for the app in the process list23:27
fission6why do they use exec with two differnt meanings23:27
JanCfission6: eh?23:27
fission6exec in a script stanza and exec outside ofi t or does it do the same thing23:27
ee99eeI think it does the same thing23:28
JanCexec inside a script does not have anything to do with upstart23:28
fission6right. why do "we" use it then to kick off the main daemon your are upstarting23:28
JanCit does whatever your shell does with the exec command23:28
fission6right, so do i need it in an upstart script, seems its used as a standard but i dont see what it does23:29
fission6also still unclear why i cant run multiple things in a conf23:29
JanCyou can run multiple things from one conf23:31
JanCbut it won't supervise them separately then23:31
fission6JanC: one other issue i have is i cn cleanly start and stop my service but i can not restart it, it stops but doesn't restart23:32
JanCas SpamapS said, that probably means it tries to restart it too quickly23:33
fission6ok. so what does that mean in terms of resolving it, seems like an odd issue23:33
JanCif you use start-stop-daemon, it offers some ways to deal with that23:34
fission6this whole thing is becoming such a tangled mess just to get uwsgi to restart when my ec2 reboots23:34
ee99eefission6: I feel your pain23:34
ee99eeJanC: do you have an example of a start-stop-daemon implmentation23:35
JanCor otherwise you might need some custom pre-stop or post-stop script or so23:35
fission6yea sort of odd was hoping upstart was a bit cleaner, looks like supervisord is a bit easier23:36
JanCfission6: I find upstart rather easy to understand, it's usually more work to understand how the applications that it needs to start/stop/etc. work  ;)23:43
fission6well when it starts before something stops its a bit retarded, especially when its managing the process23:44
JanCyes/no23:45
JanCit's difficult to tell when an application starts & stops, or to be more exact: when it stopped "enough" that you can (re)start it  ☺23:46
SpamapSfission6: IMO, you are coupling things that don't need to be coupled23:46
SpamapSfission6: just start celery and the webapp service on their own. They'll talk if they can.23:47
SpamapSfission6: this will make it easier to split out the two into dedicated services later on anyway23:47
JanCwell, unless the webapp really needs celery, then you make it wait on celery...23:47
JanCin both cases, you want 2 jobs23:48
fission6thats fine, i agree on tht front23:49
fission6i dont like how i can not currently restart uwsgi when before i got into upstart i woudl jsut stop adn start the process via control - c in a screen window23:49
fission6can we focus on why restart isn't working, maybe getting thatin place will make me happy23:50
fission6this is my uwsgi.conf to be clear http://dpaste.org/w1FBw/23:51
fission6SpamapS: JanC could this be why http://projects.unbit.it/uwsgi/wiki/Upstart read the --die-on-term section23:53
SpamapSfission6: is your uwsgi service printing errors? I bet its trying to LISTEN on a taken port because the OS hasn't given back the socket yet.23:54
fission6nah23:55
fission6By default sending SIGTERM to uWSGI would mean "brutally-reload-it", while normally apps tend to shutdown on SIGTERM. To shutdown uWSGI use SIGINT or SIGQUIT. If you cannot live with such setup you can use --die-on-term option.23:55
fission6this could be it23:55
JanCthat might indeed be the reason23:56
SpamapSwow, what an abuse of SIGTERM23:56
JanC23:57
SpamapSTERM is for *TERMINATING* not reloading23:57
JanCwell, depends on how uwsgi works23:57
fission6my guess is its problem the reason since i only see --die-on-term mentioned in the upstart docs http://projects.unbit.it/uwsgi/wiki/Upstart23:57
SpamapSa process that doesn't exit very soon after SIGTERM is going to get a SIGKILL soon after from some overzealous BOFH23:57
JanCmaybe it has a master process that automatically restarts child processes that get terminated or the like23:57
SpamapSfission6: yes you want --die-on-term23:57
SpamapSand you should send a really nasty email to the uwsgi authors explaining how dumb this is23:58
SpamapSwe have HUP for reloads... anything further, use USR123:58
SpamapSfission6: you can also use 'kill signal QUIT' I think23:58
SpamapSsort of 6 and 1/2 dozen at that point23:59
SpamapSugh, and it also doesn't realize that Upstart has had socket activation since 10.0423:59
fission6when you say "we have"23:59

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!