2019-08-15 02:32:32 +02:00
|
|
|
defmodule Philomena.Application do
|
|
|
|
# See https://hexdocs.pm/elixir/Application.html
|
|
|
|
# for more information on OTP Applications
|
|
|
|
@moduledoc false
|
|
|
|
|
|
|
|
use Application
|
|
|
|
|
|
|
|
def start(_type, _args) do
|
|
|
|
# List all child processes to be supervised
|
|
|
|
children = [
|
|
|
|
# Start the Ecto repository
|
|
|
|
Philomena.Repo,
|
2019-12-25 17:56:19 +01:00
|
|
|
|
2019-08-15 02:32:32 +02:00
|
|
|
# Starts a worker by calling: Philomena.Worker.start_link(arg)
|
|
|
|
# {Philomena.Worker, arg},
|
2019-11-26 04:47:57 +01:00
|
|
|
Philomena.Servers.ImageProcessor,
|
2019-12-18 02:35:07 +01:00
|
|
|
Philomena.Servers.UserLinkUpdater,
|
2019-12-18 17:12:48 +01:00
|
|
|
Philomena.Servers.PicartoChannelUpdater,
|
2019-12-18 17:18:16 +01:00
|
|
|
Philomena.Servers.PiczelChannelUpdater,
|
2019-12-18 20:32:21 +01:00
|
|
|
Philomena.Servers.UserFingerprintUpdater,
|
|
|
|
Philomena.Servers.UserIpUpdater,
|
2019-12-25 17:56:19 +01:00
|
|
|
Philomena.Servers.Config,
|
2020-04-07 18:00:55 +02:00
|
|
|
{Pow.Store.Backend.MnesiaCache, extra_db_nodes: Node.list()},
|
2019-12-25 17:56:19 +01:00
|
|
|
{Redix, name: :redix, host: Application.get_env(:philomena, :redis_host)},
|
2020-04-27 23:35:44 +02:00
|
|
|
{Phoenix.PubSub, [name: Philomena.PubSub, adapter: Phoenix.PubSub.PG2]},
|
2019-12-25 17:56:19 +01:00
|
|
|
|
|
|
|
# Start the endpoint when the application starts
|
2020-04-07 06:21:37 +02:00
|
|
|
PhilomenaWeb.Endpoint,
|
2020-05-06 17:12:18 +02:00
|
|
|
PhilomenaWeb.StatsUpdater,
|
2020-04-07 06:21:37 +02:00
|
|
|
|
|
|
|
# Connection drainer for SIGTERM
|
|
|
|
{RanchConnectionDrainer, ranch_ref: PhilomenaWeb.Endpoint.HTTP, shutdown: 30_000}
|
2019-08-15 02:32:32 +02:00
|
|
|
]
|
|
|
|
|
|
|
|
# See https://hexdocs.pm/elixir/Supervisor.html
|
|
|
|
# for other strategies and supported options
|
|
|
|
opts = [strategy: :one_for_one, name: Philomena.Supervisor]
|
|
|
|
Supervisor.start_link(children, opts)
|
|
|
|
end
|
|
|
|
|
|
|
|
# Tell Phoenix to update the endpoint configuration
|
|
|
|
# whenever the application is updated.
|
|
|
|
def config_change(changed, _new, removed) do
|
|
|
|
PhilomenaWeb.Endpoint.config_change(changed, removed)
|
|
|
|
:ok
|
|
|
|
end
|
|
|
|
end
|