Skip to content

Commit

Permalink
Add Dockerfile and start.sh script for SLURM setup
Browse files Browse the repository at this point in the history
  • Loading branch information
rvhonorato committed Jan 19, 2024
1 parent a338a97 commit 1df23f5
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 15 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#========================================================================================================#
FROM xenonmiddleware/slurm:20

WORKDIR /app
COPY start.sh /app/start.sh
RUN chmod +x /app/start.sh

COPY --from=golang:1.21 /usr/local/go/ /usr/local/go/

Check warning on line 8 in .devcontainer/Dockerfile

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

.devcontainer/Dockerfile#L8

COPY --from should reference a previously defined FROM alias
#========================================================================================================#
24 changes: 9 additions & 15 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/go
{
"name": "Go",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/go:1-1.21-bullseye",
"build": {
"dockerfile": "Dockerfile"
},
"features": {
"ghcr.io/devcontainers/features/go:1": {}
},
"postCreateCommand": "/app/start.sh",
"customizations": {
"vscode": {
"extensions": ["golang.go", "GitHub.copilot"]
}
}
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "go version",
// Configure tool-specific properties.
// "customizations": {},
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
32 changes: 32 additions & 0 deletions .devcontainer/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash
#========================================================================================================#
# Copied and adapter from `https://github.com/xenon-middleware/xenon-docker-images` :) #
#========================================================================================================#
echo -e "Starting SLURM..."
# echo -e "starting munged..."
setuser munge /usr/sbin/munged --foreground >/var/log/munged.out.log 2>/var/log/munged.err.log &

# echo -e "starting slurmctld..."
/usr/local/sbin/slurmctld -D -c -vvvv >/var/log/slurmctld.out.log 2>/var/log/slurmctld.err.log &

# echo -e "sleeping for a few seconds to avoid problems..."
sleep 1

# echo -e "starting compute nodes..."
/usr/local/sbin/slurmd -D -N node-0 >/var/log/slurmd-node-0.out.log 2>/var/log/slurmd-node-0.err.log &
/usr/local/sbin/slurmd -D -N node-1 >/var/log/slurmd-node-1.out.log 2>/var/log/slurmd-node-1.err.log &
/usr/local/sbin/slurmd -D -N node-2 >/var/log/slurmd-node-2.out.log 2>/var/log/slurmd-node-2.err.log &
/usr/local/sbin/slurmd -D -N node-3 >/var/log/slurmd-node-3.out.log 2>/var/log/slurmd-node-3.err.log &
/usr/local/sbin/slurmd -D -N node-4 >/var/log/slurmd-node-4.out.log 2>/var/log/slurmd-node-4.err.log &

# echo -e "sleeping for a few seconds to avoid problems..."
sleep 1

# echo -e "making accounting readable to users..."
/bin/chmod -R og+rX /var/log/slurm

# echo -e "starting sshd..."
/usr/sbin/sshd -De >/var/log/sshd.out.log 2>/var/log/sshd.err.log &

echo -e "Startup complete"
#========================================================================================================#

0 comments on commit 1df23f5

Please sign in to comment.