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

Janus + RabbitMQ #455

Closed
stormbkk87 opened this issue Feb 2, 2016 · 8 comments
Closed

Janus + RabbitMQ #455

stormbkk87 opened this issue Feb 2, 2016 · 8 comments

Comments

@stormbkk87
Copy link
Contributor

When using Janus in an Upstart script on Ubuntu 14.04 LTS, Janus always starts before RabbitMQ on reboot. This will produce a socket error in the Janus log. Here's a proposed update to the Janus Upstart script for those having the same issue. I also added 'expect fork'. Seemed appropriate as per the documentation for Upstart. Any issues?

description "janus"

start on rabbitmq-server-running
stop on rabbitmq-server-stopped

limit nofile 50000 50000
limit core unlimited unlimited

expect fork
respawn
respawn limit 10 5

exec /opt/janus/bin/janus
@ploxiln
Copy link
Contributor

ploxiln commented Feb 2, 2016

janus does not fork unless you use the --daemon option. it's better to not fork if the thing starting/supervising janus supports non-forking processes.

@lminiero
Copy link
Member

lminiero commented Feb 2, 2016

If the problem is that daemonizing the application returns before checking if everything started, PR #443 should help fix that. As a side note, why reboot the RabbitMQ server? We use it in some deployments and always just restart Janus there.

@stormbkk87
Copy link
Contributor Author

No problems. Just disaster recovery checklist. If the server itself must be restarted for whatever reason, then the Janus instance isn't reconnecting to RabbitMQ when it comes back up due to the differences between RabbitMQ startup (sysvinit) and Janus startup (upstart).

I rewrote the upstart script you have on your FAQs to support waiting for RabbitMQ to start. RabbitMQ emits "rabbitmq-server-running" and "rabbitmq-server-stopped".

Just thought it would be helpful for others who experienced the same. And to make sure I didn't introduce any other side effects.

@lminiero
Copy link
Member

lminiero commented Feb 2, 2016

Thanks for the clarification! Anyway, I don't think we need to add that to the example as many Janus deployments do not use RabbitMQ. I can add these considerations to the docs, though, e.g., as an example of how you can wait for an event before moving to starting Janus.

@lminiero
Copy link
Member

lminiero commented Feb 2, 2016

Just updated the docs to reflect that: https://janus.conf.meetecho.com/docs/service
Do you think this is enough feedback for Upstart users?

@lminiero
Copy link
Member

lminiero commented Feb 2, 2016

PS: I haven't mentioned the fork thing as per Pierce's feedback.

@stormbkk87
Copy link
Contributor Author

I think it's enough. Plenty of help on Google regarding upstart. Took a bit of digging to find that RabbitMQ already emits the required events to hook into. Will save someone an hour of trying less elegant solutions. ;)

@ploxiln In my janus.cfg I have "daemonize = true" and have the log file set. Wouldn't that allow janus to fork?

@lminiero
Copy link
Member

lminiero commented Feb 2, 2016

Cool, closing then! The documentation links to this issue here so any interested user can add.

@lminiero lminiero closed this as completed Feb 2, 2016
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

3 participants