我有一个具有以下systemd定义的phoenix应用程序:
[Unit]
Description=Phoenix server for Databaum app
After=network.target
[Service]
User=www-data
Group=www-data
Restart=on-failure
RestartSec=3
Environment=HOME=/var/www/databaum
ExecStart= /var/www/databaum/releases/current/bin/databaum foreground
ExecStop= /var/www/databaum/releases/current/bin/databaum stop
[Install]
WantedBy=multi-user.target
我可以通过调用service start
/ stop databaum
来启动和停止该应用程序。到目前为止,一切都很好。但是两天前,该应用程序崩溃了,并且没有重新启动。原因是在一夜之间数据库的自动安全更新。日志显示以下内容:
-- Logs begin at Tue 2019-09-03 01:44:51 CEST. --
Sep 20 02:32:44 databerg databaum[15098]: 02:32:44.400 request_id=FcX-OKImn_n5A44AANyB [info] POST /api/ttnmessages
Sep 20 02:32:44 databerg databaum[15098]: 02:32:44.404 request_id=FcX-OKImn_n5A44AANyB [info] Sent 201 in 3ms
Sep 20 02:32:56 databerg databaum[15098]: 02:32:56.070 request_id=FcX-O1mzKyZGPwoAANyR [info] POST /api/ttnmessages
Sep 20 02:32:56 databerg databaum[15098]: 02:32:56.074 request_id=FcX-O1mzKyZGPwoAANyR [info] Sent 201 in 4ms
Sep 20 02:33:00 databerg systemd[1]: Stopping Phoenix server for Databaum app...
Sep 20 02:33:01 databerg databaum[15098]: 02:33:01.386 [error] Postgrex.Protocol (#PID<0.1997.0>) disconnected: (Postgrex.Error) FATAL 57P01 (admin_shutdown) terminating connection due to administrator command
Sep 20 02:33:01 databerg databaum[15098]: 02:33:01.387 [error] Postgrex.Protocol #PID<0.1997.0> could not cancel backend: tcp connect: connection refused - :econnrefused
Sep 20 02:33:01 databerg databaum[15098]: 02:33:01.388 [error] Postgrex.Protocol (#PID<0.1997.0>) failed to connect: (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :econnrefused
Sep 20 02:33:03 databerg databaum[29803]: ok
Sep 20 02:33:11 databerg systemd[1]: Stopped Phoenix server for Databaum app.
在那之后-什么都没有。 为什么?
我还有另一个具有以下日志的应用程序:
Sep 20 02:33:00 databerg systemd[1]: Stopping Phoenix server for DataBerg app...
Sep 20 02:33:02 databerg databerg[1211]: 02:33:02.374 [error] Postgrex.Protocol (#PID<0.1942.0>) disconnected: ** (Postgrex.Error) FATAL 57P01 (admin_shutdown) terminating connection due to administrator
Sep 20 02:33:02 databerg databerg[1211]: 02:33:02.376 [error] Postgrex.Protocol #PID<0.1942.0> could not cancel backend: tcp connect: connection refused - :econnrefused
Sep 20 02:33:02 databerg databerg[1211]: 02:33:02.377 [error] Postgrex.Protocol (#PID<0.1942.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (localhost:5432): connection refused - :ec
Sep 20 02:33:04 databerg databerg[29835]: ok
Sep 20 02:33:12 databerg systemd[1]: Stopped Phoenix server for DataBerg app.
-- Reboot --
Sep 20 02:33:45 databerg systemd[1]: Started Phoenix server for DataBerg app.
Sep 20 02:33:56 databerg databerg[1196]: Loading databerg..
Sep 20 02:33:56 databerg databerg[1196]: Starting dependencies..
[Unit]
Description=Phoenix server for DataBerg app
After=network.target
[Service]
User=databerg
Group=databerg
Restart=on-failure
Environment=HOME=/var/www/databerg
ExecStart= /var/www/databerg/bin/databerg foreground
ExecStop= /var/www/databerg/bin/databerg stop
[Install]
WantedBy=multi-user.target
我觉得我很想念一些显而易见的东西。