amethyst icon indicating copy to clipboard operation
amethyst copied to clipboard

Daemonizing\Forking

Open bararchy opened this issue 10 years ago • 5 comments

We need to add some option to "run in the background".

we can use fork

fork do
  app.serve
end

or some internal design to this this thing.

bararchy avatar Jul 06 '15 12:07 bararchy

Why do we need this ?

sdogruyol avatar Jul 06 '15 15:07 sdogruyol

Because unlike rails (Ruby), you cannot install a Crystal addon into apache or nginx , which means that you can only use Crystal's HTTP::Server , this in turn means that we need an option to start our programs as a service in the background without the need to relay upon VT environment and so we can initiate it via Systemd or init .

for all of those we need the bin to be able to start as a service

bararchy avatar Jul 06 '15 16:07 bararchy

Actually we don't install any addon to apache / nginx in Ruby world.

We mostly use Nginx / Apache as a reverse proxy and static file server other than that we have Ruby web servers (Puma, Thin, Unicorn e.g) which handles the incoming requests.

sdogruyol avatar Jul 06 '15 18:07 sdogruyol

@Sdogruyol Thats cool to know, but it doesn't change the fact that we need to add a fork or app.serve_in_background option

bararchy avatar Jul 12 '15 14:07 bararchy

Docker and mac LaunchAgents only work if you run in the foreground. Systemd can work either way.

I agree that this used to be the only way to run, but now a days I wonder. What environment are you running?

kbrock avatar Sep 11 '15 02:09 kbrock