Skip to content

Commit

Permalink
feat: support for network type (#72)
Browse files Browse the repository at this point in the history
* feat: support for network type
* example for --network=fakeroot

Signed-off-by: vsoch <vsoch@users.noreply.github.com>
  • Loading branch information
vsoch committed May 11, 2024
1 parent 088bd96 commit ca6fa18
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ and **Merged pull requests**. Critical items to know are:
The versions coincide with releases on pypi.

## [0.1.x](https://github.com/singularityhub/singularity-compose/tree/master) (0.1.x)
- support for custom network type (0.1.19)
- fix 'bridge' option for 'up' command (0.1.18)
- add support for instance replicas (0.1.17)
- fix check command validation (0.1.16)
Expand Down
2 changes: 2 additions & 0 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

The following commands are currently supported. Remember, you must be in the
present working directory of the compose file to reference the correct instances.
Along with the below, you can find more details and examples for singularity-compose.yaml
syntax under the [current spec](spec/spec-2.0.md)

## check

Expand Down
20 changes: 20 additions & 0 deletions docs/spec/spec-2.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,26 @@ The example below will disable the network features:
enable: true | false
```

### Custom Network

If you want to add your own customized string of network types for `--network`, just do that:

```yaml
instance1:
...
network:
type: bridge
```

You might also want `--network=fakeroot`:

```yaml
instance1:
...
network:
type: fakeroot
```


## Start Group

Expand Down
7 changes: 6 additions & 1 deletion scompose/project/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,13 @@ def _get_network_commands(self, ip_address=None):
# Fakeroot means not needing sudo
fakeroot = "--fakeroot" in self.start_opts or "-f" in self.start_opts

# Do we have a custom type?
network_type = self.network.get("type")
if network_type is not None:
ports += ["--network", network_type]

# If not sudo or fakeroot, we need --network none
if not self.sudo and not fakeroot:
elif not self.sudo and not fakeroot:
ports += ["--network", "none"]

for pair in self.ports:
Expand Down
2 changes: 1 addition & 1 deletion scompose/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"""

__version__ = "0.1.18"
__version__ = "0.1.19"
AUTHOR = "Vanessa Sochat"
AUTHOR_EMAIL = "vsoch@users.noreply.github.com"
NAME = "singularity-compose"
Expand Down

0 comments on commit ca6fa18

Please sign in to comment.