From cffda5a8171b32ab2434bf1427ac0dbe64745f0c Mon Sep 17 00:00:00 2001 From: Luuk van Venrooij <11056665+seriva@users.noreply.github.com> Date: Thu, 10 Oct 2019 21:54:51 +0200 Subject: [PATCH] Epicli validation and RabbitMQ and Postgress cluster fixes. (#595) --- .../configuration/minimal-cluster-config.yml | 2 +- .../configuration/minimal-cluster-config.yml | 4 +-- .../infrastructure/virtual-machine.yml | 30 +++++++++++++++++++ .../configuration/minimal-cluster-config.yml | 4 +-- .../spec/rabbitmq/rabbitmq_spec.rb | 5 +++- .../tests/serverspec-cli/spec/spec_helper.rb | 2 +- docs/home/HOWTO.md | 2 +- 7 files changed, 41 insertions(+), 8 deletions(-) diff --git a/core/src/epicli/data/any/defaults/configuration/minimal-cluster-config.yml b/core/src/epicli/data/any/defaults/configuration/minimal-cluster-config.yml index d301058a7d..dfe7ad50f4 100644 --- a/core/src/epicli/data/any/defaults/configuration/minimal-cluster-config.yml +++ b/core/src/epicli/data/any/defaults/configuration/minimal-cluster-config.yml @@ -4,7 +4,7 @@ title: "Epiphany cluster Config" provider: any name: "default" specification: - name: YOUR_CLUSTER_NAME + name: name admin_user: name: operations # YOUR-ADMIN-USERNAME key_path: /user/.ssh/epiphany-operations/id_rsa # YOUR-SSH-KEY-PATH diff --git a/core/src/epicli/data/aws/defaults/configuration/minimal-cluster-config.yml b/core/src/epicli/data/aws/defaults/configuration/minimal-cluster-config.yml index 28b3526024..1a06ed15ed 100644 --- a/core/src/epicli/data/aws/defaults/configuration/minimal-cluster-config.yml +++ b/core/src/epicli/data/aws/defaults/configuration/minimal-cluster-config.yml @@ -4,8 +4,8 @@ title: "Epiphany cluster Config" provider: aws name: "default" specification: - name: YOUR_CLUSTER_NAME - prefix: YOUR_CLUSTER_RESOURCES_PREFIX + name: name + prefix: prefix admin_user: name: operations # YOUR-ADMIN-USERNAME key_path: /user/.ssh/epiphany-operations/id_rsa # YOUR-SSH-KEY-PATH diff --git a/core/src/epicli/data/aws/defaults/infrastructure/virtual-machine.yml b/core/src/epicli/data/aws/defaults/infrastructure/virtual-machine.yml index ba5403b255..66b490d0cf 100644 --- a/core/src/epicli/data/aws/defaults/infrastructure/virtual-machine.yml +++ b/core/src/epicli/data/aws/defaults/infrastructure/virtual-machine.yml @@ -158,6 +158,26 @@ specification: destination_port_range: "5672" source_address_prefix: "10.1.0.0/20" destination_address_prefix: "0.0.0.0/0" + - name: rabbitmq_clustering_1 + description: Allow rabbitmq clustering traffic 1 + priority: 304 + direction: Inbound + access: Allow + protocol: Tcp + source_port_range: "*" + destination_port_range: "4369" + source_address_prefix: "10.1.8.0/24" + destination_address_prefix: "0.0.0.0/0" + - name: rabbitmq_clustering_1 + description: Allow rabbitmq clustering traffic 2 + priority: 305 + direction: Inbound + access: Allow + protocol: Tcp + source_port_range: "*" + destination_port_range: "25672" + source_address_prefix: "10.1.8.0/24" + destination_address_prefix: "0.0.0.0/0" - name: out description: Allow out priority: 101 @@ -649,6 +669,16 @@ specification: destination_port_range: "0" source_address_prefix: "10.1.2.0/24" destination_address_prefix: "0.0.0.0/0" + - name: postgres_clustering + description: Allow Postgres clustering traffic + priority: 305 + direction: Inbound + access: Allow + protocol: Tcp + source_port_range: "*" + destination_port_range: "5432" + source_address_prefix: "10.1.6.0/24" + destination_address_prefix: "0.0.0.0/0" --- kind: infrastructure/virtual-machine version: 0.4.0 diff --git a/core/src/epicli/data/azure/defaults/configuration/minimal-cluster-config.yml b/core/src/epicli/data/azure/defaults/configuration/minimal-cluster-config.yml index 13b5dcc993..fc09003f52 100644 --- a/core/src/epicli/data/azure/defaults/configuration/minimal-cluster-config.yml +++ b/core/src/epicli/data/azure/defaults/configuration/minimal-cluster-config.yml @@ -4,8 +4,8 @@ title: "Epiphany cluster Config" provider: azure name: "default" specification: - name: YOUR_CLUSTER_NAME - prefix: YOUR_CLUSTER_RESOURCES_PREFIX + name: name + prefix: prefix admin_user: name: operations # YOUR-ADMIN-USERNAME key_path: /user/.ssh/epiphany-operations/id_rsa # YOUR-SSH-KEY-PATH diff --git a/core/src/epicli/tests/serverspec-cli/spec/rabbitmq/rabbitmq_spec.rb b/core/src/epicli/tests/serverspec-cli/spec/rabbitmq/rabbitmq_spec.rb index 07ad797f7f..35469dc54e 100644 --- a/core/src/epicli/tests/serverspec-cli/spec/rabbitmq/rabbitmq_spec.rb +++ b/core/src/epicli/tests/serverspec-cli/spec/rabbitmq/rabbitmq_spec.rb @@ -54,6 +54,7 @@ let(:disable_sudo) { false } if clustered == true listInventoryHosts("rabbitmq").each do |val| + val = val.split(".")[0] describe command("rabbitmqctl node_health_check -n rabbit@#{val}") do its(:stdout) { should match /^Health check passed$/ } its(:exit_status) { should eq 0 } @@ -74,6 +75,7 @@ end if clustered listInventoryHosts("rabbitmq").each do |val| + val = val.split(".")[0] describe command("rabbitmqctl cluster_status | awk '/running_nodes/,/}/'") do its(:stdout) { should match /rabbit@#{val}/ } its(:exit_status) { should eq 0 } @@ -127,6 +129,7 @@ let(:disable_sudo) { false } if clustered listInventoryHosts("rabbitmq").each do |val| + val = val.split(".")[0] describe command("curl -o /dev/null -s -w '%{http_code}' -u #{user}:#{pass} #{rabbitmq_host}:#{rabbitmq_api_port}/api/healthchecks/node/rabbit@#{val}") do it "is expected to be equal" do expect(subject.stdout.to_i).to eq 200 @@ -159,4 +162,4 @@ its(:stdout) { should match /Deleting user "#{user}"/ } its(:exit_status) { should eq 0 } end -end +end \ No newline at end of file diff --git a/core/src/epicli/tests/serverspec-cli/spec/spec_helper.rb b/core/src/epicli/tests/serverspec-cli/spec/spec_helper.rb index 0d15dc128e..03c841071b 100644 --- a/core/src/epicli/tests/serverspec-cli/spec/spec_helper.rb +++ b/core/src/epicli/tests/serverspec-cli/spec/spec_helper.rb @@ -57,7 +57,7 @@ def hostInGroups?(role) file.close if input.include? "[#{role}]" rows = input.split("[#{role}]")[1].split("[")[0] - return rows.include? ENV['TARGET_HOST'] + return rows =~ /\b#{ENV['TARGET_HOST']}\b/ else return false end end diff --git a/docs/home/HOWTO.md b/docs/home/HOWTO.md index 2880ecab32..df218d5db1 100644 --- a/docs/home/HOWTO.md +++ b/docs/home/HOWTO.md @@ -15,7 +15,7 @@ - [Epiphany cluster](./howto/CLUSTER.md) - Epicli - [How to create an Epiphany cluster on existing infrastructure](./howto/CLUSTER.md#how-to-create-an-epiphany-cluster-on-existing-infrastructure) - - [How to create an Epiphany cluster on a cloud provider](./howto/CLUSTER.md#how-to-create-an-epiphany-on-a-cloud-provider) + - [How to create an Epiphany cluster on a cloud provider](./howto/CLUSTER.md#how-to-create-an-epiphany-cluster-on-a-cloud-provider) - [How to delete an Epiphany cluster on a cloud provider](./howto/CLUSTER.md#how-to-delete-an-epiphany-cluster-on-a-cloud-provider) - [How to create an offline installation of for Epiphany cluster](./howto/CLUSTER.md#how-to-create-an-offline-installation-for-an-Epiphany-cluster) - [Single machine cluster](./howto/CLUSTER.md#single-machine-cluster)