@@ -14,8 +14,8 @@ or services.
14
14
15
15
Singularity compose uses Singularity on the backend, so anything that would require sudo (root)
16
16
permissions for Singularity is also required for Singularity compose. This includes most
17
- networking commands (e.g., asking to allocate ports) and builds from recipe files.
18
- However, if you are using Singularity v3.3 or higher, you can take advantage of
17
+ networking commands (e.g., asking to allocate ports) and builds from recipe files.
18
+ However, if you are using Singularity v3.3 or higher, you can take advantage of
19
19
[ fakeroot] ( https://sylabs.io/guides/3.3/user-guide/fakeroot.html ) to try and get around this.
20
20
The snippet below shows how to add fakeroot as an option under a build section:
21
21
@@ -32,17 +32,38 @@ And a complete example is provided [here](https://github.com/singularityhub/sing
32
32
33
33
## Getting Started
34
34
35
+ ### Install
36
+
37
+ Note that you can install from pip:
38
+
39
+ ` ` ` bash
40
+ $ pip install singularity-compose
41
+ ```
42
+
43
+ If you want to run ` singularity-compose check ` you'll need jsonschema:
44
+
45
+ ``` bash
46
+ $ pip install singularity-compose[checks]
47
+ ```
48
+
49
+ To get full dependencies including those for testing and the above:
50
+
51
+ ``` bash
52
+ $ pip install singularity-compose[all]
53
+ ```
54
+
55
+
35
56
### Dependencies
36
57
37
- Singularity Compose *must* use a version of [Singularity](https://sylabs.io/guides/latest/user-guide/)
58
+ Singularity Compose * must* use a version of [ Singularity] ( https://sylabs.io/guides/latest/user-guide/ )
38
59
3.2.1 or greater. It's recommended to use the latest (3.3.0 release at the time of this writing) otherwise there was
39
60
a bug with some versions of 3.2.1. Singularity 2.x absolutely will not work.
40
61
Python 3 is also required, as Python 2 is at end of life.
41
62
42
63
### singularity-compose.yml
43
64
44
65
For a singularity-compose project, it's expected to have a ` singularity-compose.yml `
45
- in the present working directory. You can look at a simple example here, here is a
66
+ in the present working directory. You can look at a simple example here, here is a
46
67
version 1.0 spec (before we added networking and exec options):
47
68
48
69
``` yaml
@@ -60,7 +81,7 @@ instances:
60
81
- 80:80
61
82
` ` `
62
83
63
- and [here](https://github.com/singularityhub/singularity-compose-examples/tree/4241ea8b4e068d93859acb7d2b924702815af0ce/v2.0/ping)
84
+ and [here](https://github.com/singularityhub/singularity-compose-examples/tree/4241ea8b4e068d93859acb7d2b924702815af0ce/v2.0/ping)
64
85
is a version 2.0 spec that shows adding networking and exec options:
65
86
66
87
` ` ` yaml
@@ -77,7 +98,7 @@ instances:
77
98
options :
78
99
- fakeroot
79
100
exec :
80
- options:
101
+ options :
81
102
- " env-file=myvars.env"
82
103
command : printenv SUPERHERO
83
104
alp2 :
@@ -95,17 +116,17 @@ instances:
95
116
- alp1
96
117
` ` `
97
118
98
- If you are familiar with [docker-compose](https://docs.docker.com/compose/)
99
- the file should look very familiar. A key difference is that instead of
100
- " services" we have "instances." And you guessed correctly - each
101
- section there corresponds to a
119
+ If you are familiar with [docker-compose](https://docs.docker.com/compose/)
120
+ the file should look very familiar. A key difference is that instead of
121
+ "services" we have "instances." And you guessed correctly - each
122
+ section there corresponds to a
102
123
[Singularity instance](https://sylabs.io/guides/3.2/user-guide/running_services.html)
103
124
that will be created. In this guide, we will walk through each of the sections
104
125
in detail.
105
126
106
127
### Instance folders
107
128
108
- Generally, each section in the yaml file corresponds with a container instance to be run,
129
+ Generally, each section in the yaml file corresponds with a container instance to be run,
109
130
and each container instance is matched to a folder in the present working directory.
110
131
For example, if I give instruction to build an ` nginx` instance from
111
132
a `nginx/Singularity.nginx` file, I should have the
@@ -155,15 +176,15 @@ This will pull a container `nginx.sif` into a `nginx` context folder:
155
176
```
156
177
157
178
It's less likely that you will be able to pull a container that is ready to
158
- go, as typically you will want to customize the
159
- [ startscript] ( https://sylabs.io/guides/3.2/user-guide/definition_files.html#startscript )
179
+ go, as typically you will want to customize the
180
+ [ startscript] ( https://sylabs.io/guides/3.2/user-guide/definition_files.html#startscript )
160
181
for the instance. Now that we understand the basic organization, let's
161
182
bring up some instances.
162
183
163
184
## Quick Start
164
185
165
- For this quick start, we are going to use the
166
- [ singularity-compose-simple] ( https://www.github.com/singularityhub/singularity-compose-simple )
186
+ For this quick start, we are going to use the
187
+ [ singularity-compose-simple] ( https://www.github.com/singularityhub/singularity-compose-simple )
167
188
example. Singularity has a networking issue that currently doesn't allow communication
168
189
between multiple containers (due to iptables and firewall issues) so for now the most we
169
190
can do is show you one container. First, install singularity-compose from pip:
@@ -255,7 +276,7 @@ $ singularity-compose exec app uname -a
255
276
```
256
277
257
278
When you open your browser to [ http://127.0.0.1 ] ( http://127.0.0.1 )
258
- you should see the upload interface.
279
+ you should see the upload interface.
259
280
260
281
![ img/upload.png] ( img/upload.png )
261
282
@@ -277,7 +298,7 @@ The images that you upload are stored in `images` at the root:
277
298
278
299
``` bash
279
300
$ ls images/
280
- 2018-02-20-172617.jpg 40-acos.png _upload
301
+ 2018-02-20-172617.jpg 40-acos.png _upload
281
302
```
282
303
283
304
And static files are in ` static ` .
@@ -360,7 +381,7 @@ Python API, see [here](/singularity-compose/api/).
360
381
361
382
The [ specification] ( spec/ ) describes in more detail the sections of the singularity-compose.yml.
362
383
For example, in the quick start above, we have a post command for the app instance
363
- that creates a series of folders on the host.
384
+ that creates a series of folders on the host.
364
385
365
386
## Examples
366
387
0 commit comments