Wait until RDS snapshot has been restored on initial install before trying to create DB tables too early
When deploying using the CloudFormation template, when restoring a database from a snapshot it is possible that the authserver
and worldserver
EC2 instances connect to the database before it has restored from a snapshot. In this event, brand new and empty tables will be created which will prevent the snapshot from being restoreing.
A couple of options:
Investigate the use of RDS SNS event notifications so that the EC2 instances have to wait for a db-snapshot
/restoration
or db-instance
/restoration
and db-instance
/availability
event perhaps?
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.html
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.Subscribing.html
- https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Events.ListingCategories.html
Alternatively, the CFN init scripts and wait-for-mysql.sh
helper in the container could be extended to wait for the existence of an arbitrary list of databases to appear on the RDS server (characters
, auth
and world
) before proceeding when we are restoring from a snapshot.