hybrid_platforms_conductor 32.11.1 → 32.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1115 -0
- data/LICENSE.md +31 -0
- data/README.md +395 -0
- data/bin/setup +1 -1
- data/docs/api.md +349 -0
- data/docs/config_dsl.md +315 -0
- data/docs/executables.md +226 -0
- data/docs/executables/check-node.md +155 -0
- data/docs/executables/deploy.md +198 -0
- data/docs/executables/dump_nodes_json.md +110 -0
- data/docs/executables/free_ips.md +93 -0
- data/docs/executables/free_veids.md +73 -0
- data/docs/executables/get_impacted_nodes.md +94 -0
- data/docs/executables/last_deploys.md +114 -0
- data/docs/executables/nodes_to_deploy.md +139 -0
- data/docs/executables/report.md +159 -0
- data/docs/executables/run.md +126 -0
- data/docs/executables/setup.md +92 -0
- data/docs/executables/ssh_config.md +151 -0
- data/docs/executables/test.md +213 -0
- data/docs/executables/topograph.md +139 -0
- data/docs/gen/mermaid/README.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/check-node.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_ips.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/free_veids.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/get_impacted_nodes.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/last_deploys.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/nodes_to_deploy.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/report.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/run.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/setup.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/ssh_config.md-0.png +0 -0
- data/docs/gen/mermaid/docs/executables/test.md-0.png +0 -0
- data/docs/install.md +161 -0
- data/docs/plugins.md +215 -0
- data/docs/plugins/action/bash.md +37 -0
- data/docs/plugins/action/interactive.md +37 -0
- data/docs/plugins/action/remote_bash.md +67 -0
- data/docs/plugins/action/ruby.md +69 -0
- data/docs/plugins/action/scp.md +61 -0
- data/docs/plugins/cmdb/config.md +46 -0
- data/docs/plugins/cmdb/host_ip.md +33 -0
- data/docs/plugins/cmdb/host_keys.md +33 -0
- data/docs/plugins/cmdb/platform_handlers.md +33 -0
- data/docs/plugins/connector/local.md +28 -0
- data/docs/plugins/connector/ssh.md +95 -0
- data/docs/plugins/platform_handler/yaml_inventory.md +105 -0
- data/docs/plugins/provisioner/docker.md +27 -0
- data/docs/plugins/provisioner/podman.md +27 -0
- data/docs/plugins/provisioner/proxmox.md +115 -0
- data/docs/plugins/report/confluence.md +49 -0
- data/docs/plugins/report/mediawiki.md +28 -0
- data/docs/plugins/report/stdout.md +32 -0
- data/docs/plugins/test/bitbucket_conf.md +97 -0
- data/docs/plugins/test/can_be_checked.md +27 -0
- data/docs/plugins/test/check_deploy_and_idempotence.md +61 -0
- data/docs/plugins/test/check_from_scratch.md +28 -0
- data/docs/plugins/test/connection.md +27 -0
- data/docs/plugins/test/deploy_freshness.md +27 -0
- data/docs/plugins/test/deploy_from_scratch.md +28 -0
- data/docs/plugins/test/deploy_removes_root_access.md +29 -0
- data/docs/plugins/test/divergence.md +41 -0
- data/docs/plugins/test/executables.md +26 -0
- data/docs/plugins/test/file_system.md +49 -0
- data/docs/plugins/test/file_system_hdfs.md +65 -0
- data/docs/plugins/test/hostname.md +27 -0
- data/docs/plugins/test/idempotence.md +56 -0
- data/docs/plugins/test/ip.md +28 -0
- data/docs/plugins/test/jenkins_ci_conf.md +54 -0
- data/docs/plugins/test/jenkins_ci_masters_ok.md +54 -0
- data/docs/plugins/test/linear_strategy.md +26 -0
- data/docs/plugins/test/local_users.md +48 -0
- data/docs/plugins/test/mounts.md +55 -0
- data/docs/plugins/test/orphan_files.md +38 -0
- data/docs/plugins/test/ports.md +50 -0
- data/docs/plugins/test/private_ips.md +27 -0
- data/docs/plugins/test/public_ips.md +27 -0
- data/docs/plugins/test/spectre.md +26 -0
- data/docs/plugins/test/veids.md +27 -0
- data/docs/plugins/test/vulnerabilities.md +65 -0
- data/docs/plugins/test_report/confluence.md +43 -0
- data/docs/plugins/test_report/stdout.md +26 -0
- data/docs/plugins_create.md +135 -0
- data/docs/tutorial.md +61 -0
- data/docs/tutorial/01_installation.md +131 -0
- data/docs/tutorial/02_first_node.md +468 -0
- data/docs/tutorial/03_scale.md +878 -0
- data/docs/tutorial/04_test.md +977 -0
- data/docs/tutorial/05_extend_with_plugins.md +1132 -0
- data/examples/bare/Gemfile +4 -0
- data/examples/bare/hpc_config.rb +2 -0
- data/examples/localhost/Gemfile +4 -0
- data/examples/localhost/hpc_config.rb +2 -0
- data/examples/localhost/inventory.yaml +4 -0
- 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/actions_executor.rb +1 -0
- data/lib/hybrid_platforms_conductor/deployer.rb +3 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/remote_bash.rb +29 -13
- data/lib/hybrid_platforms_conductor/hpc_plugins/action/scp.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/local.rb +98 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/my_connector.rb.sample +2 -2
- data/lib/hybrid_platforms_conductor/hpc_plugins/connector/ssh.rb +15 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/platform_handler_plugin.rb.sample +5 -5
- data/lib/hybrid_platforms_conductor/hpc_plugins/platform_handler/yaml_inventory.rb +140 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/provisioner/proxmox.rb +6 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/report/templates/confluence_inventory.html.erb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/bitbucket_conf.rb +4 -4
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_freshness.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/deploy_removes_root_access.rb +19 -17
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/divergence.rb +3 -0
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/hostname.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/ip.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/local_users.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/mounts.rb +4 -3
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/orphan_files.rb +2 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/spectre.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test/vulnerabilities.rb +8 -7
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/confluence.rb +1 -1
- data/lib/hybrid_platforms_conductor/hpc_plugins/test_report/templates/confluence.html.erb +1 -1
- data/lib/hybrid_platforms_conductor/json_dumper.rb +1 -1
- data/lib/hybrid_platforms_conductor/platform_handler.rb +1 -1
- data/lib/hybrid_platforms_conductor/services_handler.rb +18 -16
- data/lib/hybrid_platforms_conductor/tests_runner.rb +0 -1
- data/lib/hybrid_platforms_conductor/topographer.rb +0 -1
- data/lib/hybrid_platforms_conductor/version.rb +1 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/actions/remote_bash_spec.rb +16 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/connectable_nodes_spec.rb +30 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/local/remote_actions_spec.rb +113 -0
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/cli_options_spec.rb +6 -2
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/global_helpers_spec.rb +38 -1
- data/spec/hybrid_platforms_conductor_test/api/actions_executor/connectors/ssh/remote_actions_spec.rb +37 -4
- data/spec/hybrid_platforms_conductor_test/docs_spec.rb +10 -0
- data/tools/check_md +89 -0
- data/tools/generate_mermaid +75 -0
- metadata +337 -12
data/docs/tutorial.md
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Tutorial
|
2
|
+
|
3
|
+
Here is a simple step-by-step tutorial that will show you where Hybrid Platforms Conductor can be useful to you, and how to use it to strengthen your DevOps processes.
|
4
|
+
|
5
|
+
<a name="use-case"></a>
|
6
|
+
## Use-case
|
7
|
+
|
8
|
+
**Congratulations!** You are just appointed DevOps team member, and you are **in charge of the different processes and platforms useful to your development and operations teams**! Let's make them robust and agile!
|
9
|
+
|
10
|
+
You'll start small, by delevering small increments, and scaling little-by-little both your processes and platforms.
|
11
|
+
|
12
|
+
In the end you will achieve performing **robust DevOps processes on various platforms using different technologies, and wrapping complex deployment/test/monitoring tasks in a very efficient and agile way**.
|
13
|
+
|
14
|
+
You'll learn:
|
15
|
+
1. [How to **install** and setup Hybrid Platforms Conductor.](tutorial/01_installation.md)
|
16
|
+
2. [How to **deploy and check** easily 1 node using existing plugins. See basic concepts and processes.](tutorial/02_first_node.md)
|
17
|
+
3. [How to **scale** the process from 1 node to other ones, using other plugins. See how heterogenous environments and technologies integrate together.](tutorial/03_scale.md)
|
18
|
+
4. [How to **test and monitor** your processes. See how easy and robust it is to integrate that in a CI/CD.](tutorial/04_test.md)
|
19
|
+
5. [How to **extend** the functionalities and adapt them to your very own technological choices by writing your own plugins easily.](tutorial/05_extend_with_plugins.md)
|
20
|
+
|
21
|
+
<a name="prerequisites"></a>
|
22
|
+
## Prerequisites
|
23
|
+
|
24
|
+
**Docker**: This tutorial requires a Linux distribution in which Docker is installed. Installing Docker is beyond the scope of this tutorial, so please refer to [the official Docker documentation](https://docs.docker.com/engine/install/) to know how to install Docker in your Linux distribution. To check that Docker is correctly installed, you should be able to run `docker run hello-world` and not run into any error.
|
25
|
+
|
26
|
+
<a name="tutorial-setup"></a>
|
27
|
+
## Tutorial setup
|
28
|
+
|
29
|
+
This tutorial will use a dedicated Docker container to perform all operations to ensure you won't mess up with your system. However you can also consider installing Hybrid Platforms Conductor directly in your system without using Docker. Please make note however that Docker will be used to provisioned test nodes later in this tutorial.
|
30
|
+
|
31
|
+
To provision a simple Docker image to install and run this tutorial, we will use a Debian buster image to create a Docker container named `hpc_tutorial`:
|
32
|
+
```bash
|
33
|
+
docker create --name hpc_tutorial -it -v /var/run/docker.sock:/var/run/docker.sock debian:buster /bin/bash
|
34
|
+
```
|
35
|
+
|
36
|
+
Now everytime you need to access this tutorial container, issue the following:
|
37
|
+
```bash
|
38
|
+
docker start -ai hpc_tutorial
|
39
|
+
```
|
40
|
+
|
41
|
+
The tutorial assumes that all of the Hybrid Platforms Conductor commands will be executed from the bash instance of this `hpc_tutorial` container, as `root`.
|
42
|
+
|
43
|
+
All steps, command lines and files creations are explicitly detailed in the tutorial steps.
|
44
|
+
No previous knowledge of Ruby is required to get through this tutorial.
|
45
|
+
|
46
|
+
If in doubt, you can always refer to the [tutorial example folder](../examples/tutorial) to check files content.
|
47
|
+
Please note however that the content of this example tutorial folder maps the content of the files at the end of each section of the tutorial (numberd from 01 to 05), and intermediate steps in the tutorial can modify such files.
|
48
|
+
So the tutorial example folders may not reflect the expected content at an intermediate tutorial step.
|
49
|
+
|
50
|
+
**[Next >> Let's start by the first step: installation of your Hybrid Platforms Conductor's environment](tutorial/01_installation.md)**
|
51
|
+
|
52
|
+
---
|
53
|
+
**<p style="text-align: center;">Tutorial navigation</p>**
|
54
|
+
|
55
|
+
| <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><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> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
56
|
+
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
57
|
+
| <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> |
|
58
|
+
| <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> |
|
59
|
+
| <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> |
|
60
|
+
| | | | | <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> |
|
61
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
@@ -0,0 +1,131 @@
|
|
1
|
+
|
2
|
+
---
|
3
|
+
**<p style="text-align: center;">Tutorial navigation</p>**
|
4
|
+
|
5
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><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> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
6
|
+
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
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
|
+
|
13
|
+
# 1. Installation and first-time setup
|
14
|
+
|
15
|
+
This step basically follows the [installation documentation](/docs/install.md). Please refer to it for more details if needed.
|
16
|
+
|
17
|
+
<a name="hpc-dependencies"></a>
|
18
|
+
## Dependencies installation
|
19
|
+
|
20
|
+
First we install a few tools that Hybrid Platforms Conductor needs to be installed.
|
21
|
+
|
22
|
+
Hybrid Platforms Conductor needs **[Ruby](https://www.ruby-lang.org/)** to run. Let's install it:
|
23
|
+
```bash
|
24
|
+
apt update
|
25
|
+
apt install -y wget build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-compat-dev bison
|
26
|
+
cd
|
27
|
+
mkdir ruby
|
28
|
+
cd ruby
|
29
|
+
wget https://cache.ruby-lang.org/pub/ruby/2.7/ruby-2.7.3.tar.gz
|
30
|
+
tar xvzf ruby-2.7.3.tar.gz
|
31
|
+
cd ruby-2.7.3
|
32
|
+
./configure
|
33
|
+
make
|
34
|
+
make install
|
35
|
+
cd ../..
|
36
|
+
```
|
37
|
+
|
38
|
+
You can check that ruby is installed like that:
|
39
|
+
```bash
|
40
|
+
ruby -v
|
41
|
+
# => ruby 2.7.3p183 (2021-04-05 revision 6847ee089d) [x86_64-linux]
|
42
|
+
```
|
43
|
+
|
44
|
+
Then we need some dependencies (git, docker...)
|
45
|
+
```bash
|
46
|
+
# Install Docker repository
|
47
|
+
apt install -y apt-transport-https ca-certificates curl software-properties-common
|
48
|
+
curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
|
49
|
+
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
|
50
|
+
apt update
|
51
|
+
|
52
|
+
# Install system dependencies
|
53
|
+
apt install -y docker-ce git
|
54
|
+
```
|
55
|
+
|
56
|
+
You can check that those dependencies are installed correctly with:
|
57
|
+
```bash
|
58
|
+
git --version
|
59
|
+
# => git version 2.20.1
|
60
|
+
docker -v
|
61
|
+
# => Docker version 20.10.6, build 370c289
|
62
|
+
```
|
63
|
+
|
64
|
+
<a name="main-repo"></a>
|
65
|
+
## Our platforms' main repository
|
66
|
+
|
67
|
+
Then we create a Ruby project directory in which we put:
|
68
|
+
* The file giving our project's dependencies (mainly the `hybrid_platforms_conductor` gem): it is called **`Gemfile`** and is the standard way to define Ruby project's dependencies using [bundler](https://bundler.io/).
|
69
|
+
* The entry point of our Hybrid Platforms Conductor's configuration: the **`hpc_config.rb`** configuration file. For now it will be empty, and we will edit it later.
|
70
|
+
```bash
|
71
|
+
cd
|
72
|
+
mkdir -p hpc_tutorial/my-platforms
|
73
|
+
cd hpc_tutorial/my-platforms
|
74
|
+
cat <<EOF >Gemfile
|
75
|
+
source 'http://rubygems.org'
|
76
|
+
|
77
|
+
gem 'hybrid_platforms_conductor'
|
78
|
+
EOF
|
79
|
+
touch hpc_config.rb
|
80
|
+
```
|
81
|
+
|
82
|
+
Please note that by default all commands starting from here in this tutorial should be run from this `hpc_tutorial/my-platforms` directory unless stated otherwise.
|
83
|
+
|
84
|
+
We will then install the `hybrid_platforms_conductor` gem using the bundler tool:
|
85
|
+
```bash
|
86
|
+
# Make sure installed dependencies are local to this directory to not pollute system installation
|
87
|
+
bundle config set --local path vendor/bundle
|
88
|
+
|
89
|
+
# Install hybrid_platforms_conductor along with all its dependencies
|
90
|
+
bundle install
|
91
|
+
# =>
|
92
|
+
# [...]
|
93
|
+
# Fetching tty-command 0.10.1
|
94
|
+
# Installing tty-command 0.10.1
|
95
|
+
# Fetching hybrid_platforms_conductor 32.12.0
|
96
|
+
# Installing hybrid_platforms_conductor 32.12.0
|
97
|
+
# Bundle complete! 1 Gemfile dependency, 45 gems now installed.
|
98
|
+
# Bundled gems are installed into `./vendor/bundle`
|
99
|
+
|
100
|
+
# Generate executable helpers for the hybrid_platforms_conductor gem in the ./bin directory
|
101
|
+
bundle binstubs hybrid_platforms_conductor
|
102
|
+
```
|
103
|
+
|
104
|
+
You can check that the installation is correct by issuing the [`report` executable](/docs/executables/report.md), which should report an empty inventory for now:
|
105
|
+
```bash
|
106
|
+
./bin/report
|
107
|
+
# =>
|
108
|
+
# +------+----------+-----------+----+-----------+----+-------------+----------+
|
109
|
+
# | Node | Platform | Host name | IP | Physical? | OS | Description | Services |
|
110
|
+
# +------+----------+-----------+----+-----------+----+-------------+----------+
|
111
|
+
# +------+----------+-----------+----+-----------+----+-------------+----------+
|
112
|
+
```
|
113
|
+
|
114
|
+
The installation and setup are finished!
|
115
|
+
|
116
|
+
Now we are ready to fill in this empty inventory and use the whole power brought by the Hybrid Platforms Conductor to manage our platforms.
|
117
|
+
|
118
|
+
*Files that have been covered in this section can be checked in [this example tutorial folder](/examples/tutorial/01_installation).*
|
119
|
+
|
120
|
+
**[Next >> Check and deploy your first node](/docs/tutorial/02_first_node.md)**
|
121
|
+
|
122
|
+
---
|
123
|
+
**<p style="text-align: center;">Tutorial navigation</p>**
|
124
|
+
|
125
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><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> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
126
|
+
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
127
|
+
| <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> |
|
128
|
+
| <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> |
|
129
|
+
| <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> |
|
130
|
+
| | | | | <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> |
|
131
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|
@@ -0,0 +1,468 @@
|
|
1
|
+
|
2
|
+
---
|
3
|
+
**<p style="text-align: center;">Tutorial navigation</p>**
|
4
|
+
|
5
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><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> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
6
|
+
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
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
|
+
|
13
|
+
# 2. Deploy and check a first node
|
14
|
+
|
15
|
+
As a first platform, we will consider our own **local environment**: we want to **control the configuration files of a service we use there**.
|
16
|
+
|
17
|
+
Let's imagine we are having a service running on our local environment, and that this service depends on a configuration file stored in `~/hpc_tutorial/node/my-service.conf`.
|
18
|
+
`~/hpc_tutorial/node/my-service.conf` is a simple key-value configuration file like this:
|
19
|
+
```
|
20
|
+
service-port: 1107
|
21
|
+
service-timeout: 30
|
22
|
+
service-logs: stdout
|
23
|
+
```
|
24
|
+
|
25
|
+
As a good DevOps team member, you want to make sure that:
|
26
|
+
* This configuration file's content is **tracked under a Source Control Management (git)**, so that modifications to it are being tracked.
|
27
|
+
* You can **check easily whether the file in our environment has diverged** from what is stored in the configuration git repository.
|
28
|
+
* You can can **align the file in our environment** with what is stored in the configuration git repository (aka deployment).
|
29
|
+
* You can **check when the file has been deployed, and what changes have been applied**.
|
30
|
+
* The **processes** involved in checking and deploying your configuration **can be automatically tested** so that they can be part of CI/CD workflows.
|
31
|
+
|
32
|
+
Doing those processes manually can be very tedious and error-prone.
|
33
|
+
Those are the processes Hybrid Platforms Conductor will help you achieve in a simple and agile way.
|
34
|
+
|
35
|
+
Let's start!
|
36
|
+
|
37
|
+
<a name="add-first-node"></a>
|
38
|
+
## Add your first node and its platform repository
|
39
|
+
|
40
|
+
We start by creating a new repository that will store our nodes' inventory and the service configuration. For the sake of this tutorial, we will store this repository in `~/hpc_tutorial/my-service-conf-repo`.
|
41
|
+
We won't use complex Configuration Management System here like Chef, Puppet or Ansible. Simple bash scripts will be able to do the job, and we will use the [`yaml_inventory` platform handler](/docs/plugins/platform_handler/yaml_inventory.md) to handle this configuration.
|
42
|
+
|
43
|
+
We initialize the configuration repository:
|
44
|
+
```bash
|
45
|
+
mkdir -p ~/hpc_tutorial/my-service-conf-repo
|
46
|
+
```
|
47
|
+
|
48
|
+
We create the inventory file in this repository. Here we define a node named `local` that has some metadata associated to it. This metadata will be used when generating the service configuration file.
|
49
|
+
```bash
|
50
|
+
cat <<EOF >~/hpc_tutorial/my-service-conf-repo/inventory.yaml
|
51
|
+
---
|
52
|
+
local:
|
53
|
+
metadata:
|
54
|
+
# This is a simple description of the node
|
55
|
+
description: The local environment
|
56
|
+
# This node is localhost, so here we'll use the local connector, not ssh.
|
57
|
+
local_node: true
|
58
|
+
# Some other metadata, specific to this node and that can be used by later processes
|
59
|
+
service_port: 1107
|
60
|
+
service_timeout: 30
|
61
|
+
# The list of service names this node should have
|
62
|
+
services:
|
63
|
+
- my-service
|
64
|
+
EOF
|
65
|
+
```
|
66
|
+
|
67
|
+
We can already register this new platform in our main Hybrid Platforms Conductor configuration file `hpc_config.rb`:
|
68
|
+
```bash
|
69
|
+
cat <<EOF >hpc_config.rb
|
70
|
+
yaml_inventory_platform path: "#{Dir.home}/hpc_tutorial/my-service-conf-repo"
|
71
|
+
EOF
|
72
|
+
```
|
73
|
+
|
74
|
+
And we can check that our inventory is accessible in Hybrid Platform Conductor's processes:
|
75
|
+
```bash
|
76
|
+
./bin/report
|
77
|
+
# =>
|
78
|
+
# +-------+----------------------+-----------+----+-----------+----+-----------------------+------------+
|
79
|
+
# | Node | Platform | Host name | IP | Physical? | OS | Description | Services |
|
80
|
+
# +-------+----------------------+-----------+----+-----------+----+-----------------------+------------+
|
81
|
+
# | local | my-service-conf-repo | | | No | | The local environment | my-service |
|
82
|
+
# +-------+----------------------+-----------+----+-----------+----+-----------------------+------------+
|
83
|
+
```
|
84
|
+
|
85
|
+
We can already target it for commands to be run, using the [`run` executable](/docs/executables/run.md):
|
86
|
+
```bash
|
87
|
+
./bin/run --node local --command 'ls -la ~/hpc_tutorial'
|
88
|
+
# =>
|
89
|
+
# total 12
|
90
|
+
# drwxr-xr-x 3 root root 4096 Apr 27 14:23 .
|
91
|
+
# drwx------ 1 root root 4096 Apr 27 15:32 ..
|
92
|
+
# drwxr-xr-x 2 root root 4096 Apr 27 14:23 my-service-conf-repo
|
93
|
+
|
94
|
+
# Run an interactive command line in the node (will create a new bash session - exit it after)
|
95
|
+
./bin/run --node local --interactive
|
96
|
+
# => root@e8dddeb2ba25:/tmp/hpc_local_workspaces/local# exit
|
97
|
+
```
|
98
|
+
|
99
|
+
Here we initialized a platform repository to handle 1 node, and we defined its inventory. It's already enough for some processes to connect to this node, report its inventory and execute commands.
|
100
|
+
|
101
|
+
<a name="check-deploy"></a>
|
102
|
+
## Check and deploy services on this node
|
103
|
+
|
104
|
+
Now that our node exists and is accessible, time to deploy a service on it. Following our example, our service is as simple as 1 configuration file (`~/hpc_tutorial/node/my-service.conf`) that has to be generated during the deployment, using values from the node's metadata.
|
105
|
+
Of course the source of this configuration file is part of the platform repository configuring the service for our node.
|
106
|
+
|
107
|
+
For our example, we'll create a small [eRuby](https://en.wikipedia.org/wiki/ERuby) template for the configuration file. This template will use variables for the service port and timeout values. This way the values that should be deployed are taken from the node's metadata, and could be reused to other nodes with different metadata.
|
108
|
+
[eRuby](https://en.wikipedia.org/wiki/ERuby) is a very powerful templating engine that uses plain Ruby in its template placeholders.
|
109
|
+
```bash
|
110
|
+
cat <<EOF >~/hpc_tutorial/my-service-conf-repo/my-service.conf.erb
|
111
|
+
service-port: <%= @service_port %>
|
112
|
+
service-timeout: <%= @service_timeout %>
|
113
|
+
service-logs: stdout
|
114
|
+
EOF
|
115
|
+
```
|
116
|
+
|
117
|
+
Now we define how our service will check and deploy our template based on a node's metadata.
|
118
|
+
The logic in our case is very simple:
|
119
|
+
1. Both check and deploy first generate the real content of the wanted configuration file, based on the template and the node's metadata.
|
120
|
+
2. Both check and deploy verify the differences between that wanted content and the file's content on the node.
|
121
|
+
3. Deploy overwrites the file on the node with the wanted content if needed.
|
122
|
+
|
123
|
+
According to the [`yaml_inventory` platform handler](/docs/plugins/platform_handler/yaml_inventory.md), defining how to check and deploy a service with this plugin is done by creating a file named `service_<service_name>.rb` and defining 2 methods: `check` and `deploy`.
|
124
|
+
Let's do that!
|
125
|
+
|
126
|
+
We create the `~/hpc_tutorial/my-service-conf-repo/service_my-service.rb` file with the following content:
|
127
|
+
```ruby
|
128
|
+
# Get the wanted content of the configuration file as a String, based on the node's metadata
|
129
|
+
#
|
130
|
+
# Parameters::
|
131
|
+
# * *node* (String): Node for which we configure our service
|
132
|
+
# Result::
|
133
|
+
# * String: The wanted content
|
134
|
+
def wanted_conf_for(node)
|
135
|
+
# We will access the node's metadata using the NodesHandler API, through the @nodes_handler object
|
136
|
+
@service_port = @nodes_handler.get_service_port_of(node)
|
137
|
+
@service_timeout = @nodes_handler.get_service_timeout_of(node)
|
138
|
+
# We use erubis to generate the configuration from our eRuby template, and return it directly
|
139
|
+
Erubis::Eruby.new(File.read("#{@platform_handler.repository_path}/my-service.conf.erb")).result(binding)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Get actions to check the node's service against the wanted content
|
143
|
+
#
|
144
|
+
# Parameters::
|
145
|
+
# * *node* (String): Node on which we check the service
|
146
|
+
# Result::
|
147
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
148
|
+
def check(node)
|
149
|
+
# We first dump the wanted content in a temporary file and then we diff it.
|
150
|
+
[
|
151
|
+
{
|
152
|
+
remote_bash: <<~EOS
|
153
|
+
cat <<EOF >/tmp/my-service.conf.wanted
|
154
|
+
#{wanted_conf_for(node)}
|
155
|
+
EOF
|
156
|
+
echo Diffs on my-service.conf:
|
157
|
+
if test -f ~/hpc_tutorial/node/my-service.conf; then
|
158
|
+
diff ~/hpc_tutorial/node/my-service.conf /tmp/my-service.conf.wanted || true
|
159
|
+
else
|
160
|
+
echo "Create file from scratch"
|
161
|
+
cat /tmp/my-service.conf.wanted
|
162
|
+
fi
|
163
|
+
EOS
|
164
|
+
}
|
165
|
+
]
|
166
|
+
end
|
167
|
+
|
168
|
+
# Get actions to deploy the node's service against the wanted content
|
169
|
+
#
|
170
|
+
# Parameters::
|
171
|
+
# * *node* (String): Node on which we deploy the service
|
172
|
+
# Result::
|
173
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
174
|
+
def deploy(node)
|
175
|
+
# We first check, as this will display diffs and prepare the file to be copied.
|
176
|
+
# And then we really deploy the file on our node.
|
177
|
+
check(node) + [
|
178
|
+
{
|
179
|
+
remote_bash: <<~EOS
|
180
|
+
mkdir -p ~/hpc_tutorial/node
|
181
|
+
cp /tmp/my-service.conf.wanted ~/hpc_tutorial/node/my-service.conf
|
182
|
+
EOS
|
183
|
+
}
|
184
|
+
]
|
185
|
+
end
|
186
|
+
```
|
187
|
+
|
188
|
+
You can do it with the following command (copy/paste the above Ruby code in the here-doc):
|
189
|
+
```bash
|
190
|
+
cat <<EOF >~/hpc_tutorial/my-service-conf-repo/service_my-service.rb
|
191
|
+
# --- Copy-paste the previous Ruby code here ---
|
192
|
+
EOF
|
193
|
+
```
|
194
|
+
|
195
|
+
Now we can check our local node to get a status on our service, using the [`check-node` executable](/docs/executables/check-node.md):
|
196
|
+
```bash
|
197
|
+
./bin/check-node --node local
|
198
|
+
# =>
|
199
|
+
# ===== Packaging deployment ==== Begin...
|
200
|
+
# ===== Packaging deployment ==== ...End
|
201
|
+
#
|
202
|
+
# ===== Checking on 1 nodes ==== Begin...
|
203
|
+
# ===== [ local / my-service ] - HPC Service Check ===== Begin
|
204
|
+
# ===== [ local / my-service ] - HPC Service Check ===== Begin
|
205
|
+
# Diffs on my-service.conf:
|
206
|
+
# Create file from scratch
|
207
|
+
# service-port: 1107
|
208
|
+
# service-timeout: 30
|
209
|
+
# service-logs: stdout
|
210
|
+
#
|
211
|
+
# ===== [ local / my-service ] - HPC Service Check ===== End
|
212
|
+
# ===== [ local / my-service ] - HPC Service Check ===== End
|
213
|
+
# Executing actions [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
214
|
+
# ===== Checking on 1 nodes ==== ...End
|
215
|
+
```
|
216
|
+
|
217
|
+
Here we can already see in what has been reported by [`check-node`](/docs/executables/check-node.md) that `my-service.conf` file would be created with the following content:
|
218
|
+
```
|
219
|
+
service-port: 1107
|
220
|
+
service-timeout: 30
|
221
|
+
service-logs: stdout
|
222
|
+
```
|
223
|
+
That's perfectly normal, as we did not create the file at first.
|
224
|
+
|
225
|
+
So now is the time to deploy the file for real, using the [`deploy` executable](/docs/executables/deploy.md):
|
226
|
+
```bash
|
227
|
+
./bin/deploy --node local
|
228
|
+
# =>
|
229
|
+
# ===== Packaging deployment ==== Begin...
|
230
|
+
# ===== Packaging deployment ==== ...End
|
231
|
+
|
232
|
+
# ===== Deploying on 1 nodes ==== Begin...
|
233
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== Begin
|
234
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== Begin
|
235
|
+
# Diffs on my-service.conf:
|
236
|
+
# Create file from scratch
|
237
|
+
# service-port: 1107
|
238
|
+
# service-timeout: 30
|
239
|
+
# service-logs: stdout
|
240
|
+
|
241
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== End
|
242
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== End
|
243
|
+
# Executing actions [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
244
|
+
# ===== Saving deployment logs for 1 nodes ==== Begin...
|
245
|
+
# Executing actions [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
246
|
+
# ===== Saving deployment logs for 1 nodes ==== ...End
|
247
|
+
#
|
248
|
+
# ===== Deploying on 1 nodes ==== ...End
|
249
|
+
```
|
250
|
+
|
251
|
+
Here we can check already manually that the file has been created with the correct content:
|
252
|
+
```bash
|
253
|
+
cat ~/hpc_tutorial/node/my-service.conf
|
254
|
+
# =>
|
255
|
+
# service-port: 1107
|
256
|
+
# service-timeout: 30
|
257
|
+
# service-logs: stdout
|
258
|
+
```
|
259
|
+
|
260
|
+
And of course [`check-node`](/docs/executables/check-node.md) now reports no differences with the wanted configuration:
|
261
|
+
```bash
|
262
|
+
./bin/check-node --node local
|
263
|
+
# =>
|
264
|
+
# ===== Packaging deployment ==== Begin...
|
265
|
+
# ===== Packaging deployment ==== ...End
|
266
|
+
#
|
267
|
+
# ===== Checking on 1 nodes ==== Begin...
|
268
|
+
# ===== [ local / my-service ] - HPC Service Check ===== Begin
|
269
|
+
# ===== [ local / my-service ] - HPC Service Check ===== Begin
|
270
|
+
# Diffs on my-service.conf:
|
271
|
+
# ===== [ local / my-service ] - HPC Service Check ===== End
|
272
|
+
# ===== [ local / my-service ] - HPC Service Check ===== End
|
273
|
+
# Executing actions [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
274
|
+
# ===== Checking on 1 nodes ==== ...End
|
275
|
+
```
|
276
|
+
|
277
|
+
We can also check for the last deployment done on this node using the [`last_deploys` executable](/docs/executables/last_deploys.md):
|
278
|
+
```bash
|
279
|
+
./bin/last_deploys
|
280
|
+
# =>
|
281
|
+
# Getting deployment info [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
282
|
+
# +-------+---------------------+-------+------------+-------+
|
283
|
+
# | Node | Date | Admin | Services | Error |
|
284
|
+
# +-------+---------------------+-------+------------+-------+
|
285
|
+
# | local | 2021-04-27 16:37:24 | root | my-service | |
|
286
|
+
# +-------+---------------------+-------+------------+-------+
|
287
|
+
```
|
288
|
+
You see that a few seconds ago, `root` has deployed the `my-service` service on the `local` node.
|
289
|
+
|
290
|
+
So now we have very simple interfaces to check and deploy configuration on our node.
|
291
|
+
|
292
|
+
Let's see how we deal with changes!
|
293
|
+
|
294
|
+
<a name="update"></a>
|
295
|
+
## Updating the configuration
|
296
|
+
|
297
|
+
When maintaining your platforms, you want to make sure changes are persisted in your configuration repository.
|
298
|
+
Let's do that with [git](https://git-scm.com/).
|
299
|
+
|
300
|
+
First, create a first commit with our current configuration that has just been deployed:
|
301
|
+
```bash
|
302
|
+
cd ~/hpc_tutorial/my-service-conf-repo
|
303
|
+
git init .
|
304
|
+
git config user.name "Your Name"
|
305
|
+
git config user.email "you@example.com"
|
306
|
+
git add inventory.yaml my-service.conf.erb service_my-service.rb
|
307
|
+
git commit -m"First version of our configuration"
|
308
|
+
# =>
|
309
|
+
# [master (root-commit) 8d0fd6c] First version of our configuration
|
310
|
+
# 3 files changed, 74 insertions(+)
|
311
|
+
# create mode 100644 inventory.yaml
|
312
|
+
# create mode 100644 my-service.conf.erb
|
313
|
+
# create mode 100644 service_my-service.rb
|
314
|
+
cd -
|
315
|
+
```
|
316
|
+
|
317
|
+
In a real-world example, such git repository would be pushed on a team repository where other DevOps would contribute.
|
318
|
+
In our tutorial, we will simplify the development workflow by simply adding commits to our repository.
|
319
|
+
|
320
|
+
So let's modify the configuration by updating the node's metadata in its inventory. Let's say timeout of 30 is too small, we have to increase it to 60.
|
321
|
+
|
322
|
+
First we perform the change in the configuration repository, and create a new commit out of it:
|
323
|
+
```bash
|
324
|
+
sed -i 's/ service_timeout: 30/ service_timeout: 60/g' ~/hpc_tutorial/my-service-conf-repo/inventory.yaml
|
325
|
+
cd ~/hpc_tutorial/my-service-conf-repo
|
326
|
+
git add inventory.yaml
|
327
|
+
git commit -m"Increasing timeout for my-service"
|
328
|
+
# =>
|
329
|
+
# [master 6fe23cc] Increasing timeout for my-service
|
330
|
+
# 1 file changed, 1 insertion(+), 1 deletion(-)
|
331
|
+
cd -
|
332
|
+
```
|
333
|
+
|
334
|
+
Then let's check what [`check-node`](/docs/executables/check-node.md) reports as differences:
|
335
|
+
```bash
|
336
|
+
./bin/check-node --node local
|
337
|
+
# ===== Packaging deployment ==== Begin...
|
338
|
+
# ===== Packaging deployment ==== ...End
|
339
|
+
#
|
340
|
+
# ===== Checking on 1 nodes ==== Begin...
|
341
|
+
# ===== [ local / my-service ] - HPC Service Check ===== Begin
|
342
|
+
# ===== [ local / my-service ] - HPC Service Check ===== Begin
|
343
|
+
# Diffs on my-service.conf:
|
344
|
+
# 2c2
|
345
|
+
# < service-timeout: 30
|
346
|
+
# ---
|
347
|
+
# > service-timeout: 60
|
348
|
+
# ===== [ local / my-service ] - HPC Service Check ===== End
|
349
|
+
# ===== [ local / my-service ] - HPC Service Check ===== End
|
350
|
+
# Executing actions [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
351
|
+
# ===== Checking on 1 nodes ==== ...End
|
352
|
+
```
|
353
|
+
We see that indeed the `my-service.conf` would have the following differences if it were to be deployed, which is expected:
|
354
|
+
```
|
355
|
+
# 2c2
|
356
|
+
# < service-timeout: 30
|
357
|
+
# ---
|
358
|
+
# > service-timeout: 60
|
359
|
+
```
|
360
|
+
|
361
|
+
This check process would also spot differences that would have been applied manually on the node by an operator.
|
362
|
+
[`check-node` executable](/docs/executables/check-node.md) is a great way to make sure your nodes won't diverge without realizing it.
|
363
|
+
Its simple command-line interface allows you to integrate such checks easily in a monitoring platform (more is covered regarding tests in next sections of this tutorial - stay tuned!).
|
364
|
+
|
365
|
+
We have reviewed the changes of appying the new version of our configuration, and are happy with it, so now we can align.
|
366
|
+
```bash
|
367
|
+
./bin/deploy --node local
|
368
|
+
# ===== Packaging deployment ==== Begin...
|
369
|
+
# ===== Packaging deployment ==== ...End
|
370
|
+
#
|
371
|
+
# ===== Deploying on 1 nodes ==== Begin...
|
372
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== Begin
|
373
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== Begin
|
374
|
+
# Diffs on my-service.conf:
|
375
|
+
# 2c2
|
376
|
+
# < service-timeout: 30
|
377
|
+
# ---
|
378
|
+
# > service-timeout: 60
|
379
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== End
|
380
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== End
|
381
|
+
# Executing actions [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
382
|
+
# ===== Saving deployment logs for 1 nodes ==== Begin...
|
383
|
+
# Executing actions [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
384
|
+
# ===== Saving deployment logs for 1 nodes ==== ...End
|
385
|
+
#
|
386
|
+
# ===== Deploying on 1 nodes ==== ...End
|
387
|
+
```
|
388
|
+
|
389
|
+
And check all the deployment logs that have been uploaded on the node:
|
390
|
+
```bash
|
391
|
+
ls -la /var/log/deployments
|
392
|
+
# total 20
|
393
|
+
# drwxr-xr-x 2 root root 4096 Apr 27 17:11 .
|
394
|
+
# drwxr-xr-x 1 root root 4096 Apr 27 16:36 ..
|
395
|
+
# -rw-r--r-- 1 root root 512 Apr 27 16:37 local_2021-04-27_163724_root
|
396
|
+
# -rw-r--r-- 1 root root 620 Apr 27 17:09 local_2021-04-27_170944_root
|
397
|
+
|
398
|
+
cat /var/log/deployments/local_2021-04-27_170944_root
|
399
|
+
# repo_name_0: my-service-conf-repo
|
400
|
+
# commit_id_0: 6fe23cc20f568937e9a969f3f0720b54099774e9
|
401
|
+
# commit_message_0: Increasing timeout for my-service
|
402
|
+
# diff_files_0:
|
403
|
+
# date: 2021-04-27 17:09:44
|
404
|
+
# user: root
|
405
|
+
# debug: No
|
406
|
+
# services: my-service
|
407
|
+
# exit_status: 0
|
408
|
+
# ===== STDOUT =====
|
409
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== Begin
|
410
|
+
# Diffs on my-service.conf:
|
411
|
+
# 2c2
|
412
|
+
# < service-timeout: 30
|
413
|
+
# ---
|
414
|
+
# > service-timeout: 60
|
415
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== End
|
416
|
+
#
|
417
|
+
# ===== STDERR =====
|
418
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== Begin
|
419
|
+
# ===== [ local / my-service ] - HPC Service Deploy ===== End
|
420
|
+
```
|
421
|
+
|
422
|
+
You can see that any deployment logs give the following information:
|
423
|
+
* **Repository names** involved in deploying all the services on this node.
|
424
|
+
* **Commit IDs and messages** of those repositories.
|
425
|
+
* Differing configuration files at the time of deployment.
|
426
|
+
* Deployment **date**.
|
427
|
+
* **User** that deployed.
|
428
|
+
* The **list of services** that have been deployed.
|
429
|
+
* The **exit status**.
|
430
|
+
* The complete **stdout and stderr** of the deployment.
|
431
|
+
|
432
|
+
This is the same info that is queried by [`last_deploys` executable](/docs/executables/last_deploys.md):
|
433
|
+
```bash
|
434
|
+
./bin/last_deploys
|
435
|
+
# =>
|
436
|
+
# Getting deployment info [100%] - | C| - [ Queue: 0 - Processing: 0 - Done: 1 - Total: 1 ]
|
437
|
+
# +-------+---------------------+-------+------------+-------+
|
438
|
+
# | Node | Date | Admin | Services | Error |
|
439
|
+
# +-------+---------------------+-------+------------+-------+
|
440
|
+
# | local | 2021-04-27 17:09:44 | root | my-service | |
|
441
|
+
# +-------+---------------------+-------+------------+-------+
|
442
|
+
```
|
443
|
+
And here you can see that the output reflects the new deployment you have just done (the date has changed).
|
444
|
+
|
445
|
+
**Woot! Congrats for reaching this level already :D**
|
446
|
+
|
447
|
+
You have just seen ones of the most important processes Hybrid Platforms Conductor cover for your agility, with all associated concepts.
|
448
|
+
**Simple command lines mapping DevOps processes** without technical complexity in their interface: **run, check, deploy, logs**, and how they can integrate easily in a git development workflow.
|
449
|
+
|
450
|
+
Of course for such a simple use-case (editing a configuration file using a bash script), no need for so many interfaces and concepts.
|
451
|
+
So now it's time to see how Hybrid Platforms Conductor will scale those processes for you, both in terms of number of platforms and nodes, and then in terms of different technologies.
|
452
|
+
|
453
|
+
We won't stop at editing bash scripts on a local environment - time to scale!
|
454
|
+
|
455
|
+
*Files that have been covered in this section can be checked in [this example tutorial folder](/examples/tutorial/02_first_node).*
|
456
|
+
|
457
|
+
**[Next >> Scale your processes](/docs/tutorial/03_scale.md)**
|
458
|
+
|
459
|
+
---
|
460
|
+
**<p style="text-align: center;">Tutorial navigation</p>**
|
461
|
+
|
462
|
+
| <sub>[Introduction](/docs/tutorial.md)</sub> | <sub>[1. Installation and first-time setup](/docs/tutorial/01_installation.md)</sub> | <nobr><sub><sup>👇You are here👇</sup></sub></nobr><br><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> | <sub>[5. Extend Hybrid Platforms Conductor with your own requirements](/docs/tutorial/05_extend_with_plugins.md)</sub> |
|
463
|
+
| ---------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------- |
|
464
|
+
| <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> |
|
465
|
+
| <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> |
|
466
|
+
| <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> |
|
467
|
+
| | | | | <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> |
|
468
|
+
| | | | | | <sub><sup>**[What next?](/docs/tutorial/05_extend_with_plugins.md#what-next)**</sup></sub> |
|