I can start the application without problem, but when I try to launch it with systemd it keeps failing and restarting for some reason.
Here are the logs
un 08 10:00:15 union-staging systemd[1]: Starting Union Servers...
-- Subject: Unit union.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit union.service has begun starting up.
Jun 08 10:00:16 union-staging union[8741]: ==> Generated sys.config in /test/union/var
Jun 08 10:00:19 union-staging union[8998]: ==> Generated sys.config in /test/union/var
Jun 08 10:00:19 union-staging union[9530]: Starting up
Jun 08 10:00:20 union-staging systemd[1]: union.service: control process exited, code=exited status=1
Jun 08 10:00:20 union-staging union[8998]: Node union@127.0.0.1 is not running!
Jun 08 10:00:20 union-staging systemd[1]: Unit union.service entered failed state.
Jun 08 10:00:20 union-staging systemd[1]: union.service failed.
Jun 08 10:00:25 union-staging systemd[1]: union.service holdoff time over, scheduling restart.
Jun 08 10:00:25 union-staging systemd[1]: Started Union Servers.
-- Subject: Unit union.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit union.service has finished starting up.
--
lines 1190-1211/1247 98%
-- The start-up result is done.
Jun 08 10:00:15 union-staging systemd[1]: Starting Union Servers...
-- Subject: Unit union.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit union.service has begun starting up.
Jun 08 10:00:16 union-staging union[8741]: ==> Generated sys.config in /test/union/var
Jun 08 10:00:19 union-staging union[8998]: ==> Generated sys.config in /test/union/var
Jun 08 10:00:19 union-staging union[9530]: Starting up
Jun 08 10:00:20 union-staging systemd[1]: union.service: control process exited, code=exited status=1
Jun 08 10:00:20 union-staging union[8998]: Node union@127.0.0.1 is not running!
Jun 08 10:00:20 union-staging systemd[1]: Unit union.service entered failed state.
Jun 08 10:00:20 union-staging systemd[1]: union.service failed.
Jun 08 10:00:25 union-staging systemd[1]: union.service holdoff time over, scheduling restart.
Jun 08 10:00:25 union-staging systemd[1]: Started Union Servers.
-- Subject: Unit union.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit union.service has finished starting up.
Here is my systemd config
[Unit]
Description=Union Servers
After=network-online.target
[Service]
Type=forked
User=root
Group=root
WorkingDirectory=/test/union
ExecStart=/test/union/bin/union start
ExecReload=/test/union/bin/union reload_config
ExecStop=/test/union/bin/union stop
PIDFile=/test/union/union.prod.pid
Restart=always
RestartSec=5
Environment=PORT=4000
Environment=LANG=en_US.UTF-8
SyslogIdentifier=union
[Install]
WantedBy=multi-user.target
The system variable I use is
PIDFILE="./union.prod.pid"
Here is my mix file
[
{:phoenix, "~> 1.3.0"},
{:phoenix_pubsub, "~> 1.0"},
{:phoenix_ecto, "~> 3.2"},
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 2.10"},
{:gettext, "~> 0.13.1"},
{:cowboy, "~> 1.0"},
{:ex_admin, github: "sublimecoder/ex_admin"},
{:timex, "~> 3.2", override: true},
{:coherence, "~> 0.5"},
{:cloudex, "~> 1.0"},
{:number, "~> 0.5.4"},
{:turbolinks, "~> 0.3.2"},
{:ecto_enum, "~> 1.1"},
{:jason, "~> 1.0"},
{:absinthe, "~> 1.4.2"},
{:absinthe_plug, "~> 1.4.0"},
# Instrumentation
{:observer_cli, "~> 1.3.1"},
{:exprof, "~> 0.2.1"},
{:eflame, "~> 1.0"},
{:sentry, "~> 6.2.0"},
{:prometheus_ex, "~> 1.0"},
{:prometheus_ecto, "~> 1.0"},
{:prometheus_phoenix, "~> 1.2"},
{:prometheus_plugs, "~> 1.0"},
{:prometheus_process_collector, "~> 1.1"},
# dev dependencies
{:phoenix_live_reload, "~> 1.0", only: :dev},
{:ex_doc, "~> 0.18", only: :dev, runtime: false},
{:credo, "~> 0.8", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 0.5.0", only: [:dev], runtime: false},
# release
{:edeliver, "~> 1.5.0"},
{:distillery, "~> 1.5", runtime: false},
{:pid_file, "~> 0.1.0"},
{:conform, "~> 2.2"}
]
I’m not really sure what I’m doing wrong.