Skip to content

Commit

Permalink
Merge pull request #6 from jspaaks/with-mysql-accounting
Browse files Browse the repository at this point in the history
With mysql accounting
  • Loading branch information
jspaaks authored Jul 19, 2017
2 parents ac23436 + 19ba532 commit 8caa054
Show file tree
Hide file tree
Showing 21 changed files with 171 additions and 50 deletions.
4 changes: 2 additions & 2 deletions slurm/munge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ chmod 0400 /etc/munge/munge.key
RUN chown -R munge:munge /etc/munge /var/lib/munge /var/log/munge /var/run/munge

# copy the munge configuration for supervisord to inside the docker container
RUN mkdir -p /home/xenon/supervisor
ADD supervisor/munged.conf /home/xenon/supervisor/munged.conf
RUN mkdir -p /etc/supervisor
ADD supervisor/munged.conf /etc/supervisor/munged.conf

# Note: starting the munge daemon as user munge is delegated to the 'supervisord' program, which should
# be initiated elsewhere (see supervisor container).
Expand Down
20 changes: 20 additions & 0 deletions slurm/slurm-14/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
services:
mysql:
environment:
- MYSQL_ROOT_PASSWORD=xenon-slurm-pw
healthcheck:
interval: 1s
retries: 1
test: "mysqladmin -pxenon-slurm-pw ping || exit 1"
timeout: 1s
image: "mysql:5.6"
slurm:
depends_on:
- mysql
image: slurm-14
ports:
- 22
- 6817
version: "3"

8 changes: 4 additions & 4 deletions slurm/slurm-14/slurm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ SlurmctldPort=6817
SlurmdPidFile=/var/run/slurmd.%n.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurmd.%n
SlurmUser=slurm
#SlurmdUser=root
SlurmUser=root
SlurmdUser=root
#SrunEpilog=
#SrunProlog=
StateSaveLocation=/var/spool/slurmctld/state
Expand Down Expand Up @@ -119,7 +119,7 @@ SelectType=select/linear
#
# LOGGING AND ACCOUNTING
#AccountingStorageEnforce=0
AccountingStorageType=accounting_storage/none
AccountingStorageType=accounting_storage/slurmdbd
AccountingStorageUser=root
AccountingStoreJobComment=YES
ClusterName=mycluster
Expand All @@ -128,7 +128,7 @@ JobCompHost=mysql
JobCompLoc=slurm_acct_db
JobCompPass=xenon-slurm-pw
#JobCompPort=
JobCompType=jobcomp/none
JobCompType=jobcomp/mysql
JobCompUser=root
JobAcctGatherFrequency=2
JobAcctGatherType=jobacct_gather/linux
Expand Down
4 changes: 3 additions & 1 deletion slurm/slurm-14/slurmdbd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# See the slurmdbd.conf man page for more information.
#
AuthType=auth/munge
DbdHost=localhost
StorageType=accounting_storage/mysql
StorageHost=mysql
StoragePass=xenon-slurm-pw
StorageUser=root
StorageLoc=slurm_acct_db
StorageLoc=slurm_acct_db

20 changes: 20 additions & 0 deletions slurm/slurm-15/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
services:
mysql:
environment:
- MYSQL_ROOT_PASSWORD=xenon-slurm-pw
healthcheck:
interval: 1s
retries: 1
test: "mysqladmin -pxenon-slurm-pw ping || exit 1"
timeout: 1s
image: "mysql:5.6"
slurm:
depends_on:
- mysql
image: slurm-15
ports:
- 22
- 6817
version: "3"

8 changes: 4 additions & 4 deletions slurm/slurm-15/slurm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ SlurmctldPort=6817
SlurmdPidFile=/var/run/slurmd.%n.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurmd.%n
SlurmUser=slurm
#SlurmdUser=root
SlurmUser=root
SlurmdUser=root
#SrunEpilog=
#SrunProlog=
StateSaveLocation=/var/spool/slurmctld/state
Expand Down Expand Up @@ -119,7 +119,7 @@ SelectType=select/linear
#
# LOGGING AND ACCOUNTING
#AccountingStorageEnforce=0
AccountingStorageType=accounting_storage/none
AccountingStorageType=accounting_storage/slurmdbd
AccountingStorageUser=root
AccountingStoreJobComment=YES
ClusterName=mycluster
Expand All @@ -128,7 +128,7 @@ JobCompHost=mysql
JobCompLoc=slurm_acct_db
JobCompPass=xenon-slurm-pw
#JobCompPort=
JobCompType=jobcomp/none
JobCompType=jobcomp/mysql
JobCompUser=root
JobAcctGatherFrequency=2
JobAcctGatherType=jobacct_gather/linux
Expand Down
4 changes: 3 additions & 1 deletion slurm/slurm-15/slurmdbd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# See the slurmdbd.conf man page for more information.
#
AuthType=auth/munge
DbdHost=localhost
StorageType=accounting_storage/mysql
StorageHost=mysql
StoragePass=xenon-slurm-pw
StorageUser=root
StorageLoc=slurm_acct_db
StorageLoc=slurm_acct_db

