forked from aws/aws-parallelcluster-cookbook
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure S3 mountpoint for external slurmdbd (aws#2633)
Install mountpoint-s3 and mount the S3 bucket of the external slurmdbd stack on `/opt/slurm/etc`. The slurmdbd configuration files are already generated from a template with a `:create_if_missing` action, meaning that if the files are already present in the bucket they will not be overwritten. Signed-off-by: Jacopo De Amicis <[email protected]>
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
cookbooks/aws-parallelcluster-slurm/recipes/config/config_external_slurmdbd_s3_mountpoint.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# frozen_string_literal: true | ||
|
||
# | ||
# Cookbook:: aws-parallelcluster-slurm | ||
# Recipe:: config_external_slurmdbd_s3_mountpoint | ||
# | ||
# Copyright:: 2013-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the | ||
# License. A copy of the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES | ||
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# WARNING: Mountpoint for Amazon S3 is a tool that allows you to mount an S3 bucket as a file system. | ||
# This is now GA, but it is still hosted on the AWS Labs repositories (https://github.com/awslabs/mountpoint-s3). | ||
# This is considered fine for the external slurmdbd stack. | ||
# A deeper evaluation would be required for further uses of this tool in AWS ParallelCluster. | ||
|
||
ext = platform?('ubuntu') ? "deb" : "rpm" | ||
subtree = arm? ? "arm64" : "x86_64" | ||
mount_s3_url = "https://s3.amazonaws.com/mountpoint-s3-release/latest/#{subtree}/mount-s3.#{ext}" | ||
download_path = "/tmp/mount-s3.#{ext}" | ||
|
||
remote_file 'download mountpoint-s3' do | ||
source mount_s3_url | ||
path download_path | ||
retries 3 | ||
retry_delay 5 | ||
action :create_if_missing | ||
end | ||
|
||
if platform?('ubuntu') | ||
# The Chef apt_package resource does not support the source attribute, so we use the dpkg_package resource instead. | ||
dpkg_package "Install mountpoint-s3" do | ||
source download_path | ||
end | ||
else | ||
package "Install mountpoint-s3" do | ||
source download_path | ||
end | ||
end | ||
|
||
execute 'mount slurmdbd configuration via S3' do | ||
command "mount-s3 --allow-delete --uid $(id -u slurm) --gid $(id -g slurm) --dir-mode 0755 --file-mode 0600 #{node['slurmdbd_conf_bucket']} /opt/slurm/etc/" | ||
user 'root' | ||
end |