-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add daemon option for Linux #16
Comments
Thanks @geerlingguy I'm not sure this is really appropriate, but I'm happy to be disagreed with. I personally think this is outside the responsibility of the application layer, and supporting a daemonised mode complicates the application code (forking, monitoring forked processes, etc) Is there any reason something like upstart, systemd, etc wouldn't work for you? Or if you don't have root access, something like websysd or an alternative might be suitable? (p.s., I'm not sure MailHog has ever had a daemon option, but M3MTA did!) |
Mines started with supervisord, daemon would definately be a init.d scripts not in MailHog |
Looking into it further, I do agree that adding daemonization inside mailhog is probably not the most efficient solution. I went ahead and built an init script to daemonize mailhog for my needs, as part of an Ansible role for MailHog. |
@ian-kent - Maybe, as an alternative, could you at least point out a preferred way to have people run it as a daemon? It seems like it would be a common use case if people want to use MailHog inside a development VM or something. |
Thanks for the init script and Ansible role @geerlingguy. I'll add a deployment guide linking to them. I don't really have a preferred way, it depends which OS you're using and what works best for you. I think giving some examples (like your init scripts) of how it could be deployed would be better. It can also be deployed on Elastic Beanstalk (using the example Dockerfile), and should work pretty well on the free tier EC2 instances for limited development work. |
There's also some overlap with #10 - that (at a quick glance) seemed fairly unobtrusive... if it can be integrated without causing issues, perhaps that could be a quick solution to daemonising it under linux/windows/mac? |
Yeah, #10 seems like it would cover this well; I guess the issue title threw me off, since it was only mentioning 'Windows' :) |
I'm not sure how portable #10 would really be... it looks portable, but upstart etc support in linux varies a lot (e.g. compare RHEL with Ubuntu!) - at least for Windows its fairly consistent between major OS releases! |
hah, and then you have systemd in CentOS 7 and Debian 8!! |
Actually thinking about it again, maybe we include an /etc/ directory |
Just updated the readme and added a deployment guide, let me know if there's anything I've missed! |
Good idea @pedromorgan! I'll reopen it, PRs welcome if anyone has any examples! |
Cool, I'll stick in the supervisord config + nginx example .. weekend time as travelling atmo |
I'll close this now, but any init script contributions are still welcome 👍 |
Here's the
See: https://github.com/geerlingguy/ansible-role-mailhog/blob/master/templates/mailhog.unit.j2 |
I followed this guide to set up the service in Ubuntu 16. Here are the steps:
|
Without a daemon option, I cannot check the exit code of MailHog. If I background it myself, I have to wait a little while then run a health check to know if it is okay. |
It would be nice to be able to run mailhog as a daemon in Linux. I think the original MailHog had a
-daemon
option or something like that, but for the current version, the only way to run it in the background is to use nohup or pipe things somehow.The text was updated successfully, but these errors were encountered: