mirror of https://github.com/OpenVidu/openvidu.git
deployment: Add timeout to testRecording.sh to always remove the container in case of error. Add testRecording to CE
parent
fb7ba4b701
commit
bd1ad2f948
|
@ -100,6 +100,30 @@ Resources:
|
||||||
mode: "000755"
|
mode: "000755"
|
||||||
owner: "root"
|
owner: "root"
|
||||||
group: "root"
|
group: "root"
|
||||||
|
"/usr/local/bin/testRecording.sh":
|
||||||
|
content: |
|
||||||
|
#!/bin/bash -x
|
||||||
|
TEST_RECORDING_DIR="/opt/openvidu/test-recording"
|
||||||
|
|
||||||
|
docker run -d --rm --name=test-recording -e URL=https://openvidu.io/ -v "${TEST_RECORDING_DIR}":/recordings openvidu/openvidu-recording:2.19.0
|
||||||
|
|
||||||
|
# Wait to file to be created
|
||||||
|
TIMEOUT_WAIT_FILE=30
|
||||||
|
ELAPSED=0
|
||||||
|
while [[ ! -f "${TEST_RECORDING_DIR}/video/video.mp4" ]] && [[ "${ELAPSED}" -lt "${TIMEOUT_WAIT_FILE}" ]]; do
|
||||||
|
sleep 1;
|
||||||
|
ELAPSED=$((ELAPSED+1))
|
||||||
|
done
|
||||||
|
|
||||||
|
# Sleep 30 seconds
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
# Clean test recording
|
||||||
|
docker rm -f test-recording
|
||||||
|
rm -rf "${TEST_RECORDING_DIR}"
|
||||||
|
mode: "000755"
|
||||||
|
owner: "root"
|
||||||
|
group: "root"
|
||||||
Properties:
|
Properties:
|
||||||
ImageId: !FindInMap [AMIMAP, !Ref 'AWS::Region', AMI]
|
ImageId: !FindInMap [AMIMAP, !Ref 'AWS::Region', AMI]
|
||||||
InstanceType: "t2.2xlarge"
|
InstanceType: "t2.2xlarge"
|
||||||
|
@ -125,6 +149,8 @@ Resources:
|
||||||
|
|
||||||
/usr/local/bin/getDockerImages.sh || { echo "[OpenVidu] error getting docker images"; exit 1; }
|
/usr/local/bin/getDockerImages.sh || { echo "[OpenVidu] error getting docker images"; exit 1; }
|
||||||
|
|
||||||
|
echo "@reboot /usr/local/bin/testRecording.sh >> /var/log/testRecording.log 2>&1" | crontab
|
||||||
|
|
||||||
# sending the finish call
|
# sending the finish call
|
||||||
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource WaitCondition --region ${AWS::Region}
|
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource WaitCondition --region ${AWS::Region}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,12 @@ Resources:
|
||||||
docker run -d --rm --name=test-recording -e URL=https://openvidu.io/ -v "${TEST_RECORDING_DIR}":/recordings openvidu/openvidu-recording:2.19.0
|
docker run -d --rm --name=test-recording -e URL=https://openvidu.io/ -v "${TEST_RECORDING_DIR}":/recordings openvidu/openvidu-recording:2.19.0
|
||||||
|
|
||||||
# Wait to file to be created
|
# Wait to file to be created
|
||||||
while [ ! -f "${TEST_RECORDING_DIR}/video/video.mp4" ]; do sleep 1; done
|
TIMEOUT_WAIT_FILE=30
|
||||||
|
ELAPSED=0
|
||||||
|
while [[ ! -f "${TEST_RECORDING_DIR}/video/video.mp4" ]] && [[ "${ELAPSED}" -lt "${TIMEOUT_WAIT_FILE}" ]]; do
|
||||||
|
sleep 1;
|
||||||
|
ELAPSED=$((ELAPSED+1))
|
||||||
|
done
|
||||||
|
|
||||||
# Sleep 30 seconds
|
# Sleep 30 seconds
|
||||||
sleep 30
|
sleep 30
|
||||||
|
|
Loading…
Reference in New Issue