5 changes: 3 additions & 2 deletions slurm/slurm-16/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ ADD slurm.conf /usr/local/etc/slurm/slurm.conf
# ADD slurmdbd.conf from context to sysconfig directory
ADD slurmdbd.conf /usr/local/etc/slurm/slurmdbd.conf

# set the workdirectory to something sane
WORKDIR /home/xenon
# set the work directory to something sane
WORKDIR /home/xenon/

20 changes: 20 additions & 0 deletions slurm/slurm-16/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
services:
mysql:
environment:
- MYSQL_ROOT_PASSWORD=xenon-slurm-pw
healthcheck:
interval: 1s
retries: 1
test: "mysqladmin -pxenon-slurm-pw ping || exit 1"
timeout: 1s
image: "mysql:5.6"
slurm:
depends_on:
- mysql
image: slurm-16
ports:
- 22
- 6817
version: "3"

8 changes: 4 additions & 4 deletions slurm/slurm-16/slurm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ SlurmctldPort=6817
SlurmdPidFile=/var/run/slurmd.%n.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurmd.%n
SlurmUser=slurm
#SlurmdUser=root
SlurmUser=root
SlurmdUser=root
#SrunEpilog=
#SrunProlog=
StateSaveLocation=/var/spool/slurmctld/state
Expand Down Expand Up @@ -119,7 +119,7 @@ SelectType=select/linear
#
# LOGGING AND ACCOUNTING
#AccountingStorageEnforce=0
AccountingStorageType=accounting_storage/none
AccountingStorageType=accounting_storage/slurmdbd
AccountingStorageUser=root
AccountingStoreJobComment=YES
ClusterName=mycluster
Expand All @@ -128,7 +128,7 @@ JobCompHost=mysql
JobCompLoc=slurm_acct_db
JobCompPass=xenon-slurm-pw
#JobCompPort=
JobCompType=jobcomp/none
JobCompType=jobcomp/mysql
JobCompUser=root
JobAcctGatherFrequency=2
JobAcctGatherType=jobacct_gather/linux
Expand Down
4 changes: 3 additions & 1 deletion slurm/slurm-16/slurmdbd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# See the slurmdbd.conf man page for more information.
#
AuthType=auth/munge
DbdHost=localhost
StorageType=accounting_storage/mysql
StorageHost=mysql
StoragePass=xenon-slurm-pw
StorageUser=root
StorageLoc=slurm_acct_db
StorageLoc=slurm_acct_db

20 changes: 20 additions & 0 deletions slurm/slurm-17/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
services:
mysql:
environment:
- MYSQL_ROOT_PASSWORD=xenon-slurm-pw
healthcheck:
interval: 1s
retries: 1
test: "mysqladmin -pxenon-slurm-pw ping || exit 1"
timeout: 1s
image: "mysql:5.6"
slurm:
depends_on:
- mysql
image: slurm-17
ports:
- 22
- 6817
version: "3"

8 changes: 4 additions & 4 deletions slurm/slurm-17/slurm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ SlurmctldPort=6817
SlurmdPidFile=/var/run/slurmd.%n.pid
SlurmdPort=6818
SlurmdSpoolDir=/var/spool/slurmd.%n
SlurmUser=slurm
#SlurmdUser=root
SlurmUser=root
SlurmdUser=root
#SrunEpilog=
#SrunProlog=
StateSaveLocation=/var/spool/slurmctld/state
Expand Down Expand Up @@ -119,7 +119,7 @@ SelectType=select/linear
#
# LOGGING AND ACCOUNTING
#AccountingStorageEnforce=0
AccountingStorageType=accounting_storage/none
AccountingStorageType=accounting_storage/slurmdbd
AccountingStorageUser=root
AccountingStoreJobComment=YES
ClusterName=mycluster
Expand All @@ -128,7 +128,7 @@ JobCompHost=mysql
JobCompLoc=slurm_acct_db
JobCompPass=xenon-slurm-pw
#JobCompPort=
JobCompType=jobcomp/none
JobCompType=jobcomp/mysql
JobCompUser=root
JobAcctGatherFrequency=2
JobAcctGatherType=jobacct_gather/linux
Expand Down
4 changes: 3 additions & 1 deletion slurm/slurm-17/slurmdbd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
# See the slurmdbd.conf man page for more information.
#
AuthType=auth/munge
DbdHost=localhost
StorageType=accounting_storage/mysql
StorageHost=mysql
StoragePass=xenon-slurm-pw
StorageUser=root
StorageLoc=slurm_acct_db
StorageLoc=slurm_acct_db

25 changes: 15 additions & 10 deletions slurm/slurm-abstract/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ FROM munge
# become root user
USER root

