CoinRoster / slotmachine

fruitgame
0 stars 0 forks source link

Add crash recovery to server #23

Closed Patrick-Bay closed 6 years ago

Patrick-Bay commented 6 years ago

Currently when the server crashes there is no recovery -- it sits dormant until manually restarted. Explore the following to add automated restarts to the server: https://www.digitalocean.com/community/tutorials/how-to-configure-a-linux-service-to-start-automatically-after-a-crash-or-reboot-part-1-practical-examplesAdd a crash count and limit, along with recorded timestamps (per crash) to the server log, or some other recording system, so that we can stop restarts if the limit is reached within a specific time period (e.g. 15 restarts within 30 seconds). Also include a reporting system so that administrators are notified of a server restart and are sent a copy of the crash report / error log(s). Use email notifications to start (text messages would be nice to have).

RiskingTime commented 6 years ago

@Patrick-Bay how long do you estimate it will take to complete this work?

Patrick-Bay commented 6 years ago

I expect crash recovery implementation to take approximately 2 hours which would include both the automation script(s) and the startup email functionality.

RiskingTime commented 6 years ago

ok, start this task next, whenever you are ready

Patrick-Bay commented 6 years ago

I've enabled crash recovery and control on the server and documented how to set up the environment.

https://github.com/CoinRoster/slotmachine/wiki/Enabling-and-Administering-Crash-Recovery-for-the-Game-Server

RiskingTime commented 6 years ago

@Patrick-Bay this might be a silly question, but can you confirm that when the game server crashes and then is restarted automatically, there is a log of all action including some reason why it crashed?

regarding "As a final step, PM2 should generate a startup script for itself and the game server. To do this type: sudo pm2 startup" can you explain this in more detail? is this command what triggers the game server to auto startup?

so basically the game server will run as a process and also PM2 will run as a separate process?

Patrick-Bay commented 6 years ago

I'll answer your questions in order:

Thanks, Patrick

On Tue, Mar 6, 2018 at 10:20 AM, chavis1082 notifications@github.com wrote:

this might be a silly question, but can you confirm that when the game server crashes and then is restarted automatically, there is a log of all action including some reason why it crashed?

regarding "As a final step, PM2 should generate a startup script for itself and the game server. To do this type: sudo pm2 startup" can you explain this in more detail? is this command what triggers the game server to auto startup?

so basically the game server will run as a process and also PM2 will run as a separate process?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/CoinRoster/slotmachine/issues/23#issuecomment-370815884, or mute the thread https://github.com/notifications/unsubscribe-auth/AHrbz7W2N5_1nIEqgcD-1dYGVuK_DOQ3ks5tbqkzgaJpZM4SUaH5 .

RiskingTime commented 6 years ago

Reopened this issue due to changes made while addressing database connectivity issues

RiskingTime commented 6 years ago

timestamp error log, game server log

RiskingTime commented 6 years ago

error notification e-mails to admins, containing the error msg, time/date, any other details (user account, action, etc)

Patrick-Bay commented 6 years ago

Timestamps have been added to error log as well as in-sequence error logging to the general debug log. In addition, administrator email functionality has been implemented so that any runtime errors, including full details, are sent to administrators (as specified in the game server configuration). All fixes have been pulled to the development server (http://myfruitgame.com) and are available for testing now.

Changes for this issue were pushed with commit: https://github.com/CoinRoster/slotmachine/commit/4cd77c0d8ac4c5d717df520c727eb208437531d6