anth0ny | I'm trying to run my script as a user ("ubuntu", on AWS) but get "unable to find setuid user" in my syslog | 21:48 |
---|---|---|
anth0ny | any ideas? i'm definitely running as ubuntu | 21:49 |
anth0ny | moreso, there's definitely a user named ubuntu | 21:49 |
anth0ny | blah, disregard, needed to reload configuration | 21:52 |
AnrDaemon | :D | 21:59 |
SteenJobs | is anyone here? | 23:16 |
AnrDaemon | No. Everyone's there. | 23:22 |
SteenJobs | haha | 23:26 |
SteenJobs | i’ve been struggling for almost two days with an upstart issue, ran into the notorious stop/killed bug, etc. | 23:26 |
SteenJobs | and i need to get this working - trying to write an Upstart script for God (the ruby monitoring library, not the Almighty) | 23:27 |
AnrDaemon | pastebin your progress. | 23:27 |
SteenJobs | AnrDaemon: if you have a minute, i’ll gist the script | 23:27 |
SteenJobs | ahhhh you’re the best | 23:27 |
SteenJobs | thank you thank you. being the only dev at the company right now is no easy task ): | 23:28 |
SteenJobs | AnrDaemon: 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 |
SteenJobs | error. | 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 |
AnrDaemon | Your problem is that you're doing too much in exec. | 23:30 |
AnrDaemon | 1. Remove respawn, expect. | 23:31 |
AnrDaemon | 2. Write all preparations in pre-start. | 23:31 |
AnrDaemon | Is your script intended to run as root? | 23:31 |
SteenJobs | AnrDaemon: what about placing it inside a script block? | 23:31 |
SteenJobs | and yea - only bec this is the staging server | 23:31 |
SteenJobs | on production it’s not root | 23:31 |
AnrDaemon | Then don't run it as root. | 23:32 |
SteenJobs | this is on staging | 23:32 |
AnrDaemon | Don't use script/end script, if you can avoid it. | 23:32 |
SteenJobs | ah ok | 23:32 |
SteenJobs | cause that didn’t work either, also stopped immediately | 23:32 |
AnrDaemon | Doesn't matter. It's much easier to get it working right straight away. | 23:32 |
SteenJobs | running as root bec everything is pretty much run as root on staging | 23:32 |
SteenJobs | including the location of the app | 23:32 |
AnrDaemon | -D - is that "daemonize" ? | 23:32 |
SteenJobs | and the permissions | 23:33 |
SteenJobs | yessir/maam | 23:33 |
AnrDaemon | Remove it. | 23:33 |
SteenJobs | no | 23:33 |
SteenJobs | sorry | 23:33 |
SteenJobs | opposit | 23:33 |
AnrDaemon | Ok-ok. | 23:33 |
SteenJobs | it’s to run in foreground | 23:33 |
AnrDaemon | Then that one is right. | 23:33 |
SteenJobs | and wouldn’t removing respawn defeat the purpose of making sure God is always running? | 23:33 |
SteenJobs | end goal being kill -9 god should result in the process being restarted | 23:33 |
AnrDaemon | Removing respawn will prevent it respawning endlessly with bad job config. | 23:36 |
AnrDaemon | Don't add anything like that, until you know you have right syntax and the job generally works. | 23:36 |
AnrDaemon | Hold a moment, I'll have smth for you to try. | 23:36 |
SteenJobs | you are a righteous man my friend | 23:37 |
AnrDaemon | https://gist.github.com/jesiegel1/2ba88ccff85001f3be57c2e2debca893#gistcomment-1832245 | 23:39 |
AnrDaemon | Always use absolute paths in init scripts. | 23:39 |
AnrDaemon | Unless you 100% know what you are doing. | 23:40 |
SteenJobs | ah ok cool. good to know. im fairly new to it, although i’ve crammed well, bec the dev in charge of production quit | 23:40 |
SteenJobs | gimme a sec, gonna plug it in now | 23:40 |
SteenJobs | i need to cd because of running “bundle exec" | 23:40 |
SteenJobs | although that’s a lie, i can supply the path for rvm/bundler for it to run | 23:41 |
AnrDaemon | chdir | 23:41 |
AnrDaemon | Seriosuly, check the cookbook. | 23:41 |
SteenJobs | yea, i’ll read thru it | 23:42 |
SteenJobs | i saw you added that, which is why i brought it up | 23:42 |
SteenJobs | k trying now | 23:42 |
AnrDaemon | chdir will change directory before invoking every part of script. | 23:43 |
AnrDaemon | pre-start, exec, post-start, pre-stop, stop, post-stop… | 23:43 |
SteenJobs | very 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 now | 23:45 |
AnrDaemon | And check /var/log/upstart/yourjob.log for any clues if it would not start like that. | 23:45 |
SteenJobs | yep, that’s what i was doing about 10 minutes ago, finally found it ha | 23:45 |
AnrDaemon | Here I can't help you, sorry. Not familiar with railcraft. | 23:46 |
SteenJobs | haha | 23:46 |
SteenJobs | i think i found it - gonna try now | 23:46 |
SteenJobs | what’s your jam? do you do web dev? | 23:46 |
AnrDaemon | I'm using PHP for web. But mainly I do IT support and a little devops. | 23:47 |
SteenJobs | nice | 23:51 |
SteenJobs | i’m getting job failed to start - nothing in the logs | 23:51 |
AnrDaemon | That means it either didn't find anything to exec, or there was a very bad initial config. | 23:52 |
SteenJobs | wouldn’t it log that though? | 23:52 |
AnrDaemon | Keep 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 |
AnrDaemon | It may, but not into job log. And you'd have to run upstart with higher verbosity, probably. | 23:53 |
AnrDaemon | Sorry, if I'm guessing much, my attempts are normally more successful :) At least, I get something in the log. | 23:54 |
AnrDaemon | If you failing badly to even get your app to start in the job, try this: | 23:55 |
AnrDaemon | exec /bin/sh -c 'set' | 23:55 |
AnrDaemon | Get the environment from the log, and use /usr/bin/env to run your app with a copy of the job's environment. | 23:56 |
SteenJobs | when you added env RAILS_ENV=staging, what does that do exactly? | 23:59 |
SteenJobs | eh i can just check the docs | 23:59 |
Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!