hybrid_platforms_conductor 32.13.0 → 32.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +42 -0
- data/README.md +10 -3
- data/bin/get_impacted_nodes +1 -1
- data/bin/setup +6 -1
- data/docs/executables/check-node.md +1 -1
- data/docs/executables/deploy.md +1 -1
- data/docs/executables/free_ips.md +1 -1
- data/docs/executables/free_veids.md +1 -1
- data/docs/executables/get_impacted_nodes.md +1 -1
- data/docs/executables/last_deploys.md +1 -1
- data/docs/executables/nodes_to_deploy.md +1 -1
- data/docs/executables/report.md +1 -1
- data/docs/executables/run.md +1 -1
- data/docs/executables/setup.md +1 -1
- data/docs/executables/ssh_config.md +1 -1
- data/docs/executables/test.md +1 -1
- data/docs/plugins.md +1 -0
- data/docs/plugins/platform_handler/serverless_chef.md +105 -0
- data/docs/tutorial.md +10 -6
- data/docs/tutorial/01_installation.md +14 -12
- data/docs/tutorial/02_first_node.md +14 -12
- data/docs/tutorial/03_scale.md +14 -12
- data/docs/tutorial/04_test.md +26 -14
- data/docs/tutorial/05_extend_with_plugins.md +17 -17
- data/examples/tutorial/01_installation/my-platforms/Gemfile +3 -0
- data/examples/tutorial/01_installation/my-platforms/hpc_config.rb +0 -0
- data/examples/tutorial/02_first_node/my-platforms/Gemfile +3 -0
- data/examples/tutorial/02_first_node/my-platforms/hpc_config.rb +1 -0
- data/examples/tutorial/02_first_node/my-service-conf-repo/inventory.yaml +13 -0
- data/examples/tutorial/02_first_node/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/02_first_node/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/02_first_node/node/my-service.conf +4 -0
- data/examples/tutorial/03_scale/my-platforms/Gemfile +3 -0
- data/examples/tutorial/03_scale/my-platforms/hpc_config.rb +1 -0
- data/examples/tutorial/03_scale/my-platforms/my_commands.bash +2 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/inventory.yaml +90 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/03_scale/my-service-conf-repo/service_web-hello.rb +43 -0
- data/examples/tutorial/03_scale/node/my-service.conf +4 -0
- data/examples/tutorial/03_scale/web_docker_image/Dockerfile +33 -0
- data/examples/tutorial/03_scale/web_docker_image/hello_world.txt +1 -0
- data/examples/tutorial/03_scale/web_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/03_scale/web_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/03_scale/web_docker_image/main.go +43 -0
- data/examples/tutorial/03_scale/web_docker_image/start.sh +7 -0
- data/examples/tutorial/03_scale/web_docker_image/test.bash +6 -0
- data/examples/tutorial/04_test/my-platforms/Gemfile +3 -0
- data/examples/tutorial/04_test/my-platforms/hpc_config.rb +12 -0
- data/examples/tutorial/04_test/my-platforms/images/debian_10/Dockerfile +13 -0
- data/examples/tutorial/04_test/my-platforms/my_commands.bash +2 -0
- data/examples/tutorial/04_test/my-service-conf-repo/inventory.yaml +100 -0
- data/examples/tutorial/04_test/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/04_test/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/04_test/my-service-conf-repo/service_web-hello.rb +43 -0
- data/examples/tutorial/04_test/node/my-service.conf +4 -0
- data/examples/tutorial/04_test/web_docker_image/Dockerfile +33 -0
- data/examples/tutorial/04_test/web_docker_image/hello_world.txt +1 -0
- data/examples/tutorial/04_test/web_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/04_test/web_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/04_test/web_docker_image/main.go +43 -0
- data/examples/tutorial/04_test/web_docker_image/start.sh +7 -0
- data/examples/tutorial/04_test/web_docker_image/test.bash +6 -0
- data/examples/tutorial/05_extend_with_plugins/dev-servers-conf-repo/hosts.json +12 -0
- data/examples/tutorial/05_extend_with_plugins/dev-servers-conf-repo/install-gcc.bash +14 -0
- data/examples/tutorial/05_extend_with_plugins/dev-servers-conf-repo/install-python.bash +14 -0
- data/examples/tutorial/05_extend_with_plugins/dev_docker_image/Dockerfile +20 -0
- data/examples/tutorial/05_extend_with_plugins/dev_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/05_extend_with_plugins/dev_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/Gemfile +4 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/hpc_config.rb +13 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/images/debian_10/Dockerfile +13 -0
- data/examples/tutorial/05_extend_with_plugins/my-platforms/my_commands.bash +2 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/inventory.yaml +100 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/my-service.conf.erb +3 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_my-service.rb +58 -0
- data/examples/tutorial/05_extend_with_plugins/my-service-conf-repo/service_web-hello.rb +43 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/platform_handler/json_bash.rb +115 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/report/web_report.rb +52 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/lib/my_hpc_plugins/hpc_plugins/test/root_space.rb +44 -0
- data/examples/tutorial/05_extend_with_plugins/my_hpc_plugins/my_hpc_plugins.gemspec +15 -0
- data/examples/tutorial/05_extend_with_plugins/node/my-service.conf +4 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/Dockerfile +33 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/hello_world.txt +1 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/hpc_root.key +27 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/hpc_root.key.pub +1 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/main.go +43 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/start.sh +7 -0
- data/examples/tutorial/05_extend_with_plugins/web_docker_image/test.bash +6 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef.rb +440 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/dsl_parser.rb +51 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/serverless_chef/recipes_tree_builder.rb +271 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +1 -0
- data/lib/hybrid_platforms_conductor/nodes_handler.rb +9 -5
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test.rb +3 -0
- data/spec/hybrid_platforms_conductor_test/api/deployer/provisioner_spec.rb +23 -0
- data/spec/hybrid_platforms_conductor_test/api/nodes_handler/cmdbs_plugins_api_spec.rb +11 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/config_dsl_spec.rb +17 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/deploy_output_parsing_spec.rb +94 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/diff_impacts_spec.rb +317 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/inventory_spec.rb +65 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/packaging_spec.rb +213 -0
- data/spec/hybrid_platforms_conductor_test/api/platform_handlers/serverless_chef/services_deployment_spec.rb +268 -0
- data/spec/hybrid_platforms_conductor_test/helpers/serverless_chef_helpers.rb +53 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/chef_versions.yml +3 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/nodes/node.json +14 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/1_node/policyfiles/test_policy.rb +3 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/chef_versions.yml +3 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/data_bags/my_bag/my_item.json +4 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/nodes/node.json +14 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/data_bags/policyfiles/test_policy.rb +3 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_1/recipes/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/libraries/default.rb +4 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/recipes/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/recipes/other_recipe.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/cookbooks/test_cookbook_2/resources/my_resource.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/nodes/node1.json +10 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/nodes/node2.json +10 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/policyfiles/test_policy_1.rb +4 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/recipes/policyfiles/test_policy_2.rb +4 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/config.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/cookbooks/test_cookbook_1/recipes/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/nodes/node1.json +10 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/nodes/node2.json +10 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/libraries/default.rb +4 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/recipes/default.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/recipes/other_recipe.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/other_cookbooks/test_cookbook_2/resources/my_resource.rb +1 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/policyfiles/test_policy_1.rb +4 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_cookbooks/policyfiles/test_policy_2.rb +4 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_nodes/chef_versions.yml +3 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_nodes/nodes/local.json +10 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_nodes/nodes/node1.json +10 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_nodes/nodes/node2.json +10 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_nodes/policyfiles/test_policy_1.rb +3 -0
- data/spec/hybrid_platforms_conductor_test/serverless_chef_repositories/several_nodes/policyfiles/test_policy_2.rb +3 -0
- data/tools/generate_mermaid +1 -1
- metadata +260 -86
data/docs/tutorial/03_scale.md
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
---
|
3
3
|
**<p style="text-align: center;">Tutorial navigation</p>**
|
4
4
|
|
5
|
-
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <nobr><sub><
|
5
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
6
6
|
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
7
|
-
| <sub><
|
8
|
-
| <sub><
|
9
|
-
| <sub><
|
10
|
-
| | | | | <sub><
|
11
|
-
| | | | | | <sub><
|
7
|
+
| <sub><sup>**[Use-case](/docs/tutorial.md#use-case)**</sup></sub> | <sub><sup>**[Dependencies installation](/docs/tutorial/01_installation.md#hpc-dependencies)**</sup></sub> | <sub><sup>**[Add your first node and its platform repository](/docs/tutorial/02_first_node.md#add-first-node)**</sup></sub> | <sub><sup>**[Provision our web services platform](/docs/tutorial/03_scale.md#provision)**</sup></sub> | <sub><sup>**[Hello test framework](/docs/tutorial/04_test.md#framework)**</sup></sub> | <sub><sup>**[Create your plugins' repository](/docs/tutorial/05_extend_with_plugins.md#plugins-repo)**</sup></sub> |
|
8
|
+
| <sub><sup>**[Prerequisites](/docs/tutorial.md#prerequisites)**</sup></sub> | <sub><sup>**[Our platforms' main repository](/docs/tutorial/01_installation.md#main-repo)**</sup></sub> | <sub><sup>**[Check and deploy services on this node](/docs/tutorial/02_first_node.md#check-deploy)**</sup></sub> | <sub><sup>**[Run commands on our new web services](/docs/tutorial/03_scale.md#run)**</sup></sub> | <sub><sup>**[Testing your nodes](/docs/tutorial/04_test.md#nodes-tests)**</sup></sub> | <sub><sup>**[Your own platform handler](/docs/tutorial/05_extend_with_plugins.md#platform-handler)**</sup></sub> |
|
9
|
+
| <sub><sup>**[Tutorial setup](/docs/tutorial.md#tutorial-setup)**</sup></sub> | | <sub><sup>**[Updating the configuration](/docs/tutorial/02_first_node.md#update)**</sup></sub> | <sub><sup>**[Check and deploy our web services on several nodes at once](/docs/tutorial/03_scale.md#check-deploy)**</sup></sub> | <sub><sup>**[Testing your platforms' configuration](/docs/tutorial/04_test.md#platforms-tests)**</sup></sub> | <sub><sup>**[Write your own tests](/docs/tutorial/05_extend_with_plugins.md#test)**</sup></sub> |
|
10
|
+
| | | | | <sub><sup>**[Other kinds of tests](/docs/tutorial/04_test.md#other-tests)**</sup></sub> | <sub><sup>**[Enough of stdout, we want to report to other tools](/docs/tutorial/05_extend_with_plugins.md#report)**</sup></sub> |
|
11
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
12
12
|
|
13
13
|
# 3. Scale your processes
|
14
14
|
|
@@ -862,15 +862,17 @@ This already gives you powerful tools to **manage heterogeneous platforms and en
|
|
862
862
|
|
863
863
|
Next steps are about testing your processes and configurations so that you have very simple ways to monitor when they break, and integrate those tests in CI/CD-like workflows.
|
864
864
|
|
865
|
+
*Files that have been covered in this section can be checked in [this example tutorial folder](/examples/tutorial/03_scale).*
|
866
|
+
|
865
867
|
**[Next >> Test your processes and platforms](/docs/tutorial/04_test.md)**
|
866
868
|
|
867
869
|
---
|
868
870
|
**<p style="text-align: center;">Tutorial navigation</p>**
|
869
871
|
|
870
|
-
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <nobr><sub><
|
872
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
871
873
|
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
872
|
-
| <sub><
|
873
|
-
| <sub><
|
874
|
-
| <sub><
|
875
|
-
| | | | | <sub><
|
876
|
-
| | | | | | <sub><
|
874
|
+
| <sub><sup>**[Use-case](/docs/tutorial.md#use-case)**</sup></sub> | <sub><sup>**[Dependencies installation](/docs/tutorial/01_installation.md#hpc-dependencies)**</sup></sub> | <sub><sup>**[Add your first node and its platform repository](/docs/tutorial/02_first_node.md#add-first-node)**</sup></sub> | <sub><sup>**[Provision our web services platform](/docs/tutorial/03_scale.md#provision)**</sup></sub> | <sub><sup>**[Hello test framework](/docs/tutorial/04_test.md#framework)**</sup></sub> | <sub><sup>**[Create your plugins' repository](/docs/tutorial/05_extend_with_plugins.md#plugins-repo)**</sup></sub> |
|
875
|
+
| <sub><sup>**[Prerequisites](/docs/tutorial.md#prerequisites)**</sup></sub> | <sub><sup>**[Our platforms' main repository](/docs/tutorial/01_installation.md#main-repo)**</sup></sub> | <sub><sup>**[Check and deploy services on this node](/docs/tutorial/02_first_node.md#check-deploy)**</sup></sub> | <sub><sup>**[Run commands on our new web services](/docs/tutorial/03_scale.md#run)**</sup></sub> | <sub><sup>**[Testing your nodes](/docs/tutorial/04_test.md#nodes-tests)**</sup></sub> | <sub><sup>**[Your own platform handler](/docs/tutorial/05_extend_with_plugins.md#platform-handler)**</sup></sub> |
|
876
|
+
| <sub><sup>**[Tutorial setup](/docs/tutorial.md#tutorial-setup)**</sup></sub> | | <sub><sup>**[Updating the configuration](/docs/tutorial/02_first_node.md#update)**</sup></sub> | <sub><sup>**[Check and deploy our web services on several nodes at once](/docs/tutorial/03_scale.md#check-deploy)**</sup></sub> | <sub><sup>**[Testing your platforms' configuration](/docs/tutorial/04_test.md#platforms-tests)**</sup></sub> | <sub><sup>**[Write your own tests](/docs/tutorial/05_extend_with_plugins.md#test)**</sup></sub> |
|
877
|
+
| | | | | <sub><sup>**[Other kinds of tests](/docs/tutorial/04_test.md#other-tests)**</sup></sub> | <sub><sup>**[Enough of stdout, we want to report to other tools](/docs/tutorial/05_extend_with_plugins.md#report)**</sup></sub> |
|
878
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
data/docs/tutorial/04_test.md
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
---
|
3
3
|
**<p style="text-align: center;">Tutorial navigation</p>**
|
4
4
|
|
5
|
-
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <nobr><sub><
|
5
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
6
6
|
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
7
|
-
| <sub><
|
8
|
-
| <sub><
|
9
|
-
| <sub><
|
10
|
-
| | | | | <sub><
|
11
|
-
| | | | | | <sub><
|
7
|
+
| <sub><sup>**[Use-case](/docs/tutorial.md#use-case)**</sup></sub> | <sub><sup>**[Dependencies installation](/docs/tutorial/01_installation.md#hpc-dependencies)**</sup></sub> | <sub><sup>**[Add your first node and its platform repository](/docs/tutorial/02_first_node.md#add-first-node)**</sup></sub> | <sub><sup>**[Provision our web services platform](/docs/tutorial/03_scale.md#provision)**</sup></sub> | <sub><sup>**[Hello test framework](/docs/tutorial/04_test.md#framework)**</sup></sub> | <sub><sup>**[Create your plugins' repository](/docs/tutorial/05_extend_with_plugins.md#plugins-repo)**</sup></sub> |
|
8
|
+
| <sub><sup>**[Prerequisites](/docs/tutorial.md#prerequisites)**</sup></sub> | <sub><sup>**[Our platforms' main repository](/docs/tutorial/01_installation.md#main-repo)**</sup></sub> | <sub><sup>**[Check and deploy services on this node](/docs/tutorial/02_first_node.md#check-deploy)**</sup></sub> | <sub><sup>**[Run commands on our new web services](/docs/tutorial/03_scale.md#run)**</sup></sub> | <sub><sup>**[Testing your nodes](/docs/tutorial/04_test.md#nodes-tests)**</sup></sub> | <sub><sup>**[Your own platform handler](/docs/tutorial/05_extend_with_plugins.md#platform-handler)**</sup></sub> |
|
9
|
+
| <sub><sup>**[Tutorial setup](/docs/tutorial.md#tutorial-setup)**</sup></sub> | | <sub><sup>**[Updating the configuration](/docs/tutorial/02_first_node.md#update)**</sup></sub> | <sub><sup>**[Check and deploy our web services on several nodes at once](/docs/tutorial/03_scale.md#check-deploy)**</sup></sub> | <sub><sup>**[Testing your platforms' configuration](/docs/tutorial/04_test.md#platforms-tests)**</sup></sub> | <sub><sup>**[Write your own tests](/docs/tutorial/05_extend_with_plugins.md#test)**</sup></sub> |
|
10
|
+
| | | | | <sub><sup>**[Other kinds of tests](/docs/tutorial/04_test.md#other-tests)**</sup></sub> | <sub><sup>**[Enough of stdout, we want to report to other tools](/docs/tutorial/05_extend_with_plugins.md#report)**</sup></sub> |
|
11
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
12
12
|
|
13
13
|
# 4. Testing your processes and platforms
|
14
14
|
|
@@ -299,10 +299,19 @@ And now we try again the tests:
|
|
299
299
|
Here we see that 3 nodes failed, but 1 of them is expected to fail, and is not counted in the failures summaries.
|
300
300
|
Expected success is now down to 90 %.
|
301
301
|
|
302
|
-
Let's bring back the 2 nodes that are expected to succeed and check tests again:
|
302
|
+
Let's bring back the 2 nodes that are expected to succeed and check tests again (we will also make sure to update their IP address in `/etc/hosts` as they could have changed):
|
303
303
|
```bash
|
304
|
+
# Restart only web3 and web5 - keep web1 down
|
304
305
|
docker container start web3 web5
|
305
306
|
|
307
|
+
# Regenerate IPs in /etc/hosts
|
308
|
+
sed '/hpc_tutorial.org/d' /etc/hosts >/tmp/hosts
|
309
|
+
cp /tmp/hosts /etc/hosts
|
310
|
+
for ((i=2;i<=10;i++));
|
311
|
+
do
|
312
|
+
echo "$(docker container inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' web$i) web$i.hpc_tutorial.org" >>/etc/hosts
|
313
|
+
done
|
314
|
+
|
306
315
|
./bin/test --all --test connection
|
307
316
|
# ===== Run 11 connected tests ==== Begin...
|
308
317
|
# ===== Run test commands on 11 connected nodes (timeout to 25 secs) ==== Begin...
|
@@ -625,9 +634,10 @@ And now we run all the tests:
|
|
625
634
|
|
626
635
|
All tests are green!
|
627
636
|
|
628
|
-
Before going further, let's bring back `web1` online:
|
637
|
+
Before going further, let's bring back `web1` online, and add its IP in `/etc/hosts` as well:
|
629
638
|
```bash
|
630
639
|
docker container start web1
|
640
|
+
echo "$(docker container inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' web1) web1.hpc_tutorial.org" >>/etc/hosts
|
631
641
|
```
|
632
642
|
|
633
643
|
We'll see later how easy to add you own test plugins to complement those, but now it's time to see other kind of tests.
|
@@ -951,15 +961,17 @@ The goal of Hybrid Platforms Conductor is to be fully adaptable to your environm
|
|
951
961
|
|
952
962
|
**Let's extend its functionnality with your own plugins!**
|
953
963
|
|
964
|
+
*Files that have been covered in this section can be checked in [this example tutorial folder](/examples/tutorial/04_test).*
|
965
|
+
|
954
966
|
**[Next >> Write your own plugins](/docs/tutorial/05_extend_with_plugins.md)**
|
955
967
|
|
956
968
|
---
|
957
969
|
**<p style="text-align: center;">Tutorial navigation</p>**
|
958
970
|
|
959
|
-
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <nobr><sub><
|
971
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
960
972
|
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
961
|
-
| <sub><
|
962
|
-
| <sub><
|
963
|
-
| <sub><
|
964
|
-
| | | | | <sub><
|
965
|
-
| | | | | | <sub><
|
973
|
+
| <sub><sup>**[Use-case](/docs/tutorial.md#use-case)**</sup></sub> | <sub><sup>**[Dependencies installation](/docs/tutorial/01_installation.md#hpc-dependencies)**</sup></sub> | <sub><sup>**[Add your first node and its platform repository](/docs/tutorial/02_first_node.md#add-first-node)**</sup></sub> | <sub><sup>**[Provision our web services platform](/docs/tutorial/03_scale.md#provision)**</sup></sub> | <sub><sup>**[Hello test framework](/docs/tutorial/04_test.md#framework)**</sup></sub> | <sub><sup>**[Create your plugins' repository](/docs/tutorial/05_extend_with_plugins.md#plugins-repo)**</sup></sub> |
|
974
|
+
| <sub><sup>**[Prerequisites](/docs/tutorial.md#prerequisites)**</sup></sub> | <sub><sup>**[Our platforms' main repository](/docs/tutorial/01_installation.md#main-repo)**</sup></sub> | <sub><sup>**[Check and deploy services on this node](/docs/tutorial/02_first_node.md#check-deploy)**</sup></sub> | <sub><sup>**[Run commands on our new web services](/docs/tutorial/03_scale.md#run)**</sup></sub> | <sub><sup>**[Testing your nodes](/docs/tutorial/04_test.md#nodes-tests)**</sup></sub> | <sub><sup>**[Your own platform handler](/docs/tutorial/05_extend_with_plugins.md#platform-handler)**</sup></sub> |
|
975
|
+
| <sub><sup>**[Tutorial setup](/docs/tutorial.md#tutorial-setup)**</sup></sub> | | <sub><sup>**[Updating the configuration](/docs/tutorial/02_first_node.md#update)**</sup></sub> | <sub><sup>**[Check and deploy our web services on several nodes at once](/docs/tutorial/03_scale.md#check-deploy)**</sup></sub> | <sub><sup>**[Testing your platforms' configuration](/docs/tutorial/04_test.md#platforms-tests)**</sup></sub> | <sub><sup>**[Write your own tests](/docs/tutorial/05_extend_with_plugins.md#test)**</sup></sub> |
|
976
|
+
| | | | | <sub><sup>**[Other kinds of tests](/docs/tutorial/04_test.md#other-tests)**</sup></sub> | <sub><sup>**[Enough of stdout, we want to report to other tools](/docs/tutorial/05_extend_with_plugins.md#report)**</sup></sub> |
|
977
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
@@ -2,13 +2,13 @@
|
|
2
2
|
---
|
3
3
|
**<p style="text-align: center;">Tutorial navigation</p>**
|
4
4
|
|
5
|
-
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <nobr><sub><
|
5
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
6
6
|
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
7
|
-
| <sub><
|
8
|
-
| <sub><
|
9
|
-
| <sub><
|
10
|
-
| | | | | <sub><
|
11
|
-
| | | | | | <sub><
|
7
|
+
| <sub><sup>**[Use-case](/docs/tutorial.md#use-case)**</sup></sub> | <sub><sup>**[Dependencies installation](/docs/tutorial/01_installation.md#hpc-dependencies)**</sup></sub> | <sub><sup>**[Add your first node and its platform repository](/docs/tutorial/02_first_node.md#add-first-node)**</sup></sub> | <sub><sup>**[Provision our web services platform](/docs/tutorial/03_scale.md#provision)**</sup></sub> | <sub><sup>**[Hello test framework](/docs/tutorial/04_test.md#framework)**</sup></sub> | <sub><sup>**[Create your plugins' repository](/docs/tutorial/05_extend_with_plugins.md#plugins-repo)**</sup></sub> |
|
8
|
+
| <sub><sup>**[Prerequisites](/docs/tutorial.md#prerequisites)**</sup></sub> | <sub><sup>**[Our platforms' main repository](/docs/tutorial/01_installation.md#main-repo)**</sup></sub> | <sub><sup>**[Check and deploy services on this node](/docs/tutorial/02_first_node.md#check-deploy)**</sup></sub> | <sub><sup>**[Run commands on our new web services](/docs/tutorial/03_scale.md#run)**</sup></sub> | <sub><sup>**[Testing your nodes](/docs/tutorial/04_test.md#nodes-tests)**</sup></sub> | <sub><sup>**[Your own platform handler](/docs/tutorial/05_extend_with_plugins.md#platform-handler)**</sup></sub> |
|
9
|
+
| <sub><sup>**[Tutorial setup](/docs/tutorial.md#tutorial-setup)**</sup></sub> | | <sub><sup>**[Updating the configuration](/docs/tutorial/02_first_node.md#update)**</sup></sub> | <sub><sup>**[Check and deploy our web services on several nodes at once](/docs/tutorial/03_scale.md#check-deploy)**</sup></sub> | <sub><sup>**[Testing your platforms' configuration](/docs/tutorial/04_test.md#platforms-tests)**</sup></sub> | <sub><sup>**[Write your own tests](/docs/tutorial/05_extend_with_plugins.md#test)**</sup></sub> |
|
10
|
+
| | | | | <sub><sup>**[Other kinds of tests](/docs/tutorial/04_test.md#other-tests)**</sup></sub> | <sub><sup>**[Enough of stdout, we want to report to other tools](/docs/tutorial/05_extend_with_plugins.md#report)**</sup></sub> |
|
11
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
12
12
|
|
13
13
|
# 5. Extend Hybrid Platforms Conductor with your own requirements
|
14
14
|
|
@@ -352,8 +352,8 @@ Let's see what does it take to integrate this new platform repository into Hybri
|
|
352
352
|
### Write a simple platform handler that can handle your existing repository
|
353
353
|
|
354
354
|
A [`platform_handler` plugin](/docs/plugins.md#platform_handler) handles a given kind of platform repository, and has basically 2 roles:
|
355
|
-
* Provide inventory information (nodes defined, their metadata, the services they are hosting...).
|
356
|
-
* Provide services information (how to check/deploy services on a node).
|
355
|
+
* Provide **inventory** information (nodes defined, their metadata, the services they are hosting...).
|
356
|
+
* Provide **services** information (how to check/deploy services on a node).
|
357
357
|
|
358
358
|
So let's write a new plugin handling your repository.
|
359
359
|
Like any plugin, we create a file named `lib/<gem_name>/hpc_plugins/<plugin_type>/<plugin_name>.rb` that define a simple class inherting from a plugin's class.
|
@@ -999,8 +999,6 @@ For that we'll create a report plugin that will publish to our `web10` instance.
|
|
999
999
|
|
1000
1000
|
Here is the code of our report plugin:
|
1001
1001
|
```ruby
|
1002
|
-
# This file is an example of a Reports plugin that can be used to dump information about the platforms.
|
1003
|
-
# The MyReportPlugin example contains example of code that could be used to write a plugin for a new kind of report.
|
1004
1002
|
require 'hybrid_platforms_conductor/report'
|
1005
1003
|
|
1006
1004
|
module MyHpcPlugins
|
@@ -1042,7 +1040,7 @@ module MyHpcPlugins
|
|
1042
1040
|
end.join("\n")
|
1043
1041
|
)
|
1044
1042
|
# Upload the file on our web10 instance
|
1045
|
-
system 'scp -o StrictHostKeyChecking=no /tmp/web_report.txt web10.hpc_tutorial.org:/root/hello_world.txt'
|
1043
|
+
system 'scp -o StrictHostKeyChecking=no /tmp/web_report.txt root@web10.hpc_tutorial.org:/root/hello_world.txt'
|
1046
1044
|
out 'Upload successful'
|
1047
1045
|
end
|
1048
1046
|
|
@@ -1107,6 +1105,8 @@ It works like a charm!
|
|
1107
1105
|
The goal is for you to be agile and handle your inventory and platforms without duplicating information and efforts, and still keeping your heterogenous environments.
|
1108
1106
|
Then you can apply simple and normalized DevOps processes that can encompass all your platforms so that you operate and test them uniformely.
|
1109
1107
|
|
1108
|
+
*Files that have been covered in this section can be checked in [this example tutorial folder](/examples/tutorial/05_extend_with_plugins).*
|
1109
|
+
|
1110
1110
|
<a name="what-next"></a>
|
1111
1111
|
## What next?
|
1112
1112
|
|
@@ -1123,10 +1123,10 @@ We would love to reference your plugins as well here if you make them publicly a
|
|
1123
1123
|
---
|
1124
1124
|
**<p style="text-align: center;">Tutorial navigation</p>**
|
1125
1125
|
|
1126
|
-
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <nobr><sub><
|
1126
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <sub>[2. Deploy and check a first node](/docs/tutorial/02_first_node.md)</sub> | <sub>[3. Scale your processes](/docs/tutorial/03_scale.md)</sub> | <sub>[4. Testing your processes and platforms](/docs/tutorial/04_test.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
1127
1127
|
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
1128
|
-
| <sub><
|
1129
|
-
| <sub><
|
1130
|
-
| <sub><
|
1131
|
-
| | | | | <sub><
|
1132
|
-
| | | | | | <sub><
|
1128
|
+
| <sub><sup>**[Use-case](/docs/tutorial.md#use-case)**</sup></sub> | <sub><sup>**[Dependencies installation](/docs/tutorial/01_installation.md#hpc-dependencies)**</sup></sub> | <sub><sup>**[Add your first node and its platform repository](/docs/tutorial/02_first_node.md#add-first-node)**</sup></sub> | <sub><sup>**[Provision our web services platform](/docs/tutorial/03_scale.md#provision)**</sup></sub> | <sub><sup>**[Hello test framework](/docs/tutorial/04_test.md#framework)**</sup></sub> | <sub><sup>**[Create your plugins' repository](/docs/tutorial/05_extend_with_plugins.md#plugins-repo)**</sup></sub> |
|
1129
|
+
| <sub><sup>**[Prerequisites](/docs/tutorial.md#prerequisites)**</sup></sub> | <sub><sup>**[Our platforms' main repository](/docs/tutorial/01_installation.md#main-repo)**</sup></sub> | <sub><sup>**[Check and deploy services on this node](/docs/tutorial/02_first_node.md#check-deploy)**</sup></sub> | <sub><sup>**[Run commands on our new web services](/docs/tutorial/03_scale.md#run)**</sup></sub> | <sub><sup>**[Testing your nodes](/docs/tutorial/04_test.md#nodes-tests)**</sup></sub> | <sub><sup>**[Your own platform handler](/docs/tutorial/05_extend_with_plugins.md#platform-handler)**</sup></sub> |
|
1130
|
+
| <sub><sup>**[Tutorial setup](/docs/tutorial.md#tutorial-setup)**</sup></sub> | | <sub><sup>**[Updating the configuration](/docs/tutorial/02_first_node.md#update)**</sup></sub> | <sub><sup>**[Check and deploy our web services on several nodes at once](/docs/tutorial/03_scale.md#check-deploy)**</sup></sub> | <sub><sup>**[Testing your platforms' configuration](/docs/tutorial/04_test.md#platforms-tests)**</sup></sub> | <sub><sup>**[Write your own tests](/docs/tutorial/05_extend_with_plugins.md#test)**</sup></sub> |
|
1131
|
+
| | | | | <sub><sup>**[Other kinds of tests](/docs/tutorial/04_test.md#other-tests)**</sup></sub> | <sub><sup>**[Enough of stdout, we want to report to other tools](/docs/tutorial/05_extend_with_plugins.md#report)**</sup></sub> |
|
1132
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
yaml_inventory_platform path: "#{Dir.home}/hpc_tutorial/my-service-conf-repo"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
---
|
2
|
+
local:
|
3
|
+
metadata:
|
4
|
+
# This is a simple description of the node
|
5
|
+
description: The local environment
|
6
|
+
# This node is localhost, so here we'll use the local connector, not ssh.
|
7
|
+
local_node: true
|
8
|
+
# Some other metadata, specific to this node and that can be used by later processes
|
9
|
+
service_port: 1107
|
10
|
+
service_timeout: 60
|
11
|
+
# The list of service names this node should have
|
12
|
+
services:
|
13
|
+
- my-service
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Get the wanted content of the configuration file as a String, based on the node's metadata
|
2
|
+
#
|
3
|
+
# Parameters::
|
4
|
+
# * *node* (String): Node for which we configure our service
|
5
|
+
# Result::
|
6
|
+
# * String: The wanted content
|
7
|
+
def wanted_conf_for(node)
|
8
|
+
# We will access the node's metadata using the NodesHandler API, through the @nodes_handler object
|
9
|
+
@service_port = @nodes_handler.get_service_port_of(node)
|
10
|
+
@service_timeout = @nodes_handler.get_service_timeout_of(node)
|
11
|
+
# We use erubis to generate the configuration from our eRuby template, and return it directly
|
12
|
+
Erubis::Eruby.new(File.read("#{@platform_handler.repository_path}/my-service.conf.erb")).result(binding)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get actions to check the node's service against the wanted content
|
16
|
+
#
|
17
|
+
# Parameters::
|
18
|
+
# * *node* (String): Node on which we check the service
|
19
|
+
# Result::
|
20
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
21
|
+
def check(node)
|
22
|
+
# We first dump the wanted content in a temporary file and then we diff it.
|
23
|
+
[
|
24
|
+
{
|
25
|
+
remote_bash: <<~EOS
|
26
|
+
cat <<EOF >/tmp/my-service.conf.wanted
|
27
|
+
#{wanted_conf_for(node)}
|
28
|
+
EOF
|
29
|
+
echo Diffs on my-service.conf:
|
30
|
+
if test -f ~/hpc_tutorial/node/my-service.conf; then
|
31
|
+
diff ~/hpc_tutorial/node/my-service.conf /tmp/my-service.conf.wanted || true
|
32
|
+
else
|
33
|
+
echo "Create file from scratch"
|
34
|
+
cat /tmp/my-service.conf.wanted
|
35
|
+
fi
|
36
|
+
EOS
|
37
|
+
}
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get actions to deploy the node's service against the wanted content
|
42
|
+
#
|
43
|
+
# Parameters::
|
44
|
+
# * *node* (String): Node on which we deploy the service
|
45
|
+
# Result::
|
46
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
47
|
+
def deploy(node)
|
48
|
+
# We first check, as this will display diffs and prepare the file to be copied.
|
49
|
+
# And then we really deploy the file on our node.
|
50
|
+
check(node) + [
|
51
|
+
{
|
52
|
+
remote_bash: <<~EOS
|
53
|
+
mkdir -p ~/hpc_tutorial/node
|
54
|
+
cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
|
55
|
+
EOS
|
56
|
+
}
|
57
|
+
]
|
58
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
yaml_inventory_platform path: "#{Dir.home}/hpc_tutorial/my-service-conf-repo"
|
@@ -0,0 +1,90 @@
|
|
1
|
+
---
|
2
|
+
local:
|
3
|
+
metadata:
|
4
|
+
description: The local environment
|
5
|
+
local_node: true
|
6
|
+
service_port: 1107
|
7
|
+
service_timeout: 60
|
8
|
+
services:
|
9
|
+
- my-service
|
10
|
+
web1:
|
11
|
+
metadata:
|
12
|
+
description: Web service nbr 1
|
13
|
+
hostname: web1.hpc_tutorial.org
|
14
|
+
planet: Mercury
|
15
|
+
service_port: 1201
|
16
|
+
service_timeout: 60
|
17
|
+
services:
|
18
|
+
- web-hello
|
19
|
+
- my-service
|
20
|
+
web2:
|
21
|
+
metadata:
|
22
|
+
description: Web service nbr 2
|
23
|
+
hostname: web2.hpc_tutorial.org
|
24
|
+
planet: Venus
|
25
|
+
service_port: 1202
|
26
|
+
service_timeout: 60
|
27
|
+
services:
|
28
|
+
- web-hello
|
29
|
+
- my-service
|
30
|
+
web3:
|
31
|
+
metadata:
|
32
|
+
description: Web service nbr 3
|
33
|
+
hostname: web3.hpc_tutorial.org
|
34
|
+
planet: Earth
|
35
|
+
service_port: 1203
|
36
|
+
service_timeout: 60
|
37
|
+
services:
|
38
|
+
- web-hello
|
39
|
+
- my-service
|
40
|
+
web4:
|
41
|
+
metadata:
|
42
|
+
description: Web service nbr 4
|
43
|
+
hostname: web4.hpc_tutorial.org
|
44
|
+
planet: Mars
|
45
|
+
service_port: 1204
|
46
|
+
service_timeout: 60
|
47
|
+
services:
|
48
|
+
- web-hello
|
49
|
+
- my-service
|
50
|
+
web5:
|
51
|
+
metadata:
|
52
|
+
description: Web service nbr 5
|
53
|
+
hostname: web5.hpc_tutorial.org
|
54
|
+
planet: Jupiter
|
55
|
+
service_port: 1205
|
56
|
+
service_timeout: 60
|
57
|
+
services:
|
58
|
+
- web-hello
|
59
|
+
- my-service
|
60
|
+
web6:
|
61
|
+
metadata:
|
62
|
+
description: Web service nbr 6
|
63
|
+
hostname: web6.hpc_tutorial.org
|
64
|
+
services:
|
65
|
+
- web-hello
|
66
|
+
web7:
|
67
|
+
metadata:
|
68
|
+
description: Web service nbr 7
|
69
|
+
hostname: web7.hpc_tutorial.org
|
70
|
+
services:
|
71
|
+
- web-hello
|
72
|
+
web8:
|
73
|
+
metadata:
|
74
|
+
description: Web service nbr 8
|
75
|
+
hostname: web8.hpc_tutorial.org
|
76
|
+
services:
|
77
|
+
- web-hello
|
78
|
+
web9:
|
79
|
+
metadata:
|
80
|
+
description: Web service nbr 9
|
81
|
+
hostname: web9.hpc_tutorial.org
|
82
|
+
services:
|
83
|
+
- web-hello
|
84
|
+
web10:
|
85
|
+
metadata:
|
86
|
+
description: Web service nbr 10
|
87
|
+
hostname: web10.hpc_tutorial.org
|
88
|
+
# The list of service names this node should have
|
89
|
+
services:
|
90
|
+
- web-hello
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# Get the wanted content of the configuration file as a String, based on the node's metadata
|
2
|
+
#
|
3
|
+
# Parameters::
|
4
|
+
# * *node* (String): Node for which we configure our service
|
5
|
+
# Result::
|
6
|
+
# * String: The wanted content
|
7
|
+
def wanted_conf_for(node)
|
8
|
+
# We will access the node's metadata using the NodesHandler API, through the @nodes_handler object
|
9
|
+
@service_port = @nodes_handler.get_service_port_of(node)
|
10
|
+
@service_timeout = @nodes_handler.get_service_timeout_of(node)
|
11
|
+
# We use erubis to generate the configuration from our eRuby template, and return it directly
|
12
|
+
Erubis::Eruby.new(File.read("#{@platform_handler.repository_path}/my-service.conf.erb")).result(binding)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get actions to check the node's service against the wanted content
|
16
|
+
#
|
17
|
+
# Parameters::
|
18
|
+
# * *node* (String): Node on which we check the service
|
19
|
+
# Result::
|
20
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
21
|
+
def check(node)
|
22
|
+
# We first dump the wanted content in a temporary file and then we diff it.
|
23
|
+
[
|
24
|
+
{
|
25
|
+
remote_bash: <<~EOS
|
26
|
+
cat <<EOF >/tmp/my-service.conf.wanted
|
27
|
+
#{wanted_conf_for(node)}
|
28
|
+
EOF
|
29
|
+
echo Diffs on my-service.conf:
|
30
|
+
if test -f ~/hpc_tutorial/node/my-service.conf; then
|
31
|
+
diff ~/hpc_tutorial/node/my-service.conf /tmp/my-service.conf.wanted || true
|
32
|
+
else
|
33
|
+
echo "Create file from scratch"
|
34
|
+
cat /tmp/my-service.conf.wanted
|
35
|
+
fi
|
36
|
+
EOS
|
37
|
+
}
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
# Get actions to deploy the node's service against the wanted content
|
42
|
+
#
|
43
|
+
# Parameters::
|
44
|
+
# * *node* (String): Node on which we deploy the service
|
45
|
+
# Result::
|
46
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
47
|
+
def deploy(node)
|
48
|
+
# We first check, as this will display diffs and prepare the file to be copied.
|
49
|
+
# And then we really deploy the file on our node.
|
50
|
+
check(node) + [
|
51
|
+
{
|
52
|
+
remote_bash: <<~EOS
|
53
|
+
mkdir -p ~/hpc_tutorial/node
|
54
|
+
cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
|
55
|
+
EOS
|
56
|
+
}
|
57
|
+
]
|
58
|
+
end
|