/srv/irclogs.ubuntu.com/2016/07/22/#upstart.txt

anth0nyI'm trying to run my script as a user ("ubuntu", on AWS) but get "unable to find setuid user" in my syslog21:48
anth0nyany ideas? i'm definitely running as ubuntu21:49
anth0nymoreso, there's definitely a user named ubuntu21:49
anth0nyblah, disregard, needed to reload configuration21:52
AnrDaemon:D21:59
SteenJobsis anyone here?23:16
AnrDaemonNo. Everyone's there.23:22
SteenJobshaha23:26
SteenJobsi’ve been struggling for almost two days with an upstart issue, ran into the notorious stop/killed bug, etc.23:26
SteenJobsand i need to get this working - trying to write an Upstart script for God (the ruby monitoring library, not the Almighty)23:27
AnrDaemonpastebin your progress.23:27
SteenJobsAnrDaemon: if you have a minute, i’ll gist the script23:27
SteenJobsahhhh you’re the best23:27
SteenJobsthank you thank you. being the only dev at the company right now is no easy task ):23:28
SteenJobsAnrDaemon: https://gist.github.com/jesiegel1/2ba88ccff85001f3be57c2e2debca893 - i’ve tried multiple iterations of the gisted file - i’ve tried both the approach of using expect fork, and the approach of running god not-daemonized.  with the former, running god status within my project dir doesn’t seem to match/recognize the running process from the upstart script, and with the latter, the service stops immediately after starting,23:30
SteenJobserror.23:30
SteenJobs(also the exec echo bit was st i only tried a second ago, in a desperate attempt, so you can ignore that)23:30
AnrDaemonYour problem is that you're doing too much in exec.23:30
AnrDaemon1. Remove respawn, expect.23:31
AnrDaemon2. Write all preparations in pre-start.23:31
AnrDaemonIs your script intended to run as root?23:31
SteenJobsAnrDaemon: what about placing it inside a script block?23:31
SteenJobsand yea - only bec this is the staging server23:31
SteenJobson production it’s not root23:31
AnrDaemonThen don't run it as root.23:32
SteenJobsthis is on staging23:32
AnrDaemonDon't use script/end script, if you can avoid it.23:32
SteenJobsah ok23:32
SteenJobscause that didn’t work either, also stopped immediately23:32
AnrDaemonDoesn't matter. It's much easier to get it working right straight away.23:32
SteenJobsrunning as root bec everything is pretty much run as root on staging23:32
SteenJobsincluding the location of the app23:32
AnrDaemon-D - is that "daemonize" ?23:32
SteenJobsand the permissions23:33
SteenJobsyessir/maam23:33
AnrDaemonRemove it.23:33
SteenJobsno23:33
SteenJobssorry23:33
SteenJobsopposit23:33
AnrDaemonOk-ok.23:33
SteenJobsit’s to run in foreground23:33
AnrDaemonThen that one is right.23:33
SteenJobsand wouldn’t removing respawn defeat the purpose of making sure God is always running?23:33
SteenJobsend goal being kill -9 god should result in the process being restarted23:33
AnrDaemonRemoving respawn will prevent it respawning endlessly with bad job config.23:36
AnrDaemonDon't add anything like that, until you know you have right syntax and the job generally works.23:36
AnrDaemonHold a moment, I'll have smth for you to try.23:36
SteenJobsyou are a righteous man my friend23:37
AnrDaemonhttps://gist.github.com/jesiegel1/2ba88ccff85001f3be57c2e2debca893#gistcomment-183224523:39
AnrDaemonAlways use absolute paths in init scripts.23:39
AnrDaemonUnless you 100% know what you are doing.23:40
SteenJobsah ok cool. good to know. im fairly new to it, although i’ve crammed well, bec the dev in charge of production quit23:40
SteenJobsgimme a sec, gonna plug it in now23:40
SteenJobsi need to cd because of running “bundle exec"23:40
SteenJobsalthough that’s a lie, i can supply the path for rvm/bundler for it to run23:41
AnrDaemonchdir23:41
AnrDaemonSeriosuly, check the cookbook.23:41
SteenJobsyea, i’ll read thru it23:42
SteenJobsi saw you added that, which is why i brought it up23:42
SteenJobsk trying now23:42
AnrDaemonchdir will change directory before invoking every part of script.23:43
AnrDaemonpre-start, exec, post-start, pre-stop, stop, post-stop…23:43
SteenJobsvery cool - only thing i’m not sure what to plug in is the bundle exec part - i use capistrano for deployment, and in my custom task i run /usr/local/rvm/bin/rvm default do bundle exec, so i’m not quite sure what the path is for bundle. trying to figure that out now23:45
AnrDaemonAnd check /var/log/upstart/yourjob.log for any clues if it would not start like that.23:45
SteenJobsyep, that’s what i was doing about 10 minutes ago, finally found it ha23:45
AnrDaemonHere I can't help you, sorry. Not familiar with railcraft.23:46
SteenJobshaha23:46
SteenJobsi think i found it - gonna try now23:46
SteenJobswhat’s your jam? do you do web dev?23:46
AnrDaemonI'm using PHP for web. But mainly I do IT support and a little devops.23:47
SteenJobsnice23:51
SteenJobsi’m getting job failed to start - nothing in the logs23:51
AnrDaemonThat means it either didn't find anything to exec, or there was a very bad initial config.23:52
SteenJobswouldn’t it log that though?23:52
AnrDaemonKeep in ming, jobs start with nearly empty environemnt, and no HOME/USER defined. If you need them you gotta defien them by hands.23:53
AnrDaemonIt may, but not into job log. And you'd have to run upstart with higher verbosity, probably.23:53
AnrDaemonSorry, if I'm guessing much, my attempts are normally more successful :) At least, I get something in the log.23:54
AnrDaemonIf you failing badly to even get your app to start in the job, try this:23:55
AnrDaemonexec /bin/sh -c 'set'23:55
AnrDaemonGet the environment from the log, and use /usr/bin/env to run your app with a copy of the job's environment.23:56
SteenJobswhen you added env RAILS_ENV=staging, what does that do exactly?23:59
SteenJobseh i can just check the docs23:59

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