Conversation
ouranos
left a comment
There was a problem hiding this comment.
Instead of installing it in the host app with the generator, could make it part of the engine?
See how it's setup in mno-enterprise
6096ca3 to
1f03f11
Compare
1f03f11 to
ab15d09
Compare
|
@ouranos |
ouranos
left a comment
There was a problem hiding this comment.
Just a few tweaks.
We should also add some documentation in this section https://maestrano.atlassian.net/wiki/spaces/DEV/pages/25427971/Create+a+connector+using+our+framework+-+Ruby+on+Rails to explain how to add health checks.
See this section for example
| config.http_status_for_error_object = 500 | ||
|
|
||
| # You can customize which checks happen on a standard health check | ||
| config.standard_checks = %w[site cache redis-if-present] |
There was a problem hiding this comment.
Remove redis-if-present. See maestrano/mno-enterprise#795
There was a problem hiding this comment.
same issue is in mno-enterprise 4.0, you want me to raise a pull request to fix there as well?
There was a problem hiding this comment.
That's what the PR I linked above is doing?
| s.add_runtime_dependency('attr_encrypted', '~> 1.4.0') | ||
| s.add_runtime_dependency('autoprefixer-rails') | ||
| s.add_runtime_dependency('bootstrap-sass') | ||
| s.add_runtime_dependency 'health_check', '~> 2.4' |
There was a problem hiding this comment.
Use ~> 2.8 (2.7 got a bug with the redis check)
3.0 is for Rails 5
There was a problem hiding this comment.
same issue is in mno-enterprise 4.0 & 5.0, you want me to raise a pull request to fix there as well?
There was a problem hiding this comment.
No that's fine, it should install 2.8 on new projects and it was manually locked on older projects.
It's just because we adding it here we might as well put the latest version
| config.standard_checks = %w[site cache redis-if-present] | ||
|
|
||
| # You can set what tests are run with the 'full' or 'all' parameter | ||
| config.full_checks = %w[site cache custom redis-if-present sidekiq-redis-if-present] |
There was a problem hiding this comment.
For the custom check we might want to add a check to see if the connector can contact:
- connec!
- dev-platform
See https://github.com/maestrano/mno-enterprise/blob/5.0/api/app/models/mno_enterprise/health_check.rb and the health_check README regarding custom_check
- removed redis-if-present check - using 2.8 for health_check gema s 2.7 has issues - added custom checks to test connectivity to connec! and Dev Platform.
| - 'app/models/maestrano/connector/rails/concerns/entity.rb' | ||
| - 'app/models/maestrano/connector/rails/concerns/organization.rb' | ||
| - 'app/resources/maestrano/api/base_resource.rb' | ||
| - 'app/models/maestrano/connector/rails/health_check.rb' |
| # Check API connection with Connec! | ||
| # any code that returns blank on success and non blank string upon failure | ||
| def self.perform_connec_check | ||
| organization = Maestrano::Connector::Rails::Organization.first |
There was a problem hiding this comment.
What if there are no Organization?
| # Check API connection with Dev Platform! | ||
| # any code that returns blank on success and non blank string upon failure | ||
| def self.perform_dev_platform_check | ||
| if Maestrano.auto_configure |
There was a problem hiding this comment.
I'm worried it'll re-configure the connector at every health check request.
Could we just find a way to query the DevPlatform without re-configuring the connector, or maybe just checking that the connector is configured enough? (by looking at the Maestrano config?)
Adding health-check using health-check gem in the connector engine.
So the routes for health_check will be
GET|POST /health_check(/:checks)(.:format)
I created an connector-test app and have verified it.
Added Custom health check for testing connectivity to Connec! and Dev Platform!.
I used
Maestrano.auto_configurefor Connectivity to Dev Platform, Let me know if there is a better way to do it.Added Documentation here -https://maestrano.atlassian.net/wiki/spaces/DEV/pages/28114962/Getting+started