简体   繁体   中英

How to make edeliver write pid of started phoenix server?

I deploy phoenix application with edeliver to my server. In case of sudden server restart I want my phoenix-app to be revived automatically and monitored. It seems that systemd tool can help me, but it requires phoenix pid file to be stored somewhere.

Is there a way to make edeliver save phoenix pid file right after deploy? Maybe there is a better way than systemd to revive and monitor the application after server restart?

note: I'm most of all interested in monitoring pid.

I finally managed to find the solution. There are actually after deploy hooks in edeliver.

In .deliver/config :

post_start_deployed_release() {
  if [ "$TARGET_MIX_ENV" = "prod" ]; then
    echo ${PRODUCTION_HOSTS};
    arr=(echo ${PRODUCTION_HOSTS});
    for host in ${arr[@]}; do
      ssh pepe@${host} "mkdir -p ~/pepe_project/var/run && /usr/sbin/lsof -i:4000 | grep beam.smp | awk '{print $2}' > ~/pepe_project
  /var/run/phoenix.pid";
    done
  fi
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM