|
| 1 | +# `replicas` must match the number of nodes defined in the services section |
| 2 | +x-shared-workers: |
| 3 | + &workers |
| 4 | + replicas: 4 |
| 5 | + |
| 6 | +# Base image version to use |
| 7 | +x-shared-build-args: &shared-build-args |
| 8 | + BASE_VERSION: latest |
| 9 | + <<: *workers |
| 10 | + |
| 11 | +# Docker prohibits copying files from outside of the build context. |
| 12 | +# In order to be able to copy the whole repo into the container, |
| 13 | +# we have to set the context to be the root of the repo. |
| 14 | +# We then have to specify the path from there to the Dockerfile. |
| 15 | +x-shared-build-context: &shared-build-context |
| 16 | + context: ../../.. |
| 17 | + dockerfile: containers/spindle-slurm-ubuntu/testing/Dockerfile |
| 18 | + args: *shared-build-args |
| 19 | + |
| 20 | +# Name of the head node |
| 21 | +x-shared-environment: &shared-environment |
| 22 | + SLURM_HEAD_NODE: slurm-head |
| 23 | + <<: *workers |
| 24 | + |
| 25 | +# The entrypoint runs different services depending |
| 26 | +# on the node's role. Valid options are: |
| 27 | +# - worker: runs slurmd |
| 28 | +# - db: runs slurmdbd |
| 29 | +# - ctl: runs slurmctld |
| 30 | +x-worker-environment: &worker-environment |
| 31 | + SLURM_ROLE: worker |
| 32 | + <<: *shared-environment |
| 33 | + |
| 34 | +networks: |
| 35 | + slurm: |
| 36 | + driver: bridge |
| 37 | + |
| 38 | +# Common parameters for all nodes. |
| 39 | +x-shared-node-parameters: &shared-node-parameters |
| 40 | + build: *shared-build-context |
| 41 | + networks: |
| 42 | + - slurm |
| 43 | + cap_add: |
| 44 | + - SYS_NICE # Required for libnuma |
| 45 | + |
| 46 | +x-healthcheck-parameters: &healthcheck-parameters |
| 47 | + start_period: 3s |
| 48 | + interval: 3s |
| 49 | + timeout: 5s |
| 50 | + retries: 5 |
| 51 | + |
| 52 | +x-worker-parameters: &worker-node-parameters |
| 53 | + <<: *shared-node-parameters |
| 54 | + environment: *worker-environment |
| 55 | + depends_on: |
| 56 | + slurm-head: |
| 57 | + condition: service_healthy |
| 58 | + healthcheck: |
| 59 | + test: ["CMD", "stat", "/var/run/slurmd/slurmd.pid"] |
| 60 | + <<: *healthcheck-parameters |
| 61 | + |
| 62 | +services: |
| 63 | + slurm-mariadb: |
| 64 | + image: mariadb:12 |
| 65 | + networks: |
| 66 | + - slurm |
| 67 | + hostname: slurm-mariadb |
| 68 | + container_name: slurm-mariadb |
| 69 | + env_file: mariadb.env |
| 70 | + environment: |
| 71 | + MYSQL_RANDOM_ROOT_PASSWORD: "yes" |
| 72 | + MYSQL_DATABASE: "slurm_acct_db" |
| 73 | + MYSQL_USER: "slurm" |
| 74 | + healthcheck: |
| 75 | + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] |
| 76 | + <<: *healthcheck-parameters |
| 77 | + |
| 78 | + slurm-db: |
| 79 | + <<: *shared-node-parameters |
| 80 | + hostname: slurm-db |
| 81 | + container_name: slurm-db |
| 82 | + environment: |
| 83 | + SLURM_ROLE: db |
| 84 | + <<: *shared-environment |
| 85 | + depends_on: |
| 86 | + slurm-mariadb: |
| 87 | + condition: service_healthy |
| 88 | + healthcheck: |
| 89 | + test: ["CMD", "stat", "/var/run/slurmdbd/slurmdbd.pid"] |
| 90 | + <<: *healthcheck-parameters |
| 91 | + |
| 92 | + slurm-head: |
| 93 | + <<: *shared-node-parameters |
| 94 | + hostname: slurm-head |
| 95 | + container_name: slurm-head |
| 96 | + tty: true |
| 97 | + environment: |
| 98 | + SLURM_ROLE: ctl |
| 99 | + <<: *shared-environment |
| 100 | + depends_on: |
| 101 | + slurm-db: |
| 102 | + condition: service_healthy |
| 103 | + healthcheck: |
| 104 | + test: ["CMD", "stat", "/var/run/slurmd/slurmctld.pid"] |
| 105 | + <<: *healthcheck-parameters |
| 106 | + |
| 107 | + slurm-node-1: |
| 108 | + <<: *worker-node-parameters |
| 109 | + hostname: slurm-node-1 |
| 110 | + container_name: slurm-node-1 |
| 111 | + |
| 112 | + slurm-node-2: |
| 113 | + <<: *worker-node-parameters |
| 114 | + hostname: slurm-node-2 |
| 115 | + container_name: slurm-node-2 |
| 116 | + |
| 117 | + slurm-node-3: |
| 118 | + <<: *worker-node-parameters |
| 119 | + hostname: slurm-node-3 |
| 120 | + container_name: slurm-node-3 |
| 121 | + |
| 122 | + slurm-node-4: |
| 123 | + <<: *worker-node-parameters |
| 124 | + hostname: slurm-node-4 |
| 125 | + container_name: slurm-node-4 |
| 126 | + |
0 commit comments