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
@@ -0,0 +1 @@
|
|
1
|
+
Hello World!
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN OPENSSH PRIVATE KEY-----
|
2
|
+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
|
3
|
+
NhAAAAAwEAAQAAAQEAu5oVFddWtHFKA8+PnRssWieXrnMUPM8+qTdQrxoMaNacFWN+pBv3
|
4
|
+
Nj61GphCANoEPBvgcm7ltgZa1EumAZh4NJFi7A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xd1+6boYvbdfyTyeMEiNHOrprRRpunrm29V admin@example.com
|
@@ -0,0 +1,43 @@
|
|
1
|
+
package main
|
2
|
+
|
3
|
+
import (
|
4
|
+
"fmt"
|
5
|
+
"io/ioutil"
|
6
|
+
"log"
|
7
|
+
"net/http"
|
8
|
+
"os"
|
9
|
+
)
|
10
|
+
|
11
|
+
const homepageEndPoint = "/"
|
12
|
+
|
13
|
+
// StartWebServer the webserver
|
14
|
+
func StartWebServer() {
|
15
|
+
http.HandleFunc(homepageEndPoint, handleHomepage)
|
16
|
+
port := os.Getenv("PORT")
|
17
|
+
if len(port) == 0 {
|
18
|
+
panic("Environment variable PORT is not set")
|
19
|
+
}
|
20
|
+
|
21
|
+
log.Printf("Starting web server to listen on endpoints [%s] and port %s",
|
22
|
+
homepageEndPoint, port)
|
23
|
+
if err := http.ListenAndServe(":"+port, nil); err != nil {
|
24
|
+
panic(err)
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
func handleHomepage(w http.ResponseWriter, r *http.Request) {
|
29
|
+
urlPath := r.URL.Path
|
30
|
+
log.Printf("Web request received on url path %s", urlPath)
|
31
|
+
content, content_err := ioutil.ReadFile("/root/hello_world.txt")
|
32
|
+
if content_err != nil {
|
33
|
+
fmt.Printf("Failed to read message to display, err: %s", content_err)
|
34
|
+
}
|
35
|
+
_, write_err := w.Write(content)
|
36
|
+
if write_err != nil {
|
37
|
+
fmt.Printf("Failed to write response, err: %s", write_err)
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
func main() {
|
42
|
+
StartWebServer()
|
43
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
{
|
2
|
+
"dev1.hpc_tutorial.org": "python",
|
3
|
+
"dev2.hpc_tutorial.org": "python",
|
4
|
+
"dev3.hpc_tutorial.org": "python",
|
5
|
+
"dev4.hpc_tutorial.org": "python",
|
6
|
+
"dev5.hpc_tutorial.org": "python",
|
7
|
+
"dev6.hpc_tutorial.org": "gcc",
|
8
|
+
"dev7.hpc_tutorial.org": "gcc",
|
9
|
+
"dev8.hpc_tutorial.org": "gcc",
|
10
|
+
"dev9.hpc_tutorial.org": "gcc",
|
11
|
+
"dev10.hpc_tutorial.org": "gcc"
|
12
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
hostname=${1}
|
2
|
+
check_flag=${2:-deploy}
|
3
|
+
if [ "${check_flag}" = "check" ]; then
|
4
|
+
# Check if gcc is installed
|
5
|
+
if ssh -o StrictHostKeyChecking=no root@${hostname} 'gcc --version' 2>/dev/null; then
|
6
|
+
echo 'OK'
|
7
|
+
else
|
8
|
+
echo 'Missing'
|
9
|
+
fi
|
10
|
+
else
|
11
|
+
# Install gcc
|
12
|
+
ssh -o StrictHostKeyChecking=no root@${hostname} 'apt install -y gcc' 2>/dev/null
|
13
|
+
echo 'Installed'
|
14
|
+
fi
|
@@ -0,0 +1,14 @@
|
|
1
|
+
hostname=${1}
|
2
|
+
check_flag=${2:-deploy}
|
3
|
+
if [ "${check_flag}" = "check" ]; then
|
4
|
+
# Check if python3 is installed
|
5
|
+
if ssh -o StrictHostKeyChecking=no root@${hostname} 'python3 --version' 2>/dev/null; then
|
6
|
+
echo 'OK'
|
7
|
+
else
|
8
|
+
echo 'Missing'
|
9
|
+
fi
|
10
|
+
else
|
11
|
+
# Install python3
|
12
|
+
ssh -o StrictHostKeyChecking=no root@${hostname} 'apt install -y python3-pip' 2>/dev/null
|
13
|
+
echo 'Installed'
|
14
|
+
fi
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# syntax=docker/dockerfile:1
|
2
|
+
# Pull the image containing Go
|
3
|
+
FROM debian:buster
|
4
|
+
|
5
|
+
# Install sshd
|
6
|
+
RUN apt-get update && apt-get install -y openssh-server
|
7
|
+
RUN mkdir /var/run/sshd
|
8
|
+
# Activate root login
|
9
|
+
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
10
|
+
# Speed-up considerably ssh performance and avoid huge lags and timeouts without DNS
|
11
|
+
RUN sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
|
12
|
+
EXPOSE 22
|
13
|
+
|
14
|
+
# Upload our root key for key authentication of root
|
15
|
+
COPY hpc_root.key.pub /root/.ssh/authorized_keys
|
16
|
+
RUN chmod 700 /root/.ssh
|
17
|
+
RUN chmod 400 /root/.ssh/authorized_keys
|
18
|
+
|
19
|
+
# Startup command
|
20
|
+
CMD ["/usr/sbin/sshd", "-D"]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN OPENSSH PRIVATE KEY-----
|
2
|
+
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
|
3
|
+
NhAAAAAwEAAQAAAQEAwrphsyDcvMR21e1np5SFNlBXy3fOfVPZKbqWICnDoMLgwyQASubN
|
4
|
+
bYfywZ61qEOBkMfUxkUbIa/sqSDgACczOYPjL3zfadoL0/0J2QcJjSjljGpiiQfX+WFyZ+
|
5
|
+
+0SpDBGQQdMtPsezCf8yYUOCOe3oeXke3i5fXddl4b0KSPsqk0ETfrNOMw6NZ/mdzhlGxn
|
6
|
+
U/UaJoO28f4ggZVGwyEUzr68ccWSDXgpnHwULMnD93FyTQyXn5V80Bob5x3dW5hxl1JP+t
|
7
|
+
ppLVuEeAs3Yhz9Z8WOwDzut+K5OjvKDiVcRAD+bng5STw5/1m5Ac3H8ynl5NGX0uspiSfM
|
8
|
+
FKXYsAW0zwAAA8i31y2Tt9ctkwAAAAdzc2gtcnNhAAABAQDCumGzINy8xHbV7WenlIU2UF
|
9
|
+
fLd859U9kpupYgKcOgwuDDJABK5s1th/LBnrWoQ4GQx9TGRRshr+ypIOAAJzM5g+MvfN9p
|
10
|
+
2gvT/QnZBwmNKOWMamKJB9f5YXJn77RKkMEZBB0y0+x7MJ/zJhQ4I57eh5eR7eLl9d12Xh
|
11
|
+
vQpI+yqTQRN+s04zDo1n+Z3OGUbGdT9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iyYPQMg0F0JF+nG//FDC2yiJMWCf9ijD5g0ccSM4PG+kAfWDNPZiCQdn47ZtGL
|
26
|
+
OB3a2eyfiTcPg0YbAAAAEWFkbWluQGV4YW1wbGUuY29tAQ==
|
27
|
+
-----END OPENSSH PRIVATE KEY-----
|
@@ -0,0 +1 @@
|
|
1
|
+
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCumGzINy8xHbV7WenlIU2UFfLd859U9kpupYgKcOgwuDDJABK5s1th/LBnrWoQ4GQx9TGRRshr+ypIOAAJzM5g+MvfN9p2gvT/QnZBwmNKOWMamKJB9f5YXJn77RKkMEZBB0y0+x7MJ/zJhQ4I57eh5eR7eLl9d12XhvQpI+yqTQRN+s04zDo1n+Z3OGUbGdT9Romg7bx/iCBlUbDIRTOvrxxxZINeCmcfBQsycP3cXJNDJeflXzQGhvnHd1bmHGXUk/62mktW4R4CzdiHP1nxY7APO634rk6O8oOJVxEAP5ueDlJPDn/WbkBzcfzKeXk0ZfS6ymJJ8wUpdiwBbTP admin@example.com
|
@@ -0,0 +1,13 @@
|
|
1
|
+
yaml_inventory_platform path: "#{Dir.home}/hpc_tutorial/my-service-conf-repo"
|
2
|
+
for_nodes('web1') do
|
3
|
+
expect_tests_to_fail %i[connection], 'web1 is temporarily down - will bring it up later'
|
4
|
+
end
|
5
|
+
# Select only the nodes implementing our web-hello service (that is all the webN nodes)
|
6
|
+
for_nodes [{ service: 'web-hello' }] do
|
7
|
+
# On our web servers we should have users used by our services
|
8
|
+
check_local_users_do_exist %w[sshd www-data]
|
9
|
+
# Make sure we have no leftovers of obsolete users
|
10
|
+
check_local_users_do_not_exist %w[dangerous_user obsolete_user]
|
11
|
+
end
|
12
|
+
os_image :debian_10, "#{hybrid_platforms_dir}/images/debian_10"
|
13
|
+
json_bash_platform path: "#{Dir.home}/hpc_tutorial/dev-servers-conf-repo"
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# syntax=docker/dockerfile:1
|
2
|
+
FROM debian:buster
|
3
|
+
|
4
|
+
RUN apt-get update && apt-get install -y openssh-server
|
5
|
+
RUN mkdir /var/run/sshd
|
6
|
+
# Activate root login with test password
|
7
|
+
RUN echo 'root:root_pwd' | chpasswd
|
8
|
+
RUN sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
|
9
|
+
# Speed-up considerably ssh performance and avoid huge lags and timeouts without DNS
|
10
|
+
RUN sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
|
11
|
+
EXPOSE 22
|
12
|
+
|
13
|
+
CMD ["/usr/sbin/sshd", "-D"]
|
@@ -0,0 +1,100 @@
|
|
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
|
+
image: debian_10
|
14
|
+
hostname: web1.hpc_tutorial.org
|
15
|
+
planet: Mercury
|
16
|
+
service_port: 1201
|
17
|
+
service_timeout: 60
|
18
|
+
services:
|
19
|
+
- web-hello
|
20
|
+
- my-service
|
21
|
+
web2:
|
22
|
+
metadata:
|
23
|
+
description: Web service nbr 2
|
24
|
+
image: debian_10
|
25
|
+
hostname: web2.hpc_tutorial.org
|
26
|
+
planet: Venus
|
27
|
+
service_port: 1202
|
28
|
+
service_timeout: 60
|
29
|
+
services:
|
30
|
+
- web-hello
|
31
|
+
- my-service
|
32
|
+
web3:
|
33
|
+
metadata:
|
34
|
+
description: Web service nbr 3
|
35
|
+
image: debian_10
|
36
|
+
hostname: web3.hpc_tutorial.org
|
37
|
+
planet: Earth
|
38
|
+
service_port: 1203
|
39
|
+
service_timeout: 60
|
40
|
+
services:
|
41
|
+
- web-hello
|
42
|
+
- my-service
|
43
|
+
web4:
|
44
|
+
metadata:
|
45
|
+
description: Web service nbr 4
|
46
|
+
image: debian_10
|
47
|
+
hostname: web4.hpc_tutorial.org
|
48
|
+
planet: Mars
|
49
|
+
service_port: 1204
|
50
|
+
service_timeout: 60
|
51
|
+
services:
|
52
|
+
- web-hello
|
53
|
+
- my-service
|
54
|
+
web5:
|
55
|
+
metadata:
|
56
|
+
description: Web service nbr 5
|
57
|
+
image: debian_10
|
58
|
+
hostname: web5.hpc_tutorial.org
|
59
|
+
planet: Jupiter
|
60
|
+
service_port: 1205
|
61
|
+
service_timeout: 60
|
62
|
+
services:
|
63
|
+
- web-hello
|
64
|
+
- my-service
|
65
|
+
web6:
|
66
|
+
metadata:
|
67
|
+
description: Web service nbr 6
|
68
|
+
image: debian_10
|
69
|
+
hostname: web6.hpc_tutorial.org
|
70
|
+
services:
|
71
|
+
- web-hello
|
72
|
+
web7:
|
73
|
+
metadata:
|
74
|
+
description: Web service nbr 7
|
75
|
+
image: debian_10
|
76
|
+
hostname: web7.hpc_tutorial.org
|
77
|
+
services:
|
78
|
+
- web-hello
|
79
|
+
web8:
|
80
|
+
metadata:
|
81
|
+
description: Web service nbr 8
|
82
|
+
image: debian_10
|
83
|
+
hostname: web8.hpc_tutorial.org
|
84
|
+
services:
|
85
|
+
- web-hello
|
86
|
+
web9:
|
87
|
+
metadata:
|
88
|
+
description: Web service nbr 9
|
89
|
+
image: debian_10
|
90
|
+
hostname: web9.hpc_tutorial.org
|
91
|
+
services:
|
92
|
+
- web-hello
|
93
|
+
web10:
|
94
|
+
metadata:
|
95
|
+
description: Web service nbr 10
|
96
|
+
image: debian_10
|
97
|
+
hostname: web10.hpc_tutorial.org
|
98
|
+
# The list of service names this node should have
|
99
|
+
services:
|
100
|
+
- 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
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Get actions to check the node's service against the wanted content
|
2
|
+
#
|
3
|
+
# Parameters::
|
4
|
+
# * *node* (String): Node on which we check the service
|
5
|
+
# Result::
|
6
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
7
|
+
def check(node)
|
8
|
+
# We first dump the wanted content in a temporary file and then we diff it.
|
9
|
+
# We will access the node's planet, hostname and IP from its metadata using the NodesHandler API, through the @nodes_handler object
|
10
|
+
[
|
11
|
+
{
|
12
|
+
remote_bash: <<~EOS
|
13
|
+
echo 'Hello #{@nodes_handler.get_planet_of(node) || 'World'} from #{@nodes_handler.get_hostname_of(node)} (#{@nodes_handler.get_host_ip_of(node)})' >/tmp/hello_world.txt.wanted
|
14
|
+
echo Diffs on hello_world.txt:
|
15
|
+
if test -f /root/hello_world.txt; then
|
16
|
+
diff /root/hello_world.txt /tmp/hello_world.txt.wanted || true
|
17
|
+
else
|
18
|
+
echo "Create hello_world.txt from scratch"
|
19
|
+
cat /tmp/hello_world.txt.wanted
|
20
|
+
fi
|
21
|
+
EOS
|
22
|
+
}
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
# Get actions to deploy the node's service against the wanted content
|
27
|
+
#
|
28
|
+
# Parameters::
|
29
|
+
# * *node* (String): Node on which we deploy the service
|
30
|
+
# Result::
|
31
|
+
# * Array< Hash<Symbol,Object> >: The list of actions
|
32
|
+
def deploy(node)
|
33
|
+
# We first check, as this will display diffs and prepare the file to be copied.
|
34
|
+
# And then we really deploy the file on our node.
|
35
|
+
check(node) + [
|
36
|
+
{
|
37
|
+
remote_bash: <<~EOS
|
38
|
+
mkdir -p ~/hpc_tutorial/node
|
39
|
+
cp /tmp/hello_world.txt.wanted /root/hello_world.txt
|
40
|
+
EOS
|
41
|
+
}
|
42
|
+
]
|
43
|
+
end
|