cloudfoundry / capi-release

Bosh Release for Cloud Controller and friends
Apache License 2.0
24 stars 101 forks source link

NOT run CCDB migrations in BOSH pre-start script. #392

Closed WeiQuan0605 closed 7 months ago

WeiQuan0605 commented 8 months ago

In pre-start script of cc includes the execution of the db migration. The problem is that pre-start scripts run all the jobs at the same time, and it is now well established that the migration's standard output is not passed to syslog's blackbox , then it can be inferred that cc's pre-start's script is running when blackbox is not running. Any messages are basically dropped, when Blackbox is not running. Since Blackbox is a common bosh job, it cannot pick up any lifecycle logs outside its own lifecycle.

Instead of using perform_migration function from pre-start script, cc migration can be started in jobs/cloud_controller_ng/templates/bin/cloud_controller_ng.erb. When bosh monit starts, all processes are called in no particular order, and some loggings may be lost, but it is guaranteed that the blackbox can read the logs, which are stored in stdout of cc. The migration logs can also be seen in ELK.