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
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":true|:rw"|g' /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 '/stop_grace_period:/s/$/s/' 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)"
mapfile -t TCP <<< "$TCP"

View file

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

View file

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

View file

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