# mysql-client : needed for creating the accounting database
# libmysqlclient-dev: triggers installation of the MySQL accounting
# plugin during install of slurm;
# gcc : to compile slurm from the GitHub source code
Expand All @@ -13,7 +14,7 @@ USER root
# libmunge-dev : triggers installation of auth/munge plugin for slurm
# wget : to be able to download said source code
# tar : to extract the source code tar ball
RUN apt-get update && apt-get install -y libmysqlclient-dev gcc make python libssl-dev libmunge-dev tar wget
RUN apt-get update && apt-get install -y mysql-client libmysqlclient-dev gcc make python libssl-dev libmunge-dev tar wget

# make a slurm user
RUN groupadd --system slurm && useradd --system --gid slurm --create-home slurm
Expand All @@ -28,7 +29,7 @@ RUN chown -R slurm:slurm /var/spool/slurmctld
# make slurm sysconfig directory
RUN mkdir -p /usr/local/etc/slurm

# make slurm logging directory (use supervisor because that is the process that will start all the daemons/services)
# make slurm logging directory
RUN mkdir -p /var/log/slurm
RUN chown -R slurm:slurm /var/log/slurm

Expand All @@ -45,14 +46,18 @@ RUN chmod 600 /usr/local/etc/slurm/slurm.key
RUN chown slurm:slurm /usr/local/etc/slurm/slurm.key

# ADD the supervisor configuration for each slurm service
ADD supervisor/slurmctld.conf /home/xenon/supervisor/slurmctld.conf
ADD supervisor/slurmdbd.conf /home/xenon/supervisor/slurmdbd.conf
ADD supervisor/slurmd-node-0.conf /home/xenon/supervisor/slurmd-node-0.conf
ADD supervisor/slurmd-node-1.conf /home/xenon/supervisor/slurmd-node-1.conf
ADD supervisor/slurmd-node-2.conf /home/xenon/supervisor/slurmd-node-2.conf
ADD supervisor/slurmd-node-3.conf /home/xenon/supervisor/slurmd-node-3.conf
ADD supervisor/slurmd-node-4.conf /home/xenon/supervisor/slurmd-node-4.conf
ADD supervisor/slurm-nodes.conf /home/xenon/supervisor/slurm-nodes.conf
ADD supervisor/slurmctld.conf /etc/supervisor/slurmctld.conf
ADD supervisor/slurmdbd.conf /etc/supervisor/slurmdbd.conf
ADD supervisor/slurmd-node-0.conf /etc/supervisor/slurmd-node-0.conf
ADD supervisor/slurmd-node-1.conf /etc/supervisor/slurmd-node-1.conf
ADD supervisor/slurmd-node-2.conf /etc/supervisor/slurmd-node-2.conf
ADD supervisor/slurmd-node-3.conf /etc/supervisor/slurmd-node-3.conf
ADD supervisor/slurmd-node-4.conf /etc/supervisor/slurmd-node-4.conf
ADD supervisor/slurm-nodes.conf /etc/supervisor/slurm-nodes.conf

# set workdirectory to something sane
WORKDIR /home/xenon/

# add a test job script
ADD test-slurm.job /home/xenon/test-slurm.job
RUN chown xenon:xenon /home/xenon/test-slurm.job
3 changes: 2 additions & 1 deletion slurm/slurm-abstract/supervisor/slurmdbd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ autorestart=false
startretries=0
stderr_logfile=/var/log/supervisor/slurmdbd.err.log
stdout_logfile=/var/log/supervisor/slurmdbd.out.log
user=slurm
user=root

12 changes: 12 additions & 0 deletions slurm/slurm-abstract/test-slurm.job
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
#SBATCH --job-name test-slurm
#SBATCH --output test-slurm.out
#SBATCH --error test-slurm.err
#SBATCH --time 0:30:00
#SBATCH --partition mypartition
#SBATCH --ntasks 1

date
hostname
sleep 15
date
2 changes: 1 addition & 1 deletion slurm/ssh/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ chmod 644 .ssh/authorized_keys .ssh/id_rsa.pub .ssh/id_dsa.pub && \
chown -R xenon:xenon .ssh

# add the supervisor configuration for starting ssh
ADD supervisor/sshd.conf /home/xenon/supervisor/sshd.conf
ADD supervisor/sshd.conf /etc/supervisor/sshd.conf

10 changes: 5 additions & 5 deletions slurm/supervisor/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM slurm
FROM slurm-abstract

# become root
USER root
Expand All @@ -9,13 +9,13 @@ RUN apt-get update && apt-get install -y python-pip
RUN pip install --upgrade pip && pip install supervisor==3.0b2

# add the supervisor configuration from the Docker context to inside the container
ADD supervisor/supervisord.conf /home/xenon/supervisor/supervisord.conf
ADD supervisor/supervisord.conf /etc/supervisord.conf

# make the logging directory for supervisor
RUN mkdir -p /var/log/supervisor
RUN chmod -R 777 /var/log/supervisor

# add the shell script that will initialize all other services
ADD start-services.sh /home/xenon/start-services.sh
RUN chmod +x /home/xenon/start-services.sh
CMD /home/xenon/start-services.sh
ADD start-services.sh /etc/start-services.sh
RUN chmod +x /etc/start-services.sh
CMD /etc/start-services.sh
Loading

0 comments on commit 8caa054

Please sign in to comment.