Giter VIP home page Giter VIP logo

habootstrap-formula's Introduction

Formula CI

HA Cluster bootstrap Salt formula

Salt formula to bootstrap and manage a ClusterLabs high availability cluster.

Mainly adapted to Linux distributions for SUSE (it is based in crmsh), but it should be usable on other distributions with some modifications.

Features

The formula provides the capability to create and configure a multi node HA cluster. Here are some of the features:

  • Initialize a cluster
  • Join a node to an existing cluster
  • Remove a node from an existing cluster
  • Configure the pre-requirements (install required packages, configure ntp/chrony, create ssh-keys, etc)
  • Auto detect if the cluster is running in a cloud provider (Azure, AWS, or GCP)
  • Configure SBD
  • Configure Corosync
  • Configure the resource agents
  • Install and configure the ha_cluster_exporter

Installation

The project can be installed in many ways, including but not limited to:

  1. RPM
  2. Manual clone

RPM

On openSUSE or SUSE Linux Enterprise use zypper package manager:

zypper install habootstrap-formula

Important! This will install the formula in /usr/share/salt-formulas/states/cluster. In case the formula is used in a masterless mode, make sure that the /usr/share/salt-formulas/states entry is correctly configured in the file_roots entry of the Salt minion configuration.

Depending on the patch level of the target system and the release cycle of this project, the package in the regular repository might not be the latest one. If you want the latest features, have a look in the test development repositories at SUSE's Open Build Service network:ha-clustering:sap-deployments:devel/habootstrap-formula.

Manual Installation

A manual installation can be done by cloning this repository:

git clone https://github.com/SUSE/habootstrap-formula

Important! This will not install the the formula anywhere where salt can find it. If the formula is used in a masterless mode, also make sure to copy the complete netweaver subdirectory to location defined in file_roots entry of your Salt minion configuration.

I. e.:

cd habootstrap-formula
cp -R cluster /srv/salt

Important! The formulas depends on salt-shaptools package. Make sure it is installed properly if you follow the manual installation (the package can be installed as a RPM package too).

Usage

Follow the next steps to configure the formula execution. After this, the formula can be executed using master/minion or masterless options:

  1. Modify the top.sls file (by default stored in /srv/salt) including the cluster entry.

    Here is an example to execute the cluster formula in all of the nodes:

    # This file is /srv/salt/top.sls
    base:
      '*':
        - cluster
    
  2. Customize the execution pillar file. Here an example of a pillar file for this formula with all of the options: pillar.example The pillar.example can be found either as a link to the file in the master branch or a file in the file system at /usr/share/salt-formulas/metadata/hana/pillar.example.

  3. Set the execution pillar file. For that, modify the top.sls of the pillars (by default stored in /srv/pillar) including the cluster entry and copy your specific cluster.sls pillar file in the same folder.

    Here an example to apply the recently created cluster.sls pillar file to all of the nodes:

    # This file is /srv/pillar/top.sls
    base:
      '*':
        - cluster
    
  4. Execute the formula.

    1. Master/Minion execution.

      salt '*' state.highstate

    2. Masterless execution.

      salt-call --local state.highstate

Important! The hostnames and minion names of the cluster nodes need to be the same for the cluster join procedure to work correctly, and the nodes need to be able to reach each other by hostname/minion name.

Salt pillar encryption

Pillars are expected to contain private data such as user passwords required for the automated installation or other operations. Therefore, such pillar data need to be stored in an encrypted state, which can be decrypted during pillar compilation.

SaltStack GPG renderer provides a secure encryption/decryption of pillar data. The configuration of GPG keys and procedure for pillar encryption are desribed in the Saltstack documentation guide:

Note:

  • Only passwordless gpg keys are supported, and the already existing keys cannot be used.

  • If a masterless approach is used (as in the current automated deployment) the gpg private key must be imported in all the nodes. This might require the copy/paste of the keys.

Advanced usage

Native Fencing

If running in the cloud, some cloud providers provide a native way (e.g. through an API) to fence nodes.

AWS

SUSE's recommendation is to use the native method to fence cluster nodes in AWS.

The AWS specific implementation is the "AWS STONITH Agent" called stonith:external/ec2.

No additional configuration is needed to enable this.

Azure

SUSE's recommendation is to use SBD (e.g. via iSCSI) to fence cluster nodes in azure.

The alternative azure specific implementation is the "Azure Fence Agent" called stonith:fence_azure_arm.

Please read the Microsoft Azure documentation Create Azure Fence agent STONITH device for the detailed steps that are needed in azure.

Look into pillar.example for examples on how to configure this in salt.

The pillars will be used by other formulas, e.g. https://github.com/SUSE/sapnwbootstrap-formula to configure the needed cluster resources.

GCP

TBD

OBS Packaging

The CI automatically publishes new releases to SUSE's Open Build Service every time a pull request is merged into master branch. For that, update the new package version in _service and add the new changes in habootstrap-formula.changes.

The new version is published at:

Test

