Implemented support for UDP ports

This commit is contained in:
Chris 2022-10-14 00:39:03 +02:00
parent 3a16d887c0
commit bcc80f73a7
2 changed files with 37 additions and 3 deletions

View File

@ -15,7 +15,7 @@ up a ready-to-roll mongodb or openldap server, it does what it is supposed to.
- [x] Add filtering to `find` command, to seach for tags or name
- [ ] App port binding, i.e. phpmyadmin on 9000, phpcacheadmin on 9001
- [ ] Make use of a `~/.serverenvs` to override envs for instances
- [ ] Consider UDP?
- [x] Consider UDP?
## Examples
@ -53,6 +53,39 @@ Stopped mongo<other>
$
```
## Service definition
Services are defined as JSON and should be put in the `registry` directory, which
should be located in the same directory as the executable (when using phar) or in
the project root when running from source.
```json
{
"$type": "service",
"name": "myservice",
"description": "My neat service",
"tags": [ "app", "neat" ],
"author": "Myself <myself@domain.tld>",
"image": "myself/myservice",
"ports": [
{ "port": 1337, "info": "Neat port" },
{ "port": 1337, "info": "Neat port (UDP)", "proto": "udp" }
],
"persistence": [
{ "path": "/data", "hint": "Fancy data" }
],
"environment": {
"NEAT_ENV_VAR": "useful value",
},
"scripts": {
"setup": {
"info": "Launch the neat configuration tool",
"execute": "/app/setup.sh"
}
}
}
```
## FAQ

View File

@ -119,9 +119,10 @@ class ContainerManager
foreach ($ports as $port) {
$portNumber = intval($port['port']) + $portOffset;
$target = array_key_exists('target',$port)?intval($port['target']):intval($port['port']);
$proto = $port['proto']??"tcp";
$args[] = '-p';
$args[] = $portNumber.":".$target;
$mappedPorts[$port['info']] = $portNumber;
$args[] = $portNumber.":".$target."/".$proto;
$mappedPorts[$port['info']] = $portNumber."/".$proto;
}
// Get the paths to persist