Skip to content

Commit 9f97e02

Browse files
committed
simplify main README.md to only cover default configuration
1 parent 0d2367e commit 9f97e02

File tree

1 file changed

+61
-113
lines changed

1 file changed

+61
-113
lines changed

README.md

Lines changed: 61 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,42 @@
22

33
# StackHPC Slurm Appliance
44

5-
This repository contains playbooks and configuration to define a Slurm-based HPC environment including:
6-
- A Rocky Linux 9 and OpenHPC v3-based Slurm cluster.
7-
- Shared fileystem(s) using NFS (with servers within or external to the cluster).
8-
- Slurm accounting using a MySQL backend.
9-
- A monitoring backend using Prometheus and ElasticSearch.
10-
- Grafana with dashboards for both individual nodes and Slurm jobs.
11-
- Production-ready Slurm defaults for access and memory.
12-
- A Packer-based build pipeline for compute and login node images.
13-
14-
The repository is designed to be forked for a specific use-case/HPC site but can contain multiple environments (e.g. development, staging and production). It has been designed to be modular and extensible, so if you add features for your HPC site please feel free to submit PRs back upstream to us!
15-
16-
While it is tested on OpenStack it should work on any cloud, except for node rebuild/reimaging features which are currently OpenStack-specific.
17-
18-
## Prerequisites
19-
It is recommended to check the following before starting:
20-
- You have root access on the "ansible deploy host" which will be used to deploy the appliance.
5+
This repository contains playbooks and configuration to define a Slurm-based HPC environment. This includes:
6+
- [Rocky Linux](https://rockylinux.org/)-based hosts.
7+
- [OpenTofu](https://opentofu.org/) configurations to define the cluster's infrastructure-as-code.
8+
- Packages for Slurm and MPI software stacks from [OpenHPC](https://openhpc.community/).
9+
- Shared fileystem(s) using NFS (with in-cluster or external servers) or [CephFS](https://docs.ceph.com/en/latest/cephfs/) via [Openstack Manila](https://wiki.openstack.org/wiki/Manila).
10+
- Slurm accounting using a MySQL database.
11+
- Monitoring integrated with Slurm jobs using Prometheus, ElasticSearch and Grafana.
12+
- A web-based portal from [OpenOndemand](https://openondemand.org/).
13+
- Production-ready default Slurm configurations for access and memory.
14+
- [Packer](https://developer.hashicorp.com/packer)-based image build configurations for node images.
15+
16+
The repository is expected to be forked for a specific HPC site but can contain multiple environments for e.g. development, staging and production clusters based off a single configuration. It has been designed to be modular and extensible, so if you add features for your HPC site please feel free to submit PRs back upstream to us!
17+
18+
While it is tested on OpenStack it would work on any cloud with appropriate OpenTofu configuration files.
19+
20+
## Demonstration Deployment
21+
22+
The default configuration in this repository may be used to create a cluster to explore use of the appliance. It provides:
23+
- Persistent state backed by an OpenStack volume.
24+
- NFS-based shared file system backed by another OpenStack volume.
25+
26+
Note that the OpenOndemand portal and its remote apps are not usable with this default configuration.
27+
28+
It requires an OpenStack cloud, and an Ansible "deploy host" with access to that cloud.
29+
30+
Before starting ensure that:
31+
- You have root access on the deploy host.
2132
- You can create instances using a Rocky 9 GenericCloud image (or an image based on that).
2233
- **NB**: In general it is recommended to use the [latest released image](https://github.com/stackhpc/ansible-slurm-appliance/releases) which already contains the required packages. This is built and tested in StackHPC's CI. However the appliance will install the necessary packages if a GenericCloud image is used.
23-
- SSH keys get correctly injected into instances.
24-
- Instances have access to internet (note proxies can be setup through the appliance if necessary).
25-
- DNS works (if not this can be partially worked around but additional configuration will be required).
34+
- You have a SSH keypair defined in OpenStack, with the private key available on the deploy host.
35+
- Created instances have access to internet (note proxies can be setup through the appliance if necessary).
2636
- Created instances have accurate/synchronised time (for VM instances this is usually provided by the hypervisor; if not or for bare metal instances it may be necessary to configure a time service via the appliance).
2737

28-
## Installation on deployment host
38+
### Setup deploy host
2939

30-
Current Operating Systems supported to be deploy hosts:
40+
The following operating systems are supported for the deploy host:
3141

3242
- Rocky Linux 9
3343
- Rocky Linux 8
@@ -42,115 +52,53 @@ These instructions assume the deployment host is running Rocky Linux 8:
4252

4353
You will also need to install [OpenTofu](https://opentofu.org/docs/intro/install/rpm/).
4454

45-
## Overview of directory structure
46-
47-
- `environments/`: Contains configurations for both a "common" environment and one or more environments derived from this for your site. These define ansible inventory and may also contain provisioning automation such as Terraform or OpenStack HEAT templates.
48-
- `ansible/`: Contains the ansible playbooks to configure the infrastruture.
49-
- `packer/`: Contains automation to use Packer to build compute nodes for an enviromment - see the README in this directory for further information.
50-
- `dev/`: Contains development tools.
55+
### Create a new environment
5156

52-
## Environments
53-
54-
### Overview
55-
56-
An environment defines the configuration for a single instantiation of this Slurm appliance. Each environment is a directory in `environments/`, containing:
57-
- Any deployment automation required - e.g. Terraform configuration or HEAT templates.
58-
- An ansible `inventory/` directory.
59-
- An `activate` script which sets environment variables to point to this configuration.
60-
- Optionally, additional playbooks in `/hooks` to run before or after the main tasks.
61-
62-
All environments load the inventory from the `common` environment first, with the environment-specific inventory then overriding parts of this as required.
63-
64-
### Creating a new environment
65-
66-
This repo contains a `cookiecutter` template which can be used to create a new environment from scratch. Run the [installation on deployment host](#Installation-on-deployment-host) instructions above, then in the repo root run:
57+
Use the `cookiecutter` template to create a new environment to hold your configuration. In the repository root run:
6758

6859
. venv/bin/activate
6960
cd environments
7061
cookiecutter skeleton
7162

7263
and follow the prompts to complete the environment name and description.
7364

74-
Alternatively, you could copy an existing environment directory.
75-
76-
Now add deployment automation if required, and then complete the environment-specific inventory as described below.
77-
78-
### Environment-specific inventory structure
79-
80-
The ansible inventory for the environment is in `environments/<environment>/inventory/`. It should generally contain:
81-
- A `hosts` file. This defines the hosts in the appliance. Generally it should be templated out by the deployment automation so it is also a convenient place to define variables which depend on the deployed hosts such as connection variables, IP addresses, ssh proxy arguments etc.
82-
- A `groups` file defining ansible groups, which essentially controls which features of the appliance are enabled and where they are deployed. This repository generally follows a convention where functionality is defined using ansible roles applied to a a group of the same name, e.g. `openhpc` or `grafana`. The meaning and use of each group is described in comments in `environments/common/inventory/groups`. As the groups defined there for the common environment are empty, functionality is disabled by default and must be enabled in a specific environment's `groups` file. Two template examples are provided in `environments/commmon/layouts/` demonstrating a minimal appliance with only the Slurm cluster itself, and an appliance with all functionality.
83-
- Optionally, group variable files in `group_vars/<group_name>/overrides.yml`, where the group names match the functional groups described above. These can be used to override the default configuration for each functionality, which are defined in `environments/common/inventory/group_vars/all/<group_name>.yml` (the use of `all` here is due to ansible's precedence rules).
84-
85-
Although most of the inventory uses the group convention described above there are a few special cases:
86-
- The `control`, `login` and `compute` groups are special as they need to contain actual hosts rather than child groups, and so should generally be defined in the templated-out `hosts` file.
87-
- The cluster name must be set on all hosts using `openhpc_cluster_name`. Using an `[all:vars]` section in the `hosts` file is usually convenient.
88-
- `environments/common/inventory/group_vars/all/defaults.yml` contains some variables which are not associated with a specific role/feature. These are unlikely to need changing, but if necessary that could be done using a `environments/<environment>/inventory/group_vars/all/overrides.yml` file.
89-
- The `ansible/adhoc/generate-passwords.yml` playbook sets secrets for all hosts in `environments/<environent>/inventory/group_vars/all/secrets.yml`.
90-
- The Packer-based pipeline for building compute images creates a VM in groups `builder` and `compute`, allowing build-specific properties to be set in `environments/common/inventory/group_vars/builder/defaults.yml` or the equivalent inventory-specific path.
91-
- Each Slurm partition must have:
92-
- An inventory group `<cluster_name>_<partition_name>` defining the hosts it contains - these must be homogenous w.r.t CPU and memory.
93-
- An entry in the `openhpc_slurm_partitions` mapping in `environments/<environment>/inventory/group_vars/openhpc/overrides.yml`.
94-
See the [openhpc role documentation](https://github.com/stackhpc/ansible-role-openhpc#slurmconf) for more options.
95-
- On an OpenStack cloud, rebuilding/reimaging compute nodes from Slurm can be enabled by defining a `rebuild` group containing the relevant compute hosts (e.g. in the generated `hosts` file).
96-
97-
## Creating a Slurm appliance
98-
99-
NB: This section describes generic instructions - check for any environment-specific instructions in `environments/<environment>/README.md` before starting.
100-
101-
1. Activate the environment - this **must be done** before any other commands are run:
102-
103-
source environments/<environment>/activate
104-
105-
2. Deploy instances - see environment-specific instructions.
106-
107-
3. Generate passwords:
108-
109-
ansible-playbook ansible/adhoc/generate-passwords.yml
110-
111-
This will output a set of passwords in `environments/<environment>/inventory/group_vars/all/secrets.yml`. It is recommended that these are encrpyted and then commited to git using:
112-
113-
ansible-vault encrypt inventory/group_vars/all/secrets.yml
114-
115-
See the [Ansible vault documentation](https://docs.ansible.com/ansible/latest/user_guide/vault.html) for more details.
116-
117-
4. Deploy the appliance:
118-
119-
ansible-playbook ansible/site.yml
120-
121-
or if you have encrypted secrets use:
65+
**NB:** In subsequent sections this new environment is refered to as `$ENV`.
12266

123-
ansible-playbook ansible/site.yml --ask-vault-password
67+
Now generate secrets for this environment:
12468

125-
Tags as defined in the various sub-playbooks defined in `ansible/` may be used to only run part of the `site` tasks.
69+
ansible-playbook ansible/adhoc/generate-passwords.yml
12670

127-
5. "Utility" playbooks for managing a running appliance are contained in `ansible/adhoc` - run these by activating the environment and using:
71+
### Define infrastructure configuration
12872

129-
ansible-playbook ansible/adhoc/<playbook name>
73+
Create an OpenTofu variables file to define the required infrastructure, e.g.:
13074

131-
Currently they include the following (see each playbook for links to documentation):
132-
- `hpctests.yml`: MPI-based cluster tests for latency, bandwidth and floating point performance.
133-
- `rebuild.yml`: Rebuild nodes with existing or new images (NB: this is intended for development not for reimaging nodes on an in-production cluster - see `ansible/roles/rebuild` for that).
134-
- `restart-slurm.yml`: Restart all Slurm daemons in the correct order.
135-
- `update-packages.yml`: Update specified packages on cluster nodes.
75+
# environments/$ENV/terraform/terrraform.tfvars:
13676

137-
## Adding new functionality
138-
Please contact us for specific advice, but in outline this generally involves:
139-
- Adding a role.
140-
- Adding a play calling that role into an existing playbook in `ansible/`, or adding a new playbook there and updating `site.yml`.
141-
- Adding a new (empty) group named after the role into `environments/common/inventory/groups` and a non-empty example group into `environments/common/layouts/everything`.
142-
- Adding new default group vars into `environments/common/inventory/group_vars/all/<rolename>/`.
143-
- Updating the default Packer build variables in `environments/common/inventory/group_vars/builder/defaults.yml`.
144-
- Updating READMEs.
77+
cluster_name = "mycluster"
78+
cluster_net = "some_network" # *
79+
cluster_subnet = "some_subnet" # *
80+
key_pair = "my_key" # *
81+
control_node_flavor = "some_flavor_name"
82+
login_nodes = {
83+
login-0: "login_flavor_name"
84+
}
85+
cluster_image_id = "rocky_linux_9_image_uuid"
86+
compute = {
87+
general = {
88+
nodes: ["compute-0", "compute-1"]
89+
flavor: "compute_flavor_name"
90+
}
91+
}
14592

146-
## Monitoring and logging
93+
Variables marked `*` refer to OpenStack resources which must already exist. The above is a minimal configuration - for all variables
94+
and descriptions see `environments/$ENV/terraform/terrraform.tfvars`.
14795

148-
Please see the [monitoring-and-logging.README.md](docs/monitoring-and-logging.README.md) for details.
96+
### Deploy appliance
14997

150-
## CI/CD automation
98+
ansible-playbook ansible/site.yml
15199

152-
The `.github` directory contains a set of sample workflows which can be used by downstream site-specific configuration repositories to simplify ongoing maintainence tasks. These include:
100+
You can now log in to the cluster using:
153101

154-
- An [upgrade check](.github/workflows/upgrade-check.yml.sample) workflow which automatically checks this upstream stackhpc/ansible-slurm-appliance repo for new releases and proposes a pull request to the downstream site-specific repo when a new release is published.
102+
ssh rocky@$login_ip
155103

156-
- An [image upload](.github/workflows/upload-s3-image.yml.sample) workflow which takes an image name, downloads it from StackHPC's public S3 bucket if available, and uploads it to the target OpenStack cloud.
104+
where the IP of the login node is given in `environments/$ENV/inventory/hosts.yml`

0 commit comments

Comments
 (0)