/srv/irclogs.ubuntu.com/2016/06/03/#upstart.txt

=== m1dnight1 is now known as m1dnight_
=== m1dnight1 is now known as m1dnight_
=== Trevinho_ is now known as Trevinho
=== lfaraone_ is now known as lfaraone
=== m1dnight1 is now known as m1dnight_
=== JanC is now known as Guest27710
=== JanC_ is now known as JanC
flafHi @all. In fact, this is not a bug of upstart above but a bug of "mountall" used by upstart to mount filesystems in fstab. I have made a bug report here: https://bugs.launchpad.net/ubuntu/+source/mountall/+bug/158859412:19
frewif I wanted to set an envvar for all services (as opposed to having to put env FOO=1 in each one) is there a way to do that?16:53
chrasnot without implementing it yourself in some form, like doing an environment file that you source, or passing or when you run initctl start $job KEY=VAL16:55
frewok.16:55
frewoh well.16:55
frewwould be nice16:55
chrasbut there isnt like a global default environment thing16:56
frewright.16:56
chrasthat aim aware of16:56
AnrDaemonfrew: Can you tell us, why you want to do that?16:56
frewsure16:56
frewwe want our services use /mnt/tmp instead of /tmp16:56
frewsetting TMPDIR to that is sufficient16:56
AnrDaemonFail.16:56
frewbut doing that in every unit sucks16:56
AnrDaemonMount /tmp where you want it, problem solved.16:56
chraswell16:57
frewhave you done this before AnrDaemon?16:57
AnrDaemonhttp://refspecs.linuxfoundation.org/fhs.shtml16:57
frewbecause some early boot stuff uses tmp16:57
AnrDaemonNothing critical, to my knowledge.16:57
frewso you haven't done it then.16:57
frew"Fail."16:58
frew:P16:58
AnrDaemonAnd if it uses /tmp before / is mounted, well, what can i say?16:58
chrasfrew: is it your desire to have your TMPDIR be somewhere other then temp, for everything?16:58
frewchras: well, of course it gets worse16:58
chraslike i would be cautious about doing that16:58
frewchras: I was wanting it to be somemthing some units would opt out of16:58
chrasi think its a little safer / cleaner to just set your TMPDIR per application/service16:59
frewso like, ssh I'd manually set TMPDIR back to /tmp16:59
frewyeah16:59
frewfor sure safer16:59
AnrDaemonOvercomplication. Maintenance headache.16:59
frewa non-trivial amount of things need tmp to be on the same partition as root16:59
chraslike simply from the stance of creating unexpected behaviour16:59
frewso those would need it to be the regular /tmp16:59
frewchras: sure.16:59
chrasone option you could do is17:00
chrasyou could have one event which spawns the other ones with initctl start ${otherjob} TMPDIR=${new_temp_dir}17:00
chrasshould work with emit too17:00
frewyeah I considered exactly that17:00
AnrDaemonfrew: What I see from here is that you're solving problem with wrong tools. If you want isolation, get LXC or Docker, or what else suits your needs.17:00
frewsounds a little rube goldberg-y for this kind of thing17:00
chrasiirc initctl emit start_all_my_junk TMPDIR=${tmpdir}17:00
chrasshould work 17:00
frewright17:00
frewyeah maybe17:00
chrasadn then all your other things can just start on start_all_my_junk17:00
frewright.17:00
frewchras: thanks; I'll look into doing that17:01
chraspersonally, i just source /etc/event.functions to get my common functions/environment/etc17:01
frewthat's a good idea.17:01
frewI should just make a thing all of our stuff uses17:01
chrasand my source file also includes in /etc/event.functions.d/*17:01
chrasso if you need to add in extra variables in a new package/service/whatever17:01
AnrDaemonExcept sourcing anything is not an option. You can't set-env if a job runs with setuid.17:01
chrasit can be added without modifying existing things17:01
frewAnrDaemon: ...what are you talking about?17:02
chrasAnrDaemon: why not?17:02
AnrDaemonWhy not what? Why it doesn't work? I don't know.17:03
frewugh17:03
AnrDaemon+ initctl set-env USER=php-fpm17:03
AnrDaemoninitctl: Unable to connect to system bus: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory17:03
frewAnrDaemon: he means source in the script.17:03
AnrDaemonSourcing is not an option. You have to set these variables to the job to exec your service.17:04
frewwhatever dude17:04
AnrDaemonElse upstart will not track the right PID, or get stuck if you try and use "expect fork/daemon".17:05
frewscript\n. $to_source\nexec foo\nend script # <-- look; it works ma17:05
chrasAnrDaemon: i only ever do stuff with foreground processes, so thats not a concern for me17:06
frewsame.17:06
frewforking is for chumps17:06
AnrDaemonThat' swhat I've tried to do last week.17:06
AnrDaemonSpawning per-user FCGI daemons without using master running as root.17:07
chrasbut yes, it would be nice if set-env worked for all of upstart, and not just user/session jobs17:07
AnrDaemonexec /usr/sbin/php5-fpm --fpm-config="/etc/user-fcgi/$USER.conf" --pid="/run/$USER/php-fpm.pid" $INIFILE -d open_basedir="$HOME" --nodaemonize17:08
frewchras: I think if I *really* wanted to make that work, I could tell the kernel to add en env var17:08
frewchras: but I'm not gonna reboot ;)17:08
chrasright17:08
AnrDaemonAnd every variable I need to set in instance pre-start.17:08
frewthough upstart might clear the env, which is reasonable17:08
AnrDaemonIt does.17:08
chrasvariables set in pre-start wont appear in other contexes17:09
chrasonly in pre-stat17:09
AnrDaemonchras: man initctl | grep -A7 set-env17:09
frewAnrDaemon: if you want to get env vars, you have to use script like I was saying.17:09
frew(from a file)17:09
chrasAnrDaemon: yes, if you read the docs it says specificly, that set-env is ONLY for session / user jobs17:09
AnrDaemonAnd upstart will track wrong PID.17:09
chrasNOT jobs managed by upstart pid=117:09
AnrDaemonNice suggestion, dude, I TOLD YOU that's not an option.17:10
frewgracious17:10
chrasAnrDaemon: with all honesty, you need to chill out on the attitude a little17:10
AnrDaemonset-env works if job is run as root.17:10
AnrDaemon(Which counts as user job, from upstart POV)17:10
chraswell i'll test this17:11
AnrDaemonI love upstart. I really do. But these caveats is what driving the bar down.17:11
frewchras: btw not sure if you are the right person to mention this to, but the link to the upstart revision control here (http://upstart.ubuntu.com/development.html) is broken.17:12
AnrDaemonIt was broken for years since announcement that Debin switched to systemd.17:12
AnrDaemonDebian anyway.17:12
frewI think it just needs to be ~upstart-devel instead of ~scott17:13
chrasfrew: im just a user17:14
chrastrying to help other people out17:14
frewgotcha17:14
chrasso they dont have to drown in systemd17:14
frewhah17:14
AnrDaemonSpeaking of which. May be it isn't new for you, but I just recently found https://wiki.ubuntu.com/SystemdForUpstartUsers17:15
chras[t] 17:15:22 root@t-nfs04a:/etc/event.d# initctl set-env TEST2=chris17:15
chrasinitctl: Not permissible to modify PID 1 job environment17:15
AnrDaemonOf course not.17:15
AnrDaemonBut try it in a single job.17:16
chrasthat means set-env isnt really an option17:16
AnrDaemonYou can change the JOB's environment.17:16
AnrDaemonIn pre-start.17:16
AnrDaemonAnd then straightforward exec using these altered variables.17:16
AnrDaemonInstead of bugus scripting.17:17
chrasthats just as much bogus scription17:17
AnrDaemonBut then upstart will track the PID of the service itself.17:17
chrashes looking for an alternative to doing an env=SOMETHING , and you're suggesting doing an env=SOMETHING in essense17:17
AnrDaemonWith no guesswork.17:17
AnrDaemonAs I said, he's doing the right thing in a wrong way.17:17
AnrDaemonIf he want isolation, he should use isolation tools.17:18
frewAnrDaemon: I don't think I ever said I wanted isolation.17:33
AnrDaemonNo, you didn't. But your description clearly pointed to your intentions.17:34
freweh, strain at the tea leaves if you want.17:34
frew/mnt/tmp is a sep physical disk17:35
AnrDaemonEven better.17:35
chraswell, arguably tmpspace by design is supposed to be volatile17:35
frewyeah, on my laptop I set TMPDIR to /run/shm17:35
AnrDaemonI'm running a container that mounting 3 BTRFS subvols directly, that aren't mounted at all on host.17:36
frewbut ofc if somethign wrote a 30G file there things would go poorly.17:36
chrasright17:36
AnrDaemonApplications that write 30Gb temps usually have configuration for scratch space.17:36
chrasyeah, that type of thing, especially if it needs to be persistant, should be outside of system tmp most likely17:37
frewchras: yeah I'm thinking of giant crash file type things17:41
django000Hello everyone, I am trying to write my first configuration file, but I can't figure out what runlevel means?22:16
django000Could anyone help me please?22:16
django000Thanks22:16
AnrDaemonNothing, you shouldn't use runlevels.22:17
django000AnrDaemon: most of the examples I find online have runlevels, I am just curious about its meaning, thanks for helping out22:19
AnrDaemonIt's an anciet initd concept.22:20
AnrDaemonYou can easily google the full documentation. But you SHOULD NOT use runlevels. Unless you actually know what you are doing.22:20
AnrDaemonIf it is a sinmple system service, "start on filesystem" should be enough. If it uses network, "start on filesystem and net-device-up IFACE != lo" would suffice majority of cases.22:21
AnrDaemonDetails are in the channel title's link.22:22
django000I just want to run a python script on the background, It should be running all the time. I did some research and found out about upstart22:23
AnrDaemonOh, and if your service uses forking to drop privileges, you better teach it to forget this bullshit and use setuid/setgid in the script itself instead.22:23
django000so yeah, I have just basic understanding for now22:23
django000reading the manual :)22:24
AnrDaemonThen it's rather straightforward.22:24
AnrDaemonLiterally, no more than 5 lines of code to start a service.22:24
AnrDaemon2 of them being informational :D22:24
django000:), uff I wish I know the other 3 lines to complete my 522:25
django000But I am still curious, sorry22:26
django000so I think I will continue with my search22:26
AnrDaemondjango000: Just a moment.22:29
AnrDaemondjango000: http://pastebin.com/uqSdZZME22:33
AnrDaemonHowever, if you want it to run as non-root, that's going to be a little more work on the details.22:35

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