talk.kiezburn.org
Mon 18 Mar 2019 1:29PM

[Realities] Setup script to ping realities and restart if needed

K Konstantin Public Seen by 8

To make sure Realities keeps working most of the time, we implemented a workaround which monitors the reachability of the GraphQL endpoint and restarts the docker container in case it crashed again. This should be removed as soon as we fixed the actual bug.

Things that happened:
- Created directory ~/utilities
- Created ~/utilities/ping_realities.sh
—> Gets status_code of "POST localhost:3100/graphql"
—> If status_code != 200: Run ~/realities/restart_docker.sh script
- Created ~/utilities/ping_realities.log for log entries
- Setup cron job:
—> crontab -e (default editor: vi)
—> Setup default shell: SHELL=/bin/bash
—> Setup ping_realities.sh to run every minute: "*/1 * * * * /root/utilities/ping_realities.sh &>> /root/utilities/ping_realities.log"