Code Monkey home page Code Monkey logo

xdmod-container's Introduction

xdmod-container

This repository includes container provisioning files to create a container that executes the XDMoD web application. Both the MariaDB server and Apache httpd execute within the container, making the service completely self-contained.

The MariaDB instance will retain the default CentOS 7 configuration; no root password is set, the test database is not removed, and the anonymous user is not removed. Since all access is internal to the container, there's no need to secure it.

The container features a runloop that waits for files to appear in /var/lib/XDMoD-ingest-queue/in. The file(s) are ingested into the database and will be moved to /var/lib/XDMoD-ingest-queue/out if successful or to /var/lib/XDMoD-ingest-queue/error if not. Results of the operations are logged to /var/log/xdmod/ingest-queue.log.

Docker

The Docker container should be spawned with TCP port 8080 mapped to a host port to expose the web application. The database starts out uninitialized; when a container instance is spawned an external directory may be bind-mounted at /var/lib/mysql in the container to make the database persistent across restarts of the instance, and when the container entrypoint script is first executed the database setup will be completed automatically.

An external directory can also be bind-mounted at /var/lib/XDMoD-ingest-queue. The directory must have the following subdirectories:

  • in
  • out
  • error

These three directories will be created automatically by the entrypoint script if not present in /var/lib/XDMoD-ingest-queue. Using an external directory allows processes outside the container to copy Slurm accounting log files to the in subdirectory and the entrypoint runloop will awake within 5 minutes and ingest the data.

Example

The container image is built in this repository directory using:

$ cd Docker
$ ROOT_PASSWORD="<password>" docker build --rm --tag local/xdmod:9.5.0 .

The following example illustrates the creation of an instance with persistent database and ingest queue directories:

$ mkdir -p /tmp/XDMoD-Caviness/ingest-queue
$ mkdir -p /tmp/XDMoD-Caviness/database
$ docker run --detach --restart unless-stopped \
    --name XDMoD-Caviness \
    --env CLUSTER_NAME="cc3" \
    --env RESOURCE_LOG_FORMAT="slurm" \
    --volume "/tmp/XDMoD-Caviness/database:/var/lib/mysql:rw" \
    --volume "/tmp/XDMoD-Caviness/ingest-queue:/var/lib/XDMoD-ingest-queue:rw" \
    --publish 8080:8080
    local/xdmod:9.5.0

The CLUSTER_NAME and RESOURCE_LOG_FORMAT are used in the entrypoint XDMoD-start script as arguments to xdmod-shredder for resource manager log file ingestion. RESOURCE_LOG_FORMAT defaults to "slurm".

Once the instance is online, XDMoD must be initialized and the ingest queue activated:

$ docker exec -it XDMoD-Caviness /bin/bash -l
[container]> xdmod-setup
    :
[container]> touch /var/lib/XDMoD-ingest-queue/enable
[container]> exit

At this point, copying files to /tmp/XDMoD-Caviness/ingest-queue/in will see them processed in the runloop. Point a web browser to http://localhost:8080/ to use the web application.

Singularity

Singularity 3.0 or newer is required (3.2.1 was used in our production environment) for the network port mapping and support for instances (service-like containers).

Rather than bind-mounting directories at specific paths as outline above for Docker, with Singularity a writable overlay file system is a good option. Any changes to the file system relative to the read-only container image are written to an external directory. As with Docker, port 8080 is mapped to a host port to expose the web application.

Example

The container image is built in this repository directory using:

$ cd Singularity
$ ROOT_PASSWORD="<password>" singularity build XDMoD-9.5.0.sif Singularity

The following example illustrates the execution of an instance with an overlay file system:

$ mkdir -p /tmp/XDMoD-Caviness
$ singularity instance start --overlay /tmp/XDMoD-Caviness --net --dns 10.65.0.13 \
    --network bridge --network-args "portmap=8080:8080/tcp" \
    --env CLUSTER_NAME="cc3" --env RESOURCE_LOG_FORMAT="slurm" \
    XDMoD-9.5.0.sif XDMoD-Caviness

The CLUSTER_NAME and RESOURCE_LOG_FORMAT are used in the entrypoint XDMoD-start script as arguments to xdmod-shredder for resource manager log file ingestion. RESOURCE_LOG_FORMAT defaults to "slurm".

Once the instance is online, XDMoD must be initialized and the ingest queue activated:

$ singularity shell instance://XDMoD-Caviness
[container]> xdmod-setup
    :
[container]> touch /var/lib/XDMoD-ingest-queue/in
[container]> touch /var/lib/XDMoD-ingest-queue/enable
[container]> exit

At this point, copying files to /tmp/XDMoD-Caviness/upper/var/lib/XDMoD-ingest-queue/in will see them processed in the runloop. Point a web browser to http://localhost:8080/ to use the web application.

Helper Scripts

The sbin directory includes a SysV-style script that can be used to start, stop, restart, and query status of instances of the Singularity container.

To start a new or existing instance with the default container image and overlay directory:

$ sbin/instance Caviness start

To use a different container image and overlay directory:

$ sbin/instance --overlay=/tmp/XDMoD --image=./XDMoD-uge.sif Farber start

The status action returns 0 if the instance is running, non-zero otherwise:

$ sbin/instance Farber status

The --verbose option increases the amount of output displayed by the command, and the --help option summarizes the command and all options.

In addition, the systemd directory contains a templated service unit that integrates Singularity instances with systemd for automated startup/shutdown. Adding our Farber instance above looks like:

$ cp systemd/xdmod-template.service /etc/systemd/system/[email protected]
$ systemctl daemon-reload
$ systemctl enable [email protected]
$ systemctl start [email protected]

xdmod-container's People

Contributors

jtfrey avatar pauldalewilliams avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

xdmod-container's Issues

Browser doesnt open the XDMOD application

Followed all the steps as mentioned for docker container, but it doesnt open the web application. THe port also seems to be blocked. The container seems running. Please help.

COPY failed: forbidden path outside the build context: XDMoD-start

Sorry, just another note for other users trying to get this to work. I had to make sure that I was running the build in the root of the git repo and then pass in the location of the Dockerfile file using the -f switch otherwise I was getting a 'COPY failed: forbidden path outside the build context: XDMoD-start' error

ROOT_PASSWORD="<password>" docker build --rm -t local/xdmod:8.1.2 -f Docker/Dockerfile .

Slight error in Docker example code

Thanks for the docker container, you've saved me from trying to build xdmod on Ubuntu (nightmare!). Just a note for anyone like me who is not overly familiar with docker. In the example section where you're building the container there's a small error in the example code. It's missing the full stop that indicates that the docker file is in the current directory.

$ cd Docker
$ ROOT_PASSWORD="<password>" docker build --rm --tag local/xdmod:8.1.2 .

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.