Skip to content

Commit b80ba89

Browse files
committed
adding paper
Signed-off-by: Vanessa Sochat <[email protected]>
1 parent 34b7e41 commit b80ba89

File tree

3 files changed

+245
-0
lines changed

3 files changed

+245
-0
lines changed

paper/paper.bib

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
@ARTICLE{Kurtzer2017-xj,
2+
title = "Singularity: Scientific containers for mobility of compute",
3+
author = "Kurtzer, Gregory M and Sochat, Vanessa and Bauer, Michael W",
4+
abstract = "Here we present Singularity, software developed to bring
5+
containers and reproducibility to scientific computing. Using
6+
Singularity containers, developers can work in reproducible
7+
environments of their choosing and design, and these complete
8+
environments can easily be copied and executed on other
9+
platforms. Singularity is an open source initiative that
10+
harnesses the expertise of system and software engineers and
11+
researchers alike, and integrates seamlessly into common
12+
workflows for both of these groups. As its primary use case,
13+
Singularity brings mobility of computing to both users and HPC
14+
centers, providing a secure means to capture and distribute
15+
software and compute environments. This ability to create and
16+
deploy reproducible environments across these centers, a
17+
previously unmet need, makes Singularity a game changing
18+
development for computational science.",
19+
journal = "PLoS One",
20+
doi = "journal.pone.0177459",
21+
publisher = "Public Library of Science",
22+
volume = 12,
23+
number = 5,
24+
pages = "e0177459",
25+
month = "11~" # may,
26+
year = 2017
27+
}
28+
29+
30+
@Software{SingularityCompose,
31+
title = "singularity-compose",
32+
booktitle = "Singularity Compose",
33+
author = "Sochat, Vanessa",
34+
abstract = "orchestration tool for Singularity container instances",
35+
howpublished = "\url{https://singularityhub.github.io/singularity-compose}",
36+
note = "Accessed: 2019-6-24"
37+
}
38+
39+
40+
@Software{SingularityComposeGithub,
41+
title = "Singularity Compose Github",
42+
booktitle = "Singularity Compose Github",
43+
author = "Sochat, Vanessa",
44+
abstract = "open source code for singularity-compose",
45+
howpublished = "\url{https://github.com/singularityhub/singularity-compose}",
46+
note = "Accessed: 2019-6-24"
47+
}
48+
49+
50+
51+
@MISC{DockerCompose,
52+
title = "Docker Compose",
53+
booktitle = "Docker Documentation",
54+
abstract = "Introduction and Overview of Compose",
55+
month = jun,
56+
year = 2019,
57+
howpublished = "\url{https://docs.docker.com/compose/}",
58+
note = "Accessed: 2019-6-24"
59+
}
60+
61+
62+
@Software{SingularityComposeExamples,
63+
title = "Singularity Compose Examples",
64+
booktitle = "Singularity Compose Examples",
65+
author = "Sochat, Vanessa",
66+
abstract = "open source examples for singularity-compose",
67+
howpublished = "\url{https://github.com/singularityhub/singularity-compose-examples}",
68+
note = "Accessed: 2019-6-24"
69+
}
70+
71+
72+
@MISC{SingularityInstances,
73+
title = "Running Services --- Singularity container 3.2 documentation",
74+
howpublished = "\url{https://sylabs.io/guides/3.2/user-guide/running_services.html?highlight=instances}",
75+
note = "Accessed: 2019-6-24"
76+
}
77+
78+
79+
@MISC{Meyer2019-sd,
80+
title = "Sylabs Slides Singularity Updates Into Its Enterprise Pro
81+
Package",
82+
booktitle = "{SDxCentral}",
83+
author = "Meyer, Dan",
84+
abstract = "Sylabs pushed out an update to its enterprise-focused
85+
SingularityPRO container platform that takes advantage of its
86+
3.x launch.",
87+
month = apr,
88+
year = 2019,
89+
howpublished = "\url{https://www.sdxcentral.com/articles/news/sylabs-slides-singularity-updates-into-its-enterprise-pro-package/2019/04/}",
90+
note = "Accessed: 2019-6-24"
91+
}

