Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push daemon-base image #3

Merged
merged 3 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}

# MARK: packager
- name: Build packager
uses: docker/build-push-action@91df6b874e498451163feb47610c87c4a218c1ee
with:
Expand All @@ -57,6 +58,34 @@ jobs:
name: slurm
path: slurm.tar.gz

# MARK: daemon-base image
- name: Extract metadata (tags, labels) for daemon-base
id: daemon-base-meta
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e
with:
images: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
suffix=-daemon-base
tags: |
type=schedule
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
type=sha,format=long

- name: Build and push daemon-base image
uses: docker/build-push-action@91df6b874e498451163feb47610c87c4a218c1ee
with:
context: .
target: daemon-base
platforms: linux/amd64
push: true
build-args: |
DOCKER_METADATA_OUTPUT_JSON
tags: ${{ steps.daemon-base-meta.outputs.tags }}
labels: ${{ steps.daemon-base-meta.outputs.labels }}

# MARK: slurmctld image
- name: Extract metadata (tags, labels) for slurmctld
id: slurmctld-meta
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e
Expand All @@ -83,6 +112,7 @@ jobs:
tags: ${{ steps.slurmctld-meta.outputs.tags }}
labels: ${{ steps.slurmctld-meta.outputs.labels }}

# MARK: slurmdbd image
- name: Extract metadata (tags, labels) for slurmdbd
id: slurmdbd-meta
uses: docker/metadata-action@c4ee3adeed93b1fa6a762f209fb01608c1a22f1e
Expand All @@ -109,7 +139,8 @@ jobs:
tags: ${{ steps.slurmdbd-meta.outputs.tags }}
labels: ${{ steps.slurmdbd-meta.outputs.labels }}

- name: Release
# MARK: attach slurm.tar.gz to release
- name: Attach slurm.tar.gz to release
uses: softprops/action-gh-release@975c1b265e11dd76618af1c374e7981f9a6ff44a
if: startsWith(github.ref, 'refs/tags/')
with:
Expand Down
40 changes: 21 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# MARK: builder
FROM ubuntu:22.04 as builder

RUN apt-get update && apt-get install -y wget build-essential fakeroot devscripts equivs
Expand Down Expand Up @@ -42,14 +43,17 @@ RUN cd /tmp/builder/slurm* \
&& rm -rf /tmp/builder


# MARK: packager
# Package the built slurm package
FROM ubuntu:22.04 as packager

COPY --from=builder /opt/slurm /opt/slurm

RUN tar -C /opt -czf /opt/slurm.tar.gz slurm

FROM ubuntu:22.04 as daemon_base
# MARK: daemon-base
# Base image for any daemon. Contains munge, slurm binaries, convenience scripts, and supervisord
FROM ubuntu:22.04 as daemon-base

# Create the users. 60430 is the default slurm uid. 60429 for munge is arbitrary.
RUN groupadd --gid 64029 munge && useradd --uid 64029 --gid 64029 --home-dir /var/spool/munge --no-create-home --shell /bin/false munge
Expand All @@ -63,50 +67,48 @@ RUN mkdir /run/munge && chown munge:munge /run/munge
# Copy the built slurm binaries from the builder stage
COPY --from=builder /opt/slurm /opt/slurm


FROM daemon_base as slurmctld

# Default configuration options in supervisord.conf that can be overridden at runtime
ENV MUNGED_ARGS=
ENV SLURMCTLD_ARGS=
# This allows the user to use a pre-existing munge key
ENV MUNGE_KEY_IMPORT_PATH=/etc/munge/munge.imported.key

COPY daemon-base/supervisord.conf /etc/supervisord.conf

# Convenience scripts
COPY daemon-base/prefix-output.sh /opt/prefix-output.sh
RUN chmod +x /opt/prefix-output.sh

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]


# MARK: slurmctld
FROM daemon-base as slurmctld

# Set up for the runtime agent
RUN mkdir /etc/slurm /etc/runtime_config && touch /etc/runtime_config/passwd /etc/runtime_config/group
RUN cp /etc/passwd /etc/passwd.system && cp /etc/group /etc/group.system

