/srv/irclogs.ubuntu.com/2011/10/14/#upstart.txt

bradleyayersworkhi02:52
bradleyayersworkI'd like to know the difference between "user jobs" and "system jobs"02:53
bradleyayersworkis it just having a .init in home directory?02:54
bradleyayersworkalso, is it possible upgrade upstart on ubuntu 10.04?03:08
vaxerdecyou could always pull trunk and build it.  or the release version, 1.303:32
bradleyayersworkand is there any documentation around user jobs?03:43
vaxerdeci dont know if the cookbook contains it.  but it seems to be shaping up quite nicely03:47
vaxerdeci would not be surprised if they had documented it there03:48
vaxerdecbased on the sounds of it, just allowed users to make event triggers over dbus.  i don't know how they write the files to /etc/init03:49
vaxerdecperhaps, they just write them in memory somehow into the dbus and it handles that on their behalf? this is just wild speculation.03:50
vaxerdeci know dbus has some security models which allow it to broker access to privileged stuff.  no idea how they are using it... i am strong advocate of ripping out anything with the word "dbus" in it and throwing it in the garbage :)03:51
vaxerdeci'm trying to figure out a way to get all /etc/init/*.conf from whatever serves as ubuntu trunk.  if you have a suggestion, please let me know...03:55
bradleyayersworki want to use upstart to manage web app processes, and user jobs "sound" like what i want, but it isn't documented :(04:03
bradleyayersworkthe only mention is "As such, all system job configuration files must live in or below /etc/init (although user jobs can live in other locations)." 04:04
bradleyayersworkvaxerdec: as in, you just want to download the job files?04:05
bradleyayersworkah the man page has some stuff 04:06
bradleyayerswork" Any user can create user jobs, but that user can control only jobs they create."04:07
bradleyayersworkbut what if i made something that just hooked the 'starting' event and blocked, causing it to never start04:08
vaxerdecyes.  04:08
bradleyayersworkthat is concerning04:08
bradleyayersworki suppose that's just a messy problem to get around04:09
vaxerdeci am using fedora and their upstarts are just a half-aborted attempt before they switched to systemd (yuck), they never ported to native upstart.  ubuntu apparently claims they have ported the majority of their init scripts to native upstart.  so, i want to use those as a conversion base for my own efforts (I am using upstat with Fedora, because I hate systemd)04:10
vaxerdecyeah, well, even though they can schedule, i don't think they wil be escalating their privilges04:11
vaxerdecit probably lets you specify a filename or directory then somehow.  and/or forces you to use your home dir04:12
bradleyayersworki just meant having "start on starting shutdown; script while 1 end script" etc04:15
vaxerdecright but where do you put those? in a file. where do you put that?04:17
bradleyayersworkin ~/.init/04:18
bradleyayersworkhttp://manpages.ubuntu.com/manpages/oneiric/man5/init.5.html04:18
vaxerdecclearly they don't set the sticky bit on /etc/init and call it a day :) although they may as well since it sounds from the "any user can..." that it's already DoS prone... but perhaps they rate limit.04:18
bradleyayersworksearch "User jobs"04:18
bradleyayersworkthere's a section04:18
vaxerdecah.  yes, the home dir then.  but, it might just take an arbitrary path.04:18
vaxerdeci don't have the manual page.  i don't access to any ubuntu systems.04:19
vaxerdeci will be sure to grab that though when i get those others from the scm repo04:19
vaxerdecalong with that other one that lists those pseudo-events04:19
vaxerdecwhat is it? i forget.  something.704:19
vaxerdecsomething-else.704:20
vaxerdecit's just a table with all those virtual events like network-started04:20
vaxerdecoh, you gave me a URL :)04:21
vaxerdecah yes, upstart-events.704:22
vaxerdecwait... there is no longer a "console syslog" ? only "owner" and "output?"04:25
bradleyayersworki don't know much about console04:25
vaxerdecahhh they have a udev bridge now04:26
bradleyayersworkyou seem to know more about this than me :P04:27
vaxerdeci'm not sure i like it though... threatens to mix purposes.  i am wary that it will come out looking like systemd, please no :)04:28
vaxerdecit's always tempting to roll other stuff in to your project.  just look what happened to that poor lennart fellow... he sold himself to the devil, clearly.04:29
vaxerdecat least it's "only" a bridge.  but that encourages more use of dbus which i think is just all bad in this layer.04:29
bradleyayersworki'm not even familiar with d-bus, so i can't really comment :/04:30
vaxerdecit's just an ipc bus designed for the desktop/gui/crap layer that some people (like redhat and systemd fools) will try to move lower in the stack and have everyone relying on their superfluous crap.04:31
vaxerdeci mean, not as a business tactic... just some arrogant developers who think they understand the One True Way but clearly haven't been using unix very long or, if so, learned about its philosophy...04:32
vaxerdecwait... does udev repeat the events over dbus? or are they getting them over netlink or something?04:36
vaxerdecwow, just reading over some of these changes since 0.6... this has come a long way.  these guys are doing wonderful job with this.04:39
vaxerdecdocumentation is getting fleshed out nicely too.04:40
bradleyayersworkupstart >0.6 changes you mean?04:41
vaxerdeceh? yeah.  i mean since version 0.6.  they are at 1.3 now for the release track.04:41
bradleyayersworkyeah04:41
bradleyayersworkubuntu 10.04 has 0.6 :(04:42
vaxerdecgo to 10.1004:42
vaxerdecnot sure what version they have, probably 1.204:42
vaxerdeceven my fedora system has 1.2 :)04:42
vaxerdecand they abandoned upstart.04:42
vaxerdecthe fools.04:42
vaxerdecwell, i take that back.  it's still in RHEL04:42
bradleyayersworkreally? in favour of what?04:42
vaxerdecsystemd!04:42
bradleyayerswork:O04:43
vaxerdecthe thing i have been talking about04:43
bradleyayersworkyup04:43
bradleyayersworki made a bunch of changes to the upstart cookbook that i need to submit04:43
vaxerdecit's WAY overscoped04:43
vaxerdecwhat's the source language?04:43
bradleyayersworkrestructuredtext04:44
vaxerdecoh sweet04:44
vaxerdeci love it04:44
vaxerdeci use it for everything04:44
vaxerdeci just start started making trees and building it all with sphinx04:45
vaxerdecfor all my docs at work04:45
bradleyayersworkah yeah04:45
bradleyayersworki use it for my projects too04:45
bradleyayersworki wish it was more like markdown04:45
vaxerdecit's so nice and terminal friendly :)04:45
vaxerdeceh04:45
vaxerdecserious?04:45
bradleyayersworkin some ways, sure04:45
bradleyayersworklike single ` rather than double04:46
vaxerdeclike what? what's the top hting you miss from markdown04:46
vaxerdecyeah that gets tiresome04:46
vaxerdeci just use editor macros04:46
bradleyayersworkand remembering how to make URLs04:46
vaxerdecoh right04:46
vaxerdeceveryone has issues with that04:46
vaxerdeci usually just have the quickref up04:46
bradleyayersworki basically have to look at reference every time04:46
vaxerdec:)04:46
bradleyayersworki also don't like having to have a new line before a list04:47
vaxerdecgets even harder with sphinx you have to do stuff for cross references and likewise... they have like a hundred of their own '.. ' directives04:47
bradleyayerswork:ref: is good though04:48
vaxerdecoh yes, that is my biggest complaint with it04:48
vaxerdecany change in indentation and you need to put a space04:48
bradleyayersworkyeah :/04:48
vaxerdecand you know what... it handles it with #. just fine04:48
bradleyayersworkthe whole infrastructure/design of it is good04:48
bradleyayersworkbut the syntax is annoying 04:49
bradleyayersworkwhich is a shame04:49
vaxerdecyeah that part is dumb.  i read a discussion on it and they said like they'd have to rewrite the entire parser or something to make that work04:49
vaxerdecwhat part of the syntax is annoying?04:49
bradleyayersworkjust the things we've been talking about04:49
vaxerdecmmm04:49
bradleyayersworkhyperlinks, ``awef``, lists04:50
vaxerdectables can be irritating04:50
bradleyayersworkyeah04:50
vaxerdecif they're not just simple.  everything has to line up04:50
bradleyayersworkyep04:50
vaxerdeci'm using some package from drchip to do it automatically though, or just started to anyways.  looks promising.04:50
vaxerdecyeah they are at 0.81 now i think04:50
bradleyayersworki just find stack overflow's language memorable04:51
vaxerdeci keep reading the release notes to see if they fixed those04:51
vaxerdecnobody seems to care about those issues and i am definitely no python guru04:51
bradleyayersworki am quite the python guru04:52
vaxerdecoh really04:52
vaxerdecfix it!04:52
vaxerdeci took a look once...04:52
vaxerdecit's all mixed up with block quoting (the list issue)04:52
vaxerdecbut you know... 04:52
bradleyayersworkit seems like it'd be difficult to get accepted for political/backwards compatible reasons04:52
vaxerdecif your output is html you can just give a list style04:52
vaxerdecnah you just make it a command line switch.  they have so many already.04:53
bradleyayersworktrue04:53
vaxerdecbut then the code would have to work both ways, which is even more challenging :)04:53
bradleyayersworkyeah :(04:53
vaxerdeci mean it's just such an obvious thing though.  i am always dismayed that their core team doesn't mind that.04:54
vaxerdeci think they just set style on their output.  i think the default style is totally ugly actually04:54
vaxerdecfor both latex and html04:54
vaxerdecit actually makes pretty good man pages though04:55
bradleyayersworkyeah04:55
bradleyayersworkoh yeah? i haven't seen man page output04:55
vaxerdecoh it's nice.  at least it looks nice in my colorized pinfo terminal :)04:56
vaxerdecrst2man04:56
vaxerdecactually the simple tables aren't so bad04:57
vaxerdecjust look at your man page for the upstart stuff... it's probably made by that if you say the web page is04:57
vaxerdeci wonder if they figured out what to do with init.conf yet05:00
vaxerdecdo you know where the name 'upstart' came from?05:01
bradleyayersworknope05:03
vaxerdecoh boy looks like i gotta figure out bzr to do this05:03
bradleyayersworkgood luck :)05:06
bradleyayersworki'm off05:06
vaxerdeclater05:07
TJ__im a bit lost in all upstart versions at the moment; i have a job that is depending on some IFACE br0 to come alive. According to docs, upstart needs the upstart-udev-bridge to make this work. On the development ubuntu 11.04 system i have this bridge binary. On the system im building we use debian packages instead of ubuntu packages, and this debian package does not have the bridge, so the job isnt started....08:21
TJ__does anyone have any idea how to fix this ?08:21
TJ__btw the start condition for the job is : start on net-device-up IFACE=br008:22
jhuntbridge interfaces are handled by ifup on Ubuntu. See file /etc/network/if-up.d/upstart which runs, "initctl emit -n net-device-up IFACE=br0..."08:25
jhuntthe upstart-events man page explains this, although I appreciate it is pretty terse :)08:25
TJ__ah.08:27
TJ__i see08:27
TJ__on the embedded system we have, we do have the /etc/network/if-up.d directory, but in there, there is no upstart file...08:28
TJ__so if i create this file we should be done08:28
TJ__working ! thanks jhunt 08:37
jhuntTJ__: great! :)08:45
TJ__how does it work on a debian system then ? the package we install does not have a upstart-udev-bridge binary so its not used there as well ?08:47
jhuntTJ__: the version of upstart in debian is very old. This needs to be rectified.08:50
TJ__aah... ok....   but then still... in my ubuntu development pc, we have the latest and greatest upstart provided by ubuntu, it has the upstart-udev-bridge, but still the if-up.d scripts are used... any specific reason why ?08:51
TJ__or is this just something on ubuntu's todo list ? 08:53
bradleyayersso I've written a user job, and I assume i wouldn't need to use sudo with initctl (if i do, it  says unknown job)10:11
bradleyayers$ start my-test-job 10:12
bradleyayersstart: Rejected send message, 1 matched rules; type="method_call", sender=":1.27" (uid=1000 pid=1480 comm="start my-test-job ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")10:12
bradleyayersthis is on ubuntu 11.1010:12
jhuntjobs are run as root, so you need to be root to start them :)10:13
bradleyayersdoesn't that contradict the point of user jobs?10:14
bradleyayersthe man-page suggests users can control only their jobs10:14
bradleyayersor am I just missing something :S10:15
jhuntsorry - didn't notice that you were using user jobs. User jobs are not enabled by default in ubuntu, even 11.10. Looks like the man page is reflecting the upstream version of upstart. We need to fix that.10:18
bradleyayersi've been making some edits to the cookbook, by editting the restructuredtext source10:19
bradleyayerswhat's the best way for me to get the changes to you?10:20
bradleyayersjust a bug ticket?10:20
jhuntIf you want to enable user jobs, you'll need to modify /etc/dbus-1/system.d/Upstart.conf so it looks like the upstream version: http://bazaar.launchpad.net/~upstart-devel/upstart/trunk/view/head:/dbus/Upstart.conf10:21
jhuntbradleyayers: please raise bugs as specified in the cookbook itself (https://bugs.launchpad.net/upstart-cookbook/+filebug)10:21
bradleyayersand i'll just attach a patch?10:22
jhuntthat would be fine10:22
bradleyayersgreat10:22
bradleyayersthanks for the upstart.conf tip :)10:23
jhuntnp - thanks for pointing out the man page issue :)10:24
bradleyayersand user jobs aren't really mentioned at all in cookbook either :(10:25
bradleyayerswhat stops someone from writing a job that just hooks into some "starting" event, and then does a sleep 10000 etc.?10:26
bradleyayers(task job)10:26
vaxerdecbradleyayers: to what end? you mean to disrupt the operation of the system?10:29
bradleyayersyes, to just denial of service10:29
bradleyayers(inadvertantly or maliciously)10:30
vaxerdecperhaps they haven't worked out those details yet, which is why it's not in the released version10:30
vaxerdecthere must be permissions checking...10:31
vaxerdecmight want to check out the code to find out10:31
vaxerdecis there really a need for user events?10:32
bradleyayersthis isn't user events though10:33
bradleyayersit's user jobs hooking global events10:33
vaxerdeceh? what did you mean then?10:33
vaxerdecright...10:33
vaxerdeci guess that's what i meant10:33
vaxerdeci meant, users interacting with the events in some way10:33
bradleyayerswell my use-case is having a script that i want to run when a database is running10:34
bradleyayersand when the database is shutting down, my script should shut down10:34
vaxerdecbut you can't connect to the database?10:34
vaxerdecyou could run inotifywatch on the pidfile10:35
bradleyayersill have a look at inotifywatch10:35
vaxerdecactually i'm not sure you can anonymously monitor that10:36
vaxerdec.10:36
vaxerdeci mean you could poll with stat() of course in the rundir but that's silly10:36
bradleyayersyeah10:36
bradleyayersthere'll always be some manual scripting approach to check conditions etc10:37
vaxerdecis there some reason you can't just maintain a connection to the database?10:37
vaxerdecit'll probably dump you with a particular exit code even10:37
bradleyayersbut i liked the way upstart handles this type of problem with events10:38
vaxerdecseems like the wrong mechanism to me10:41
vaxerdecmaybe you could subscribe to the event and it could broadcast them10:42
vaxerdeci really have no idea what restrictions the dbus interface imposes10:42
vaxerdecof course i'd just advocate a unix domain socket access by a client library in client's address space.  or possibly, arrange to be signalled.10:43
vaxerdecthis stuff is too fancy though.  should rely on helpers for all this... not build into init.10:45
vaxerdeci mean, it's arguable10:45
vaxerdecbut pretty soon you guys are going to be putting tcp into the thing and doing notifications over the network10:46
vaxerdecwhich actually sounds somewhat interesting if it weren't so dirty to be doing that in PID1.10:47
vaxerdeci think perhaps it would be best to stick to current model where init has a specific role: to start, stop and reap processes only.  it's already spawning processes... why not have user-notify.conf which defines some other programs to do this stuff10:49
bradleyayershmm, you raise some interesting points10:52
bradleyayersi think i do agree that user jobs are outside the responsibility of init10:53
vaxerdeckitchen sink approach is tempting, but time has taught us that the unix way of trying to do only one thing is a superior model10:53
vaxerdecthis is exactly the problem with systemd although they are much worse and make no attempt to even limit the wreckage10:54
vaxerdecshit why not stuff it all in the kernel and call it a day ;)10:55
vaxerdecthat will be next... modprobe systemd.ko10:56
vaxerdecor maybe they will call it lennart.ko10:57
vaxerdecnow one thing i think is an excellent idea is the use of cgroups10:57
bradleyayersi hear if you put it in the kernel it's fast10:59
vaxerdeci would say the cgroups should go in a cgroupd but then you're just calling cgroupd and moving all the spawn logic from init to cgropud, which probably serves no purpose11:00
vaxerdecunless you could somehow hand off...11:01
vaxerdeccgroups are extremely powerful isolation and control mechanisms.11:04
vaxerdeccome to think of it, you could do that in pam11:04
vaxerdecalready pam does much/all of resource allocations and limit imposition11:07
vaxerdechm.  can upstart just start arbitrary services and have all requirements for that service come up, automatically and recursively? 11:26
vaxerdec(no matter what state those other services were in)11:45
bradleyayerswell the dependencies might not all be for some things to be started11:45
vaxerdeci'm not sure that it can... perhaps this is one argument for real dependencies.  once you had those the rest could be derived.11:46
bradleyayersif there's other jobs that have hooked the 'starting' event of the thing you're starting, then they'll be started11:46
vaxerdeci have to read more about changes they have made.  i think with earlier codebases perhaps this would have been difficult to know deterministically.11:48
vaxerdecsomething else... the "it forked twice" or "it forked three times and i lost track" problem: couldn't that be solved by using netlink? i.e. via "proc connector" ?11:50
vaxerdecoh hah.  i'm reading a post about it by one Scott James Remnant :) guess they are one step ahead! 11:52
vaxerdecbradleyayers: is it mysql or postgres?11:53
bradleyayerspostgres11:53
vaxerdec(assuming it is relational)11:53
bradleyayersbut… my usecase was a lie11:53
bradleyayers(sort of)11:53
vaxerdecbradleyayers: you could use notify(7)11:53
bradleyayersi have a background worker for a web site that depends on postgresql and rabbitmq11:54
vaxerdeci have just looked at zeromq, it looks quite lean.11:54
vaxerdecnow that's an ipc i wouldn't mind using.  but not in init :)11:56
=== JanC_ is now known as JanC

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