rename volume name to source and volume location to destination

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2022-12-30 22:56:37 +01:00
parent e535abccc7
commit 6dd9412fb6
4 changed files with 72 additions and 72 deletions

View file

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
jq -c . ./php/containers.json > /tmp/containers.json jq -c . ./php/containers.json > /tmp/containers.json
sed -i 's|","location":"|:|g' /tmp/containers.json sed -i 's|","destination":"|:|g' /tmp/containers.json
sed -i 's|","writeable":false|:ro"|g' /tmp/containers.json sed -i 's|","writeable":false|:ro"|g' /tmp/containers.json
sed -i 's|","writeable":true|:rw"|g' /tmp/containers.json sed -i 's|","writeable":true|:rw"|g' /tmp/containers.json
OUTPUT="$(cat /tmp/containers.json)" OUTPUT="$(cat /tmp/containers.json)"
@ -20,7 +20,7 @@ sed -i "s|'||g" containers.yml
sed -i '/display_name:/d' containers.yml sed -i '/display_name:/d' containers.yml
sed -i '/stop_grace_period:/s/$/s/' containers.yml sed -i '/stop_grace_period:/s/$/s/' containers.yml
sed -i '/: \[\]/d' containers.yml sed -i '/: \[\]/d' containers.yml
sed -i 's|- name: |- |' containers.yml sed -i 's|- source: |- |' containers.yml
TCP="$(grep -oP '[%A-Z0-9_]+/tcp' containers.yml | sort -u)" TCP="$(grep -oP '[%A-Z0-9_]+/tcp' containers.yml | sort -u)"
mapfile -t TCP <<< "$TCP" mapfile -t TCP <<< "$TCP"

View file

@ -60,10 +60,10 @@
"additionalProperties": false, "additionalProperties": false,
"minProperties": 3, "minProperties": 3,
"properties": { "properties": {
"location": { "destination": {
"type": "string" "type": "string"
}, },
"name": { "source": {
"type": "string" "type": "string"
}, },
"writeable": { "writeable": {

View file

@ -28,13 +28,13 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_nextcloud", "source": "nextcloud_aio_nextcloud",
"location": "/var/www/html", "destination": "/var/www/html",
"writeable": false "writeable": false
}, },
{ {
"name": "nextcloud_aio_apache", "source": "nextcloud_aio_apache",
"location": "/mnt/data", "destination": "/mnt/data",
"writeable": true "writeable": true
} }
], ],
@ -53,13 +53,13 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_database", "source": "nextcloud_aio_database",
"location": "/var/lib/postgresql/data", "destination": "/var/lib/postgresql/data",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_database_dump", "source": "nextcloud_aio_database_dump",
"location": "/mnt/data", "destination": "/mnt/data",
"writeable": true "writeable": true
} }
], ],
@ -95,23 +95,23 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_nextcloud", "source": "nextcloud_aio_nextcloud",
"location": "/var/www/html", "destination": "/var/www/html",
"writeable": true "writeable": true
}, },
{ {
"name": "%NEXTCLOUD_DATADIR%", "source": "%NEXTCLOUD_DATADIR%",
"location": "/mnt/ncdata", "destination": "/mnt/ncdata",
"writeable": true "writeable": true
}, },
{ {
"name": "%NEXTCLOUD_MOUNT%", "source": "%NEXTCLOUD_MOUNT%",
"location": "%NEXTCLOUD_MOUNT%", "destination": "%NEXTCLOUD_MOUNT%",
"writeable": true "writeable": true
}, },
{ {
"name": "%NEXTCLOUD_TRUSTED_CACERTS_DIR%", "source": "%NEXTCLOUD_TRUSTED_CACERTS_DIR%",
"location": "/usr/local/share/ca-certificates", "destination": "/usr/local/share/ca-certificates",
"writeable": false "writeable": false
} }
], ],
@ -172,8 +172,8 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_redis", "source": "nextcloud_aio_redis",
"location": "/data", "destination": "/data",
"writeable": true "writeable": true
} }
], ],
@ -199,8 +199,8 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_collabora_fonts", "source": "nextcloud_aio_collabora_fonts",
"location": "/opt/cool/systemplate/tmpfonts", "destination": "/opt/cool/systemplate/tmpfonts",
"writeable": true "writeable": true
} }
], ],
@ -252,53 +252,53 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_backup_cache", "source": "nextcloud_aio_backup_cache",
"location": "/root", "destination": "/root",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_nextcloud", "source": "nextcloud_aio_nextcloud",
"location": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud", "destination": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud",
"writeable": true "writeable": true
}, },
{ {
"name": "%NEXTCLOUD_DATADIR%", "source": "%NEXTCLOUD_DATADIR%",
"location": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data", "destination": "/nextcloud_aio_volumes/nextcloud_aio_nextcloud_data",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_database", "source": "nextcloud_aio_database",
"location": "/nextcloud_aio_volumes/nextcloud_aio_database", "destination": "/nextcloud_aio_volumes/nextcloud_aio_database",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_database_dump", "source": "nextcloud_aio_database_dump",
"location": "/nextcloud_aio_volumes/nextcloud_aio_database_dump", "destination": "/nextcloud_aio_volumes/nextcloud_aio_database_dump",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_apache", "source": "nextcloud_aio_apache",
"location": "/nextcloud_aio_volumes/nextcloud_aio_apache", "destination": "/nextcloud_aio_volumes/nextcloud_aio_apache",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_mastercontainer", "source": "nextcloud_aio_mastercontainer",
"location": "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer", "destination": "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer",
"writeable": true "writeable": true
}, },
{ {
"name": "%BORGBACKUP_HOST_LOCATION%", "source": "%BORGBACKUP_HOST_LOCATION%",
"location": "/mnt/borgbackup", "destination": "/mnt/borgbackup",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_elasticsearch", "source": "nextcloud_aio_elasticsearch",
"location": "/nextcloud_aio_volumes/nextcloud_aio_elasticsearch", "destination": "/nextcloud_aio_volumes/nextcloud_aio_elasticsearch",
"writeable": true "writeable": true
}, },
{ {
"name": "nextcloud_aio_redis", "source": "nextcloud_aio_redis",
"location": "/mnt/redis", "destination": "/mnt/redis",
"writeable": true "writeable": true
} }
], ],
@ -320,8 +320,8 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "%DOCKER_SOCKET_PATH%", "source": "%DOCKER_SOCKET_PATH%",
"location": "/var/run/docker.sock", "destination": "/var/run/docker.sock",
"writeable": false "writeable": false
} }
], ],
@ -362,8 +362,8 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_clamav", "source": "nextcloud_aio_clamav",
"location": "/var/lib/clamav", "destination": "/var/lib/clamav",
"writeable": true "writeable": true
} }
], ],
@ -386,8 +386,8 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_onlyoffice", "source": "nextcloud_aio_onlyoffice",
"location": "/var/lib/onlyoffice", "destination": "/var/lib/onlyoffice",
"writeable": true "writeable": true
} }
], ],
@ -426,8 +426,8 @@
], ],
"volumes": [ "volumes": [
{ {
"name": "nextcloud_aio_elasticsearch", "source": "nextcloud_aio_elasticsearch",
"location": "/usr/share/elasticsearch/data", "destination": "/usr/share/elasticsearch/data",
"writeable": true "writeable": true
} }
], ],