# Copy configuration files and scripts
COPY slurmctld/runtime-agent.sh /opt/runtime-agent.sh
RUN chmod +x /opt/runtime-agent.sh
COPY prefix-output.sh /opt/prefix-output.sh
RUN chmod +x /opt/prefix-output.sh
COPY slurmctld/entrypoint.sh /opt/entrypoint.sh
RUN chmod +x /opt/entrypoint.sh
COPY slurmctld/supervisord.conf /etc/supervisord.conf
COPY slurmctld/supervisor-conf/ /etc/supervisor/conf.d/

ENTRYPOINT ["/opt/entrypoint.sh"]


FROM daemon_base as slurmdbd
# MARK: slurmdbd
FROM daemon-base as slurmdbd

RUN apt update && apt install -y libmysqlclient21

# Default configuration options in supervisord.conf that can be overridden at runtime
ENV MUNGED_ARGS=
ENV SLURMDBD_ARGS=
# This allows the user to use a pre-existing munge key
ENV MUNGE_KEY_IMPORT_PATH=/etc/munge/munge.imported.key

# Set up for the runtime agent
RUN mkdir /etc/slurm /etc/runtime_config /etc/slurmdbd_config && touch /etc/runtime_config/passwd /etc/runtime_config/group
RUN cp /etc/passwd /etc/passwd.system && cp /etc/group /etc/group.system

# Copy configuration files and scripts
COPY slurmdbd/runtime-agent.sh /opt/runtime-agent.sh
RUN chmod +x /opt/runtime-agent.sh
COPY prefix-output.sh /opt/prefix-output.sh
RUN chmod +x /opt/prefix-output.sh
COPY slurmdbd/supervisord.conf /etc/supervisord.conf

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]
COPY slurmdbd/supervisor-conf/ /etc/supervisor/conf.d/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This repo contains scripts to build SLURM from source for the [WATcloud][watclou

## Packages

- [slurmdbd and slurmctld Docker images](https://github.com/WATonomous/slurm-dist/pkgs/container/slurm-dist)
- [Docker images (slurmdbd, slurmctld, etc.)](https://github.com/WATonomous/slurm-dist/pkgs/container/slurm-dist)
- [SLURM binaries compiled for Ubuntu 22.04](https://github.com/WATonomous/slurm-dist/releases)

[watcloud]: https://cloud.watonomous.ca/
File renamed without changes.
20 changes: 2 additions & 18 deletions slurmdbd/supervisord.conf → daemon-base/supervisord.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,5 @@ stdout_logfile_maxbytes=0
redirect_stderr=true
priority=100

[program:runtime_agent]
command=/opt/prefix-output.sh /opt/runtime-agent.sh
autostart=true
autorestart=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=100

[program:slurmdbd]
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmdbd -D %(ENV_SLURMDBD_ARGS)s
autostart=true
autorestart=true
user=slurm
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=150
[include]
files = /etc/supervisor/conf.d/*.conf
18 changes: 18 additions & 0 deletions slurmctld/supervisor-conf/slurmctld.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[program:runtime_agent]
command=/opt/prefix-output.sh /opt/runtime-agent.sh
autostart=true
autorestart=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=100

[program:slurmctld]
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmctld -D %(ENV_SLURMCTLD_ARGS)s
autostart=true
autorestart=true
user=slurm
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=150
42 changes: 0 additions & 42 deletions slurmctld/supervisord.conf

This file was deleted.

18 changes: 18 additions & 0 deletions slurmdbd/supervisor-conf/slurmdbd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[program:runtime_agent]
command=/opt/prefix-output.sh /opt/runtime-agent.sh
autostart=true
autorestart=true
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=100

[program:slurmdbd]
command=/opt/prefix-output.sh /opt/slurm/sbin/slurmdbd -D %(ENV_SLURMDBD_ARGS)s
autostart=true
autorestart=true
user=slurm
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
priority=150
Loading