Skip to content

Commit

Permalink
Merge pull request #1595 from nextcloud/enh/noid/improve-container-de…
Browse files Browse the repository at this point in the history
…finition

rename values of containers definition to match docker-compose values
  • Loading branch information
szaimen authored Dec 29, 2022
2 parents d0ab269 + 117c3de commit 2983904
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 208 deletions.
19 changes: 6 additions & 13 deletions manual-install/update-yaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,21 @@ sed -i 's|","location":"|:|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)"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[].internalPorts)')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[].secrets)')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[] | select(.identifier == "nextcloud-aio-watchtower"))')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[] | select(.identifier == "nextcloud-aio-domaincheck"))')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.production[] | select(.identifier == "nextcloud-aio-borgbackup"))')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[].internal_port)')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[].secrets)')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-watchtower"))')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-domaincheck"))')"
OUTPUT="$(echo "$OUTPUT" | jq 'del(.services[] | select(.container_name == "nextcloud-aio-borgbackup"))')"

snap install yq
mkdir -p ./manual-install
echo "$OUTPUT" | yq -P > ./manual-install/containers.yml

cd manual-install || exit
sed -i "s|'||g" containers.yml
sed -i 's|production:|services:|' containers.yml
sed -i 's|- identifier:| container_name:|' containers.yml
sed -i 's|restartPolicy:|restart:|' containers.yml
sed -i 's|environmentVariables:|environment:|' containers.yml
sed -i '/displayName:/d' containers.yml
sed -i 's|maxShutdownTime:|stop_grace_period:|' containers.yml
sed -i '/display_name:/d' containers.yml
sed -i '/stop_grace_period:/s/$/s/' containers.yml
sed -i 's|containerName:|image:|' containers.yml
sed -i '/: \[\]/d' containers.yml
sed -i 's|dependsOn:|depends_on:|' containers.yml
sed -i 's|- name: |- |' containers.yml

TCP="$(grep -oP '[%A-Z0-9_]+/tcp' containers.yml | sort -u)"
Expand Down
28 changes: 14 additions & 14 deletions php/containers-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,38 @@
"additionalProperties": false,
"minProperties": 1,
"properties": {
"production": {
"services": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"minProperties": 11,
"properties": {
"containerName": {
"image": {
"type": "string"
},
"dependsOn": {
"depends_on": {
"type": "array",
"items": {
"type": "string"
}
},
"displayName": {
"display_name": {
"type": "string"
},
"environmentVariables": {
"environment": {
"type": "array",
"items": {
"type": "string"
}
},
"identifier": {
"container_name": {
"type": "string"
},
"internalPorts": {
"type": "array",
"items": {
"type": "string"
}
"internal_port": {
"type": "string"
},
"maxShutdownTime": {
"stop_grace_period": {
"type": "integer"
},
"ports": {
Expand All @@ -47,11 +44,14 @@
"type": "string"
}
},
"restartPolicy": {
"restart": {
"type": "string"
},
"secrets": {
"type": "array"
"type": "array",
"items": {
"type": "string"
}
},
"volumes": {
"type": "array",
Expand Down
Loading

0 comments on commit 2983904

Please sign in to comment.