How to run Quantum independently in my app as a separate process?

Hi all,

I’ve already setup Faktory (https://github.com/contribsys/faktory) to take care of my background jobs on my app. However, I am trying to setup Quantum (https://github.com/quantum-elixir/quantum-core) to schedule jobs periodically on my Faktory server.

I’ve gone through the installation instructions, however it seems to involve running Quantum as a supervised application under my actual application:

defmodule MyApp.Scheduler do
  use Quantum, otp_app: :my_app
end

in application.ex:

children = [
 ..,
 .. ,
 MyApp,Scheduler
]

Whenever I run my mix phx.server, it seems to start quantum, however, it gets killed as soon as my phx.server is killed.
I would want to run quantum as a separate process independent from Phoenix server.
Am I missing something here? Can someone please guide me?

Thanks a lot.

The whole idea of Erlang’s OTP is to have tree structure of supervisors and workers which all go down after the OS process is finished.

You are looking for a normal separate OS process daemon.

1 Like

If you wish to work outside of your application why not use regular cron? It would be simpler than running multiple instances of the VM at the same time.

3 Likes