View file

@ -94,43 +94,43 @@ class ContainerDefinitionFetcher
$volumes = new ContainerVolumes(); $volumes = new ContainerVolumes();
foreach ($entry['volumes'] as $value) { foreach ($entry['volumes'] as $value) {
if($value['name'] === '%BORGBACKUP_HOST_LOCATION%') { if($value['source'] === '%BORGBACKUP_HOST_LOCATION%') {
$value['name'] = $this->configurationManager->GetBorgBackupHostLocation(); $value['source'] = $this->configurationManager->GetBorgBackupHostLocation();
if($value['name'] === '') { if($value['source'] === '') {
continue; continue;
} }
} }
if($value['name'] === '%NEXTCLOUD_MOUNT%') { if($value['source'] === '%NEXTCLOUD_MOUNT%') {
$value['name'] = $this->configurationManager->GetNextcloudMount(); $value['source'] = $this->configurationManager->GetNextcloudMount();
if($value['name'] === '') { if($value['source'] === '') {
continue; continue;
} }
} elseif ($value['name'] === '%NEXTCLOUD_DATADIR%') { } elseif ($value['source'] === '%NEXTCLOUD_DATADIR%') {
$value['name'] = $this->configurationManager->GetNextcloudDatadirMount(); $value['source'] = $this->configurationManager->GetNextcloudDatadirMount();
if ($value['name'] === '') { if ($value['source'] === '') {
continue; continue;
} }
} elseif ($value['name'] === '%DOCKER_SOCKET_PATH%') { } elseif ($value['source'] === '%DOCKER_SOCKET_PATH%') {
$value['name'] = $this->configurationManager->GetDockerSocketPath(); $value['source'] = $this->configurationManager->GetDockerSocketPath();
if($value['name'] === '') { if($value['source'] === '') {
continue; continue;
} }
} elseif ($value['name'] === '%NEXTCLOUD_TRUSTED_CACERTS_DIR%') { } elseif ($value['source'] === '%NEXTCLOUD_TRUSTED_CACERTS_DIR%') {
$value['name'] = $this->configurationManager->GetTrustedCacertsDir(); $value['source'] = $this->configurationManager->GetTrustedCacertsDir();
if($value['name'] === '') { if($value['source'] === '') {
continue; continue;
} }
} }
if ($value['location'] === '%NEXTCLOUD_MOUNT%') { if ($value['destination'] === '%NEXTCLOUD_MOUNT%') {
$value['location'] = $this->configurationManager->GetNextcloudMount(); $value['destination'] = $this->configurationManager->GetNextcloudMount();
if($value['location'] === '') { if($value['destination'] === '') {
continue; continue;
} }
} }
$volumes->AddVolume( $volumes->AddVolume(
new ContainerVolume( new ContainerVolume(
$value['name'], $value['source'],
$value['location'], $value['destination'],
$value['writeable'] $value['writeable']
) )
); );