Closed Elly6 closed 6 years ago
systemd and upstart are both good for Linux. But determining the cause would be better :P
Jeffrey Tong
/ I make companies
tel:1-415-513-6871
This e-mail message may contain confidential or legally privileged information and is intended only for the use of the intended recipient(s). Any unauthorized disclosure, dissemination, distribution, copying or the taking of any action in reliance on the information herein is prohibited. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, or contain viruses. Anyone who communicates with us by e-mail is deemed to have accepted these risks. Jeffrey Tong is not responsible for errors or omissions in this message and denies any responsibility for any damage arising from the use of e-mail. Any opinion and other statement contained in this message and any attachment are solely those of the author and do not necessarily represent those of the company.
On Wed, Feb 01, 2017 at 6:20 PM Elly6
< mailto:Elly6 notifications@github.com
wrote:
a, pre, code, a:link, body { word-wrap: break-word !important; }
What's the best way to automatically redeploy the phoenix.server when it stops? If I wanted to leave magnetissimo unattended for a prolonged period of time.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, https://github.com/sergiotapia/magnetissimo/issues/59 , or https://github.com/notifications/unsubscribe-auth/ADwQUP8oHP_FVofUpiM5L7t7f2s23sFBks5rYRNXgaJpZM4L0hUL .
systemd does not magically help. At least for me, the beam process stays around, even when the server is down.
I'm currently using a script like this:
#!/bin/sh
while true; do
if curl -s http://localhost:4000 >/dev/null; then
true
else
systemctl restart magnetissimo.service
fi
sleep 120
done
… and a systemd unit (/etc/systemd/system/magnetissimo.service
) like this:
[Unit]
Description=magnetissimo service
After=network.target
[Service]
Type=simple
ExecStart=/usr/local/bin/mix phoenix.server
WorkingDirectory=/home/user/magnetissimo
Restart=always
RestartSec=30s
User=user
Group=user
SendSIGKILL=no
[Install]
WantedBy=multi-user.target
@apexo
Thanks! A bash loop makes sense, I'll use your script. Though, I thought phoenix.server might have some options we could pass when deploying the server. (e.g. -p, -r, --persist, --ignore-errors)
I'll leave this issue open a bit longer if anyone has other suggestions.
Thanks for the systemd unit, @apexo. May I add it to the deployment documentation?
Yes, of course. Sorry for the late response.
May want to get rid of the "Group=user", it's kind of useless.
Thank you very much :)
What's the best way to automatically redeploy the phoenix.server when it stops? If I wanted to leave magnetissimo unattended for a prolonged period of time.