deployment: Cache openvidu/openvidu-recording docker image in EC2 from AMI on start to fix first recording failed issue."

pull/651/head
cruizba 2021-09-08 13:01:17 +02:00
parent 5b79f9a0a1
commit fb7ba4b701
1 changed files with 21 additions and 0 deletions

View File

@ -90,6 +90,25 @@ 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
while [ ! -f "${TEST_RECORDING_DIR}/video/video.mp4" ]; do sleep 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"
"/usr/local/bin/runMediaNode.sh": "/usr/local/bin/runMediaNode.sh":
content: | content: |
#!/bin/bash #!/bin/bash
@ -126,6 +145,8 @@ Resources:
/usr/local/bin/runMediaNode.sh || { echo "[OpenVidu] error running Media Node"; exit 1; } /usr/local/bin/runMediaNode.sh || { echo "[OpenVidu] error running Media Node"; 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}