paper/paper.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
title: 'Singularity Compose: Orchestration for Singularity Instances'
3+
tags:
4+
- containers
5+
- singularity
6+
- linux
7+
- registry
8+
authors:
9+
- name: Vanessa Sochat
10+
orcid: 0000-0002-4387-3819
11+
affiliation: 1
12+
affiliations:
13+
- name: Stanford University Research Computing
14+
index: 1
15+
date: 1 July 2019
16+
bibliography: paper.bib
17+
---
18+
19+
# Summary
20+
21+
Singularity Compose is an orchestration tool for management of Singularity containers.
22+
23+
![Singularity Compose](singularity-compose.png)
24+
25+
The Singularity container technology started to become popular in 2016,
26+
as it offered a more secure option to run encapsulated environments [@Kurtzer2017-xj].
27+
Traditionally, this meant that Singularity users could run an entrypoint built into the container
28+
(called a runscript), execute a custom command, or shell into a container.
29+
Unlike Docker, these basic interactions simply interacted with processes in the
30+
foreground (e.g., running a script and exiting) and were not appropriate to run
31+
background services. This was a task for container instances [@SingularityInstances]
32+
that were developed in the years to come.
33+
34+
A container instance [@SingularityInstances] equates to running a container in a detached or
35+
daemon mode. It is a persistent version of the same container image that
36+
can also be isolated. Instances allow for running persistent services in the background,
37+
and then interaction with these services from the host and other containers.
38+
Examples of services include databases, web servers, and associated applications
39+
that interact with them. For sibling container technology Docker, an early solution,
40+
Docker Compose was developed to allow for simple orchestration
41+
on a host, meaning creation of a `docker-compose.yml` file to define services,
42+
volumes, ports exposed, and other customizations to networking and environment
43+
[@DockerCompose].
44+
45+
No equivalent orchestration tool has been created for Singularity container
46+
instances until now. While Singularity has empowered enterprise users to run
47+
services via platforms such as Kubernetes [@Meyer2019-sd], these platforms come
48+
with privilege. It is often the case that a production Kubernetes cluster is not
49+
readily available to a user via his or her institution, or that the user
50+
cannot pay a cloud provider to deploy one. However, this does not imply that
51+
a user that is not associated with an enterprise (e.g., an open source developer
52+
or academic) would not benefit from such an orchestration tool. This is a classic
53+
example of mismatched incentives. The company supporting Singularity is not
54+
incentivized to provide the tool, and so it is the responsibility of the open
55+
source community to step up.
56+
57+
58+
## Singularity Compose
59+
60+
Singularity Compose [@SingularityCompose] is the solution for this niche group of non enterprise users
61+
that want to easily create a configuration file to control creation and interaction
62+
of services provided by Singularity container instances. It mirrors the format
63+
of the `docker-compose.yml` file with a `singularity-compose.yml`, and allows
64+
the user to define one or more container services, optionally with exposed ports
65+
to the host. Akin to docker-compose, the user can easily define volumes to be bound
66+
to each instance, along with ports to be exposed, and a container binary
67+
to build or pull from a remote resource. Custom scripts can also be defined to
68+
run after creation of the instances. Singularity Compose handles designation
69+
of addresses on a local bridge network for each container, and creation of
70+
resource files to bind to the container to "see" one another related to hostnames
71+
and networking. Importantly, by way of adding a Singularity Compose to a repository,
72+
a user is ensuring not just reproducibility of a container recipe, but also
73+
reproducibility of it's build and creation of services. For example, a
74+
sequence of steps for a single container to build it, assign an address, create networking
75+
files, and then start an instance might look like this:
76+
77+
```bash
78+
$ sudo singularity build app/app.sif app/Singularity
79+
$ singularity instance start \
80+
--bind etc.hosts:/etc/hosts \
81+
--net --network-args "portmap=80:80/tcp" --network-args "IP=10.22.0.2" \
82+
--hostname app \
83+
--writable-tmpfs app.sif app
84+
```
85+
86+
In the above command, we've already generated the `etc.hosts` file that defines
87+
hostnames and addresses for other instances, along with a hostname `app` for
88+
the container we are starting. If we are running three services, we might need
89+
to do this three times, and be mindful of binds, ports, and additional arguments
90+
for each. With Singularity Compose, the user writes a `singularity-compose.yml`
91+
file once:
92+
93+
```yaml
94+
version: "1.0"
95+
instances:
96+
97+
nginx:
98+
build:
99+
context: ./nginx
100+
recipe: Singularity.nginx
101+
volumes:
102+
- ./nginx.conf:/etc/nginx/conf.d/default.conf
103+
- ./uwsgi_params.par:/etc/nginx/uwsgi_params.par
104+
- ./nginx/cache:/var/cache/nginx
105+
- ./nginx/run:/var/run
106+
ports:
107+
- 80:80
108+
depends_on:
109+
- app
110+
volumes_from:
111+
- app
112+
113+
app:
114+
build:
115+
context: ./app
116+
volumes:
117+
- ./app:/code
118+
- ./static:/var/www/static
119+
- ./images:/var/www/images
120+
ports:
121+
- 8000:8000
122+
```
123+
124+
And then can easily build all non-existing containers, and bring up all services
125+
with one command:
126+
127+
```bash
128+
$ singularity-compose up
129+
```
130+
131+
And then easily bring services down, restart, shell into a container, execute
132+
a command to a container, or run a container's internal runscript.
133+
134+
```bash
135+
$ singularity-compose down # stop services
136+
$ singularity-compose restart # stop and start services
137+
$ singularity-compose shell app # shell into an instance
138+
$ singularity-compose exec app "Hello!" # execute a command
139+
$ singularity-compose run app # run internal runscript
140+
```
141+
142+
These interactions greatly improve both reproducibility and running of
143+
any development workflow that is not appropriate for an enterprise cluster but
144+
relies on orchestration of container instances.
145+
146+
For the interested reader, the complete documentation for Singularity Compose [@SingularityCompose]
147+
is provided, along with the code on GitHub [@SingularityComposeGithub]. For
148+
additional walkthroughs and complete examples, we direct the reader to the examples
149+
repository, also on GitHub [@SingularityComposeExamples]. Contribution by way
150+
of additional examples, questions, or requests for development of a new example
151+
are appreciated and welcome.
152+
153+
154+
# References

paper/singularity-compose.png

130 KB
Loading

0 commit comments

Comments
 (0)