The test folder contains a set of tests to check the integrity of the formula. The tests check if the provided pillar data is correctly rendered to find inconsistencies on the usage of the user input. The tests don't really check if the salt code works properly, they rather test if the formula uses and renders the states with the correct values.

In order to run the tests execute:

cd habootstrap-formula
bash ./test/validate-formula.sh

In order to improve or add new tests the pillar example from test/test_pillars can be changed (or add new pillar files).

Troubleshooting

Note: This advice is specific to openSUSE / SUSE distributions. For other distributions, the specific commands needed may be different.

To run the tests, libvirt must be installed and the daemon running:

zypper in libvirt
systemctl start libvirtd

habootstrap-formula's People

Contributors

arbulu89 avatar ayoub-belarbi avatar cbosdo avatar cschneemann avatar diegoakechi avatar juadk avatar krig avatar mallozup avatar melzer-b1 avatar nick-wang avatar simranpal avatar stefanotorresi avatar suntorytimed avatar yeoldegrove avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

habootstrap-formula's Issues

Configuration sections / Fields organisation

Hello,

I found the user experience while going from top to bottom of the formula a bit messy and sometimes misleading.
I'd like to suggest a new order:

Required Settings

  • SSH Keys deployment
  • Install required packages:

Recommended Settings

  • Cluster name:
  • Default hacluster user password:
  • Cluster communication interface:
  • Cluster Virtual IP (VIP) creation (admin access):
  • NTP server # (<is it possible to add a list? what would be the format? to be added in help button)

Storage Related Settings

  • Custom configuration for Stonith Block Device (SBD)
  • Shared disk filesystem setup (OCFS2 - optional)

Custom Cluster Settings

  • Custom configuration for watchdog module
  • Custom confguration for Corosync service
  • Cluster internal communications type:
  • Cluster Initialization Timeout
  • Cluster Join Timeout

Add-ons settings

  • Install new resource agents:
  • Configure resource agents with configuration file:
  • Remove cluster node(s):
  • Enable monitoring via ha_cluster_exporter:

Thank you

Add proper requires

When adding custom states to configure the cluster after its creation, the user needs to add requires in his states. However these may break the linear order of the formula.

In order to make the formula more robust a few more requires would be needed. For instance in cluster/create.sls something like this would be needed on the bootstrap-the-cluster state:

     {% if cluster.watchdog is defined %}
     {% if cluster.watchdog.device is defined %}
     - require:
       - kmod: {{ cluster.watchdog.module }}
     {% endif %}
     {% endif %}

This example is one I encountered, but is surely not the only one.

update_ha_cluster password improvements

image

0)

the help message on forms is not usefull.

We should rename it to update the administrator hacluster user password. (Used by pacemaker cluster and HAWK webui)
Something similar.

@gao-yan afaik where the hacluster user is used right?

1) this values is pretty much sensible.

we should make the password field to the TOP and make the user by default changing the password instead of having it falling back to the default which can be weak password.

Also the position of the form should be on the 1st position or on the top level since it is important

Formula - Cluster - Admin IP

Hello,

SUMA 4.1.6
Formula "Cluster"

When a cluster is deployed, changing the value from "Admin Ip:" in the formula does not produce any change.
We expect the IP address to be changed with the new value.

Thank you,
Julien

don't expose "remove cluster nodes"

image

We should not expose remove cluster nodes. In a installation formula is contradictory to remove a cluster node when the cluster is not even installed.

I think the main goal of our formula is to manage the installation. We all well known that our formulas are lacking idempotency for having update lifecycles.

For that we should use hawk crmsh imho.

Formula fails if crmsh installation fails in cloud_detection.sls

The whole formula usage depends on crmsh. In fact, the first thing done in the formula is to install `crmsh. But it's not done using the standard way. Here the piece of code:
https://github.com/SUSE/habootstrap-formula/blob/master/cluster/cloud_detection.sls#L2

If this installation fails, the whole formula will fail, as it cannot find the used cloud provider.

Even though this error is rare, we need to fix it or at least have a backup plan.

Cluster formula - Global description update

Hello,

I feel like we could be giving more info about what this formula is doing in the global description.
Current:
Salt formula to bootstrap and manage a pacemaker high availability cluster.

Suggested:
Salt formula to bootstrap and manage a pacemaker high availability cluster.
It is recommended to use this formula from a SUSE Manager "System Groups" where all the future cluster nodes have been added.
Storage related notes:
For specific storage shared device like Stonith Block Device (SBD - Cluster internal communication using the storage) or OCFS2 (shared disk file system), you need to present the storage to each of your nodes prior to run the formula.
Network related notes:
You will be asked for the interface to be used for the cluster internal communications.
Please note that we usually divide the cluster internal communications and the applications communications (resources held by the cluster).
Setup your nodes accordingly to meet your segmentation and availability design (the more communication paths you have, the less split-brain case you will meet).

hacluster user password modification is in clear text

Hello,

When modifying the password for the hacluster user (which will probably be used by default by our customers), we find the password in clear text in the updated state.
This is a very severe security issue.

Thank you for your help

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.