diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..c2f08a2 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -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/ +#========================================================================================================# diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 93fc035..5834beb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -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" } diff --git a/.devcontainer/start.sh b/.devcontainer/start.sh new file mode 100644 index 0000000..84b674b --- /dev/null +++ b/.devcontainer/start.sh @@ -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" +#========================================================================================================# \ No newline at end of file