Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot and API do not work simultaneously #1

Open
travislikestocode opened this issue Feb 11, 2010 · 3 comments
Open

Bot and API do not work simultaneously #1

travislikestocode opened this issue Feb 11, 2010 · 3 comments

Comments

@travislikestocode
Copy link

I'm trying to get PaaS to work, I installed all of the required gems on my Debian box. The bot works great by itself, and the API runs great by itself too. However when I run ./bot.rb -a -p xxxx, the bot is totally nonfunctional. I get no error messages, it just doesn't work. Nothing happens when I change my presence or message the bot. I can't figure out why, but I took a couple captures of the debug output for each command you can look at:

http://www.pastie.org/820406 - working - ruby -d bot.rb
http://www.pastie.org/820408 - not working ruby -d bot.rb -a -p 8080

I also just noticed that if I hit control c on the second command, it kills the webserver and the bot starts working again.

I'd really appreciate it if you would take a look and let me know if there's anything I can do to fix it. Here's a paste of my myconfig.rb -http://www.pastie.org/820432
Another thing - bot doesn't pick up status messages for 'unavailable' presence messages - in case you weren't aware.

Running debian 5

@zh
Copy link
Owner

zh commented Feb 14, 2010

There is something strange with your gem installation - why there are so many messages about missing gems (including some Win32-related once).
But in general - you can run the bot and the API independent.

  • the bot is EventMachine-based daemon. To run just the bot, do not use -a option. So the run command will be: ruby bot.rb . You can use screen to put the daemon in background.
  • the API is sinatra based. To start it: rackup -p [some port] from the PaaS directory (the one with config.ru file)

And I'm not sure if you authorized the bot itself, because it's getting 'unavailable' presences for me - take a look on http://status.zhware.net/
Running the bot and the API separated will maybe tell you more about missing or not installed correctly gems.

@travislikestocode
Copy link
Author

Ok I got it to work now using ./bot & and then running rackup -p 8080. When I do ./bot and ./api -p 8080, the bot works but sinatra 404s. So now I only have 2 things:

What's the best way to get both the bot and the API to run at system startup? I want to use PAAS as an always on daemon.

I should have been more specific. When you send a status message with an unavailable stanza, paas bot doesn't log the status message, but it does show that you're unavailable. All other presence types will show a status message except unavailable.

@zh
Copy link
Owner

zh commented Feb 15, 2010

On my system I'm using PaaS, started with: ruby ./bot -a -p xxxx inside screen.
There is nothing daemon related in the current implementation, so maybe your -d option is not very suitable.
For running like a daemon on startup, you can use DJB daemontools ( http://cr.yp.to/daemontools.html ) or if you are on ubuntu - /etc/event.d/ script .
For the unavailable stanzas: i'm not doing some special processing for them, so if there is no status message - it's XMPP ruby implementation specific. Maybe use XA stanzas - they have message for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants