CNG: Ruby-ize dependencies check in wait-for-deps
Summary
Split from #1775 (closed), and from these two comments
Between the above, and Ruby actually having
kernel.exec
(I didn't know), it becomes suddenly much more feasible to replace this entire script with Ruby, and thread the various checks.
-
(Re)starts Ruby as few times as possible, loading as few modules as possible.
Current behavior
wait-for-deps
script spins a loop:
- Call
checkSchemaVersion()
, which fires uprails-db-check
. - If that passes muster, then run
rails-redis-ping
. - If that too passes muster, continue via
exec
- If either of the above fail, start again.
Expected behavior
wait-for-deps
prepares the environment, and calls rails-dependencies
. This is a Ruby script which internally Threads the functionality of rails-redis-ping
and rails-db-check
. This is handled in such a way that Ruby is instantiated once, and configuration files are read once. Each module is responsible for their own execution and looping pattern based upon configuration from environment, as provided by wait-for-deps
.