OliveTin Standard Error
++ basename /config/channels-dvr.sh
+ extension=channels-dvr.sh
+ extension=channels-dvr
+ cp /config/channels-dvr.env /tmp
+ envFile=/tmp/channels-dvr.env
+ envVars=("TAG=$1" "HOST_PORT=$2" "CHANNELS_PORT=$3" "TZ=$4" "HOST_DIR=$5" "DVR_SHARE=$6" "VOL_EXTERNAL=$7" "VOL_NAME=$8" "NETWORK_MODE=$9" "DEVICES=${10}")
+ printf '%s\n' TAG=tve HOST_PORT=8589 CHANNELS_PORT=8589 TZ=America/Los_Angeles HOST_DIR=/volume1/docker DVR_SHARE=/volume1/ChDVRpoc VOL_EXTERNAL=# VOL_NAME=# NETWORK_MODE=host DEVICES=true
+ sed -i /=#/d /tmp/channels-dvr.env
+ /config/portainerstack.sh channels-dvr
+ stackName=channels-dvr
+ portainerHost=192.168.1.4
+ curl -s -o /dev/null http://192.168.1.4:9000
+ portainerURL='http://192.168.1.4:9000/api/stacks?type=2&method=string&endpointId=2'
+ portainerToken=REDACTED
+ cp /config/channels-dvr.yaml /tmp
+ stackFile=/tmp/channels-dvr.yaml
+ envFile=/tmp/channels-dvr.env
++ grep DVR_SHARE= /tmp/channels-dvr.env
++ grep -v /
++ awk -F= '{print $2}'
+ dockerVolume=
++ grep VOL_EXTERNAL= /tmp/channels-dvr.env
++ grep -v '#'
++ awk -F= '{print $2}'
+ volumeExternal=
++ grep VOL_NAME= /tmp/channels-dvr.env
++ grep -v '#'
++ awk -F= '{print $2}'
+ volumeName=
+ [[ -n '' ]]
++ sed 's/\\/\\\\/g' /tmp/channels-dvr.yaml
++ sed 's/"/\\"/g'
++ awk '{printf "%s\\n", $0}'
+ stackContent='version: '\''3.9'\''\nservices:\n # 2024.09.13\n # Docker Hub home for this project: https://hub.docker.com/r/fancybits/channels-dvr\n channels-dvr:\n image: fancybits/channels-dvr:${TAG}\n container_name: channels-dvr\n #devices:\n #- /dev/dri:/dev/dri\n ports:\n - ${HOST_PORT}:${CHANNELS_PORT}\n environment:\n - CHANNELS_PORT=${CHANNELS_PORT}\n - TZ=${TZ}\n volumes:\n - ${HOST_DIR}/channels-dvr:/channels-dvr\n - ${DVR_SHARE}:/shares/DVR\n #network_mode: host\n restart: unless-stopped\n#volumes: # use this section if you'\''ve setup a docker volume named channels-dvr, with CIFS or NFS, to bind to /channels-dvr inside the container\n #channels-dvr:\n #external: ${VOL_EXTERNAL}\n #name: ${VOL_NAME}\n'
+ stackEnvVars='['
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},{"name": "HOST_DIR", "value": "/volume1/docker"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},{"name": "HOST_DIR", "value": "/volume1/docker"},{"name": "DVR_SHARE", "value": "/volume1/ChDVRpoc"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},{"name": "HOST_DIR", "value": "/volume1/docker"},{"name": "DVR_SHARE", "value": "/volume1/ChDVRpoc"},{"name": "NETWORK_MODE", "value": "host"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},{"name": "HOST_DIR", "value": "/volume1/docker"},{"name": "DVR_SHARE", "value": "/volume1/ChDVRpoc"},{"name": "NETWORK_MODE", "value": "host"},{"name": "DEVICES", "value": "true"},'
+ IFS==
+ read -r key value
+ stackEnvVars='[{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},{"name": "HOST_DIR", "value": "/volume1/docker"},{"name": "DVR_SHARE", "value": "/volume1/ChDVRpoc"},{"name": "NETWORK_MODE", "value": "host"},{"name": "DEVICES", "value": "true"}]'
++ cat
+ stackJSON='{
"Name": "channels-dvr",
"SwarmID": "",
"StackFileContent": "version: '\''3.9'\''\nservices:\n # 2024.09.13\n # Docker Hub home for this project: https://hub.docker.com/r/fancybits/channels-dvr\n channels-dvr:\n image: fancybits/channels-dvr:${TAG}\n container_name: channels-dvr\n #devices:\n #- /dev/dri:/dev/dri\n ports:\n - ${HOST_PORT}:${CHANNELS_PORT}\n environment:\n - CHANNELS_PORT=${CHANNELS_PORT}\n - TZ=${TZ}\n volumes:\n - ${HOST_DIR}/channels-dvr:/channels-dvr\n - ${DVR_SHARE}:/shares/DVR\n #network_mode: host\n restart: unless-stopped\n#volumes: # use this section if you'\''ve setup a docker volume named channels-dvr, with CIFS or NFS, to bind to /channels-dvr inside the container\n #channels-dvr:\n #external: ${VOL_EXTERNAL}\n #name: ${VOL_NAME}\n",
"Env": [{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},{"name": "HOST_DIR", "value": "/volume1/docker"},{"name": "DVR_SHARE", "value": "/volume1/ChDVRpoc"},{"name": "NETWORK_MODE", "value": "host"},{"name": "DEVICES", "value": "true"}]
}'
+ echo 'JSON response from http://192.168.1.4:9000/api/stacks?type=2&method=string&endpointId=2:'
++ curl -k -X POST -H 'Content-Type: application/json' -H 'X-API-Key: REDACTED' -d '{
"Name": "channels-dvr",
"SwarmID": "",
"StackFileContent": "version: '\''3.9'\''\nservices:\n # 2024.09.13\n # Docker Hub home for this project: https://hub.docker.com/r/fancybits/channels-dvr\n channels-dvr:\n image: fancybits/channels-dvr:${TAG}\n container_name: channels-dvr\n #devices:\n #- /dev/dri:/dev/dri\n ports:\n - ${HOST_PORT}:${CHANNELS_PORT}\n environment:\n - CHANNELS_PORT=${CHANNELS_PORT}\n - TZ=${TZ}\n volumes:\n - ${HOST_DIR}/channels-dvr:/channels-dvr\n - ${DVR_SHARE}:/shares/DVR\n #network_mode: host\n restart: unless-stopped\n#volumes: # use this section if you'\''ve setup a docker volume named channels-dvr, with CIFS or NFS, to bind to /channels-dvr inside the container\n #channels-dvr:\n #external: ${VOL_EXTERNAL}\n #name: ${VOL_NAME}\n",
"Env": [{"name": "TAG", "value": "tve"},{"name": "HOST_PORT", "value": "8589"},{"name": "CHANNELS_PORT", "value": "8589"},{"name": "TZ", "value": "America/Los_Angeles"},{"name": "HOST_DIR", "value": "/volume1/docker"},{"name": "DVR_SHARE", "value": "/volume1/ChDVRpoc"},{"name": "NETWORK_MODE", "value": "host"},{"name": "DEVICES", "value": "true"}]
}' 'http://192.168.1.4:9000/api/stacks?type=2&method=string&endpointId=2'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 1187 0 0 100 1187 0 985 0:00:01 0:00:01 --:--:-- 985
100 2049 100 862 100 1187 410 565 0:00:02 0:00:02 --:--:-- 977
100 2049 100 862 100 1187 410 565 0:00:02 0:00:02 --:--:-- 977
+ portainerResponse='{"Id":3,"Name":"channels-dvr","Type":2,"EndpointId":2,"SwarmId":"","EntryPoint":"docker-compose.yml","Env":[{"name":"TAG","value":"tve"},{"name":"HOST_PORT","value":"8589"},{"name":"CHANNELS_PORT","value":"8589"},{"name":"TZ","value":"America/Los_Angeles"},{"name":"HOST_DIR","value":"/volume1/docker"},{"name":"DVR_SHARE","value":"/volume1/ChDVRpoc"},{"name":"NETWORK_MODE","value":"host"},{"name":"DEVICES","value":"true"}],"ResourceControl":{"Id":3,"ResourceId":"2_channels-dvr","SubResourceIds":[],"Type":6,"UserAccesses":[],"TeamAccesses":[],"Public":false,"AdministratorsOnly":true,"System":false},"Status":1,"ProjectPath":"/data/compose/3","CreationDate":1726344287,"CreatedBy":"my_portainer_username","UpdateDate":0,"UpdatedBy":"","AdditionalFiles":null,"AutoUpdate":null,"Option":null,"GitConfig":null,"FromAppTemplate":false,"Namespace":"","IsComposeFormat":false}'
+ [[ -z {"Id":3,"Name":"channels-dvr","Type":2,"EndpointId":2,"SwarmId":"","EntryPoint":"docker-compose.yml","Env":[{"name":"TAG","value":"tve"},{"name":"HOST_PORT","value":"8589"},{"name":"CHANNELS_PORT","value":"8589"},{"name":"TZ","value":"America/Los_Angeles"},{"name":"HOST_DIR","value":"/volume1/docker"},{"name":"DVR_SHARE","value":"/volume1/ChDVRpoc"},{"name":"NETWORK_MODE","value":"host"},{"name":"DEVICES","value":"true"}],"ResourceControl":{"Id":3,"ResourceId":"2_channels-dvr","SubResourceIds":[],"Type":6,"UserAccesses":[],"TeamAccesses":[],"Public":false,"AdministratorsOnly":true,"System":false},"Status":1,"ProjectPath":"/data/compose/3","CreationDate":1726344287,"CreatedBy":"my_portainer_username","UpdateDate":0,"UpdatedBy":"","AdditionalFiles":null,"AutoUpdate":null,"Option":null,"GitConfig":null,"FromAppTemplate":false,"Namespace":"","IsComposeFormat":false} ]]
+ echo '{"Id":3,"Name":"channels-dvr","Type":2,"EndpointId":2,"SwarmId":"","EntryPoint":"docker-compose.yml","Env":[{"name":"TAG","value":"tve"},{"name":"HOST_PORT","value":"8589"},{"name":"CHANNELS_PORT","value":"8589"},{"name":"TZ","value":"America/Los_Angeles"},{"name":"HOST_DIR","value":"/volume1/docker"},{"name":"DVR_SHARE","value":"/volume1/ChDVRpoc"},{"name":"NETWORK_MODE","value":"host"},{"name":"DEVICES","value":"true"}],"ResourceControl":{"Id":3,"ResourceId":"2_channels-dvr","SubResourceIds":[],"Type":6,"UserAccesses":[],"TeamAccesses":[],"Public":false,"AdministratorsOnly":true,"System":false},"Status":1,"ProjectPath":"/data/compose/3","CreationDate":1726344287,"CreatedBy":"my_portainer_username","UpdateDate":0,"UpdatedBy":"","AdditionalFiles":null,"AutoUpdate":null,"Option":null,"GitConfig":null,"FromAppTemplate":false,"Namespace":"","IsComposeFormat":false}'
+ echo '{"Id":3,"Name":"channels-dvr","Type":2,"EndpointId":2,"SwarmId":"","EntryPoint":"docker-compose.yml","Env":[{"name":"TAG","value":"tve"},{"name":"HOST_PORT","value":"8589"},{"name":"CHANNELS_PORT","value":"8589"},{"name":"TZ","value":"America/Los_Angeles"},{"name":"HOST_DIR","value":"/volume1/docker"},{"name":"DVR_SHARE","value":"/volume1/ChDVRpoc"},{"name":"NETWORK_MODE","value":"host"},{"name":"DEVICES","value":"true"}],"ResourceControl":{"Id":3,"ResourceId":"2_channels-dvr","SubResourceIds":[],"Type":6,"UserAccesses":[],"TeamAccesses":[],"Public":false,"AdministratorsOnly":true,"System":false},"Status":1,"ProjectPath":"/data/compose/3","CreationDate":1726344287,"CreatedBy":"my_portainer_username","UpdateDate":0,"UpdatedBy":"","AdditionalFiles":null,"AutoUpdate":null,"Option":null,"GitConfig":null,"FromAppTemplate":false,"Namespace":"","IsComposeFormat":false}'
+ jq -e '.Id != null'
+ exit 0
+ [[ 0 == 1 ]]
+ exit 0