mirror of https://github.com/OpenVidu/openvidu.git
Deployment repos migration:
- Move deployment stuff of openvidu-ce from https://github.com/OpenVidu/openvidu-cloud-devops - Move deployment stuff of openvidu-pro from https://github.com/OpenVidu/openvidu-pro-clustering - Remove readmes to avoid confusions of official documentation - Update installation scripts to use this repo - Better folder structure: - docker-compose -> Include docker-compose files for deployments - docker -> Include docker images - aws -> Cloudformation related stuff for aws.pull/540/head
parent
4bde653c65
commit
f3c5bfe321
|
@ -0,0 +1,413 @@
|
|||
AWSTemplateFormatVersion: 2010-09-09
|
||||
Description: OpenVidu Platform
|
||||
|
||||
Parameters:
|
||||
|
||||
# Domain and SSL certificate configuration
|
||||
|
||||
WhichCert:
|
||||
Description: >
|
||||
[selfsigned] Self signed certificate. Not recommended for production use.
|
||||
[owncert] Valid certificate purchased in a Internet services company.
|
||||
[letsencrypt] Generate a new certificate using Let's Encrypt.
|
||||
Type: String
|
||||
AllowedValues:
|
||||
- selfsigned
|
||||
- owncert
|
||||
- letsencrypt
|
||||
Default: selfsigned
|
||||
|
||||
PublicElasticIP:
|
||||
Description: "Previously created AWS Elastic IP to associate it to the OpenVidu EC2 instance. If certificate type is 'selfsigned' this value is optional. If certificate type is 'owncert' or 'letsencrypt' this value is mandatory. Example 13.33.145.23."
|
||||
Type: String
|
||||
AllowedPattern: ^$|^([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])$
|
||||
ConstraintDescription: The public Elastic IP does not have a valid IPv4 format
|
||||
|
||||
MyDomainName:
|
||||
Description: "Valid domain name pointing to previous IP. If certificate type is 'selfsigned' this value is optional. If certificate type is 'owncert' or 'letsencrypt' this value is mandatory. Example: openvidu.company.com"
|
||||
Type: String
|
||||
AllowedPattern: ^$|^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
|
||||
ConstraintDescription: The domain name does not have a valid domain name format
|
||||
|
||||
OwnCertCRT:
|
||||
Description: "If certificate type is 'owncert' this is the URL where CRT file will be downloaded"
|
||||
Type: String
|
||||
|
||||
OwnCertKEY:
|
||||
Description: "If certificate type is 'owncert' this is the URL where KEY file will be downloaded"
|
||||
Type: String
|
||||
|
||||
LetsEncryptEmail:
|
||||
Description: "If certificate type is 'letsencrypt', this email will be used for Let's Encrypt notifications"
|
||||
Type: String
|
||||
|
||||
# OpenVidu configuration
|
||||
|
||||
OpenViduSecret:
|
||||
Description: "Secret to connect to this OpenVidu Platform. No whitespaces or quotations allowed"
|
||||
Type: String
|
||||
AllowedPattern: ^((?!")(?! ).)+$
|
||||
NoEcho: true
|
||||
ConstraintDescription: OpenVidu Secret is mandatory
|
||||
|
||||
# EC2 Instance configuration
|
||||
|
||||
InstanceType:
|
||||
Description: "Specifies the EC2 instance type for your OpenVidu instance"
|
||||
Type: String
|
||||
Default: t2.xlarge
|
||||
AllowedValues:
|
||||
- t2.large
|
||||
- t2.xlarge
|
||||
- t2.2xlarge
|
||||
- t3.large
|
||||
- t3.xlarge
|
||||
- t3.2xlarge
|
||||
- m4.large
|
||||
- m4.xlarge
|
||||
- m4.2xlarge
|
||||
- m4.4xlarge
|
||||
- m4.10xlarge
|
||||
- m4.16xlarge
|
||||
- m5.large
|
||||
- m5.xlarge
|
||||
- m5.2xlarge
|
||||
- m5.4xlarge
|
||||
- m5.8xlarge
|
||||
- m5.12xlarge
|
||||
- m5.16xlarge
|
||||
- m5.24xlarge
|
||||
- c4.large
|
||||
- c4.xlarge
|
||||
- c4.2xlarge
|
||||
- c4.4xlarge
|
||||
- c4.8xlarge
|
||||
- c5.large
|
||||
- c5.xlarge
|
||||
- c5.2xlarge
|
||||
- c5.4xlarge
|
||||
- c5.9xlarge
|
||||
- c5.12xlarge
|
||||
- c5.18xlarge
|
||||
- c5.24xlarge
|
||||
ConstraintDescription: "Must be a valid EC2 instance type"
|
||||
|
||||
KeyName:
|
||||
Description: "Name of an existing EC2 KeyPair to enable SSH access to the instance. It is mandatory to perform some administrative tasks of OpenVidu."
|
||||
Type: 'AWS::EC2::KeyPair::KeyName'
|
||||
ConstraintDescription: "must be the name of an existing EC2 KeyPair"
|
||||
|
||||
# Other configuration
|
||||
|
||||
WantToDeployDemos:
|
||||
Description: "Choose if you want to deploy OpenVidu Call application alongside OpenVidu platform."
|
||||
Type: String
|
||||
AllowedValues:
|
||||
- true
|
||||
- false
|
||||
Default: true
|
||||
|
||||
WantToSendInfo:
|
||||
Description: "Choose if you want to send to OpenVidu team the version deployed and AWS region."
|
||||
Type: String
|
||||
AllowedValues:
|
||||
- true
|
||||
- false
|
||||
Default: true
|
||||
|
||||
Mappings:
|
||||
OVAMIMAP:
|
||||
eu-west-1:
|
||||
AMI: OV_AMI_ID
|
||||
|
||||
Metadata:
|
||||
'AWS::CloudFormation::Interface':
|
||||
ParameterGroups:
|
||||
- Label:
|
||||
default: Domain and SSL certificate configuration
|
||||
Parameters:
|
||||
- WhichCert
|
||||
- PublicElasticIP
|
||||
- MyDomainName
|
||||
- OwnCertCRT
|
||||
- OwnCertKEY
|
||||
- LetsEncryptEmail
|
||||
- Label:
|
||||
default: OpenVidu configuration
|
||||
Parameters:
|
||||
- OpenViduSecret
|
||||
- Label:
|
||||
default: EC2 Instance configuration
|
||||
Parameters:
|
||||
- InstanceType
|
||||
- KeyName
|
||||
- Label:
|
||||
default: Other configuration
|
||||
Parameters:
|
||||
- WantToDeployDemos
|
||||
- WantToSendInfo
|
||||
|
||||
ParameterLabels:
|
||||
# SSL certificate configuration
|
||||
WhichCert:
|
||||
default: "Certificate Type"
|
||||
PublicElasticIP:
|
||||
default: "AWS Elastic IP (EIP)"
|
||||
MyDomainName:
|
||||
default: "Domain Name pointing to Elastic IP"
|
||||
OwnCertCRT:
|
||||
default: "URL to the CRT file (owncert)"
|
||||
OwnCertKEY:
|
||||
default: "URL to the key file (owncert)"
|
||||
LetsEncryptEmail:
|
||||
default: "Email for Let's Encrypt (letsencrypt)"
|
||||
# OpenVidu configuration
|
||||
OpenViduSecret:
|
||||
default: "Openvidu Secret"
|
||||
# EC2 Instance configuration
|
||||
InstanceType:
|
||||
default: "Instance type"
|
||||
KeyName:
|
||||
default: "SSH Key"
|
||||
# Other configuration
|
||||
WantToDeployDemos:
|
||||
default: "Deploy OpenVidu Call application"
|
||||
WantToSendInfo:
|
||||
default: "Send deployment info to OpenVidu team"
|
||||
|
||||
Conditions:
|
||||
WhichCertPresent: !Not [ !Equals [!Ref WhichCert, ""] ]
|
||||
PublicElasticIPPresent: !Not [ !Equals [!Ref PublicElasticIP, ""] ]
|
||||
|
||||
Resources:
|
||||
|
||||
OpenviduServer:
|
||||
Type: 'AWS::EC2::Instance'
|
||||
Metadata:
|
||||
Comment: 'Install and configure OpenVidu Server and Demos'
|
||||
AWS::CloudFormation::Init:
|
||||
config:
|
||||
files:
|
||||
'/usr/local/bin/ping.sh':
|
||||
content: |
|
||||
#!/bin/bash
|
||||
|
||||
INXDB_URL=193.147.51.51
|
||||
INXDB_DB=ov_server
|
||||
INXDB_MEASUREMENT=server
|
||||
|
||||
OV_VERSION=OPENVIDU_VERSION
|
||||
EC2_AVAIL_ZONE=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
|
||||
EC2_REGION=$(echo "$EC2_AVAIL_ZONE" | sed 's/[a-z]$//')
|
||||
|
||||
curl -i -XPOST "http://$INXDB_URL:8086/write?db=$INXDB_DB" \
|
||||
--data-binary "$INXDB_MEASUREMENT,region=$EC2_REGION ov_version=\"$OV_VERSION\" "
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/check_app_ready.sh':
|
||||
content: |
|
||||
#!/bin/bash
|
||||
while true; do
|
||||
HTTP_STATUS=$(curl -Ik http://localhost:5443 | head -n1 | awk '{print $2}')
|
||||
if [ $HTTP_STATUS == 200 ]; then
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/feedGroupVars.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
WORKINGDIR=/opt/openvidu
|
||||
|
||||
# Replace secret
|
||||
sed -i "s/OPENVIDU_SECRET=/OPENVIDU_SECRET=${OpenViduSecret}/" $WORKINGDIR/.env
|
||||
|
||||
# Replace domain name
|
||||
if [[ "${MyDomainName}" != '' && "${PublicElasticIP}" != '' ]]; then
|
||||
sed -i "s/DOMAIN_OR_PUBLIC_IP=/DOMAIN_OR_PUBLIC_IP=${MyDomainName}/" $WORKINGDIR/.env
|
||||
elif [[ "${MyDomainName}" == '' && "${PublicElasticIP}" != '' ]]; then
|
||||
sed -i "s/DOMAIN_OR_PUBLIC_IP=/DOMAIN_OR_PUBLIC_IP=${PublicElasticIP}/" $WORKINGDIR/.env
|
||||
else
|
||||
[ ! -d "/usr/share/openvidu" ] && mkdir -p /usr/share/openvidu
|
||||
PublicHostname=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
|
||||
sed -i "s/DOMAIN_OR_PUBLIC_IP=/DOMAIN_OR_PUBLIC_IP=$PublicHostname/" $WORKINGDIR/.env
|
||||
echo $PublicHostname > /usr/share/openvidu/old-host-name
|
||||
fi
|
||||
|
||||
# Replace certificated type
|
||||
sed -i "s/CERTIFICATE_TYPE=selfsigned/CERTIFICATE_TYPE=${WhichCert}/" $WORKINGDIR/.env
|
||||
sed -i "s/LETSENCRYPT_EMAIL=user@example.com/LETSENCRYPT_EMAIL=${LetsEncryptEmail}/" $WORKINGDIR/.env
|
||||
|
||||
# Without Application
|
||||
if [ "${WantToDeployDemos}" == "false" ]; then
|
||||
sed -i "s/WITH_APP=true/WITH_APP=false/" $WORKINGDIR/docker-compose.yml
|
||||
rm $WORKINGDIR/docker-compose.override.yml
|
||||
fi
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/buildCerts.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
WORKINGDIR=/opt/openvidu
|
||||
wget --no-check-certificate -O $WORKINGDIR/owncert/certificate.cert ${OwnCertCRT}
|
||||
wget --no-check-certificate -O $WORKINGDIR/owncert/certificate.key ${OwnCertKEY}
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/restartCE.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
WORKINGDIR=/opt/openvidu
|
||||
|
||||
# Get new amazon URL
|
||||
OldPublicHostname=$(cat /usr/share/openvidu/old-host-name)
|
||||
PublicHostname=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
|
||||
sed -i "s/$OldPublicHostname/$PublicHostname/" $WORKINGDIR/.env
|
||||
echo $PublicHostname > /usr/share/openvidu/old-host-name
|
||||
|
||||
# Restart all services
|
||||
pushd /opt/openvidu
|
||||
docker-compose up -d
|
||||
popd
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
Properties:
|
||||
ImageId: !FindInMap [OVAMIMAP, !Ref 'AWS::Region', AMI]
|
||||
InstanceType: !Ref InstanceType
|
||||
SecurityGroups:
|
||||
- !Ref WebServerSecurityGroup
|
||||
KeyName: !Ref KeyName
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Ref 'AWS::StackName'
|
||||
UserData:
|
||||
Fn::Base64: !Sub |
|
||||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
|
||||
cfn-init --region ${AWS::Region} --stack ${AWS::StackId} --resource OpenviduServer
|
||||
|
||||
# Replace .env variables
|
||||
/usr/local/bin/feedGroupVars.sh || { echo "[Openvidu] Parameters incorrect/insufficient"; exit 1; }
|
||||
|
||||
# Launch on reboot
|
||||
echo "@reboot /usr/local/bin/restartCE.sh" | crontab
|
||||
|
||||
# Download certs if "WichCert" mode
|
||||
if [ "${WhichCert}" == "owncert" ]; then
|
||||
/usr/local/bin/buildCerts.sh || { echo "[Openvidu] error with the certificate files"; exit 1; }
|
||||
fi
|
||||
|
||||
# Start openvidu application
|
||||
pushd /opt/openvidu
|
||||
docker-compose up -d
|
||||
popd
|
||||
|
||||
# Send info to openvidu
|
||||
if [ "${WantToSendInfo}" == "true" ]; then
|
||||
/usr/local/bin/ping.sh
|
||||
fi
|
||||
rm /usr/local/bin/ping.sh
|
||||
|
||||
# Wait for the app
|
||||
/usr/local/bin/check_app_ready.sh
|
||||
|
||||
# Start up the cfn-hup daemon to listen for changes to the Web Server metadata
|
||||
/usr/local/bin/cfn-hup -v || { echo "[Openvidu] Failed to start cfn-hup"; exit 1; }
|
||||
|
||||
# sending the finish call
|
||||
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource WaitCondition --region ${AWS::Region}
|
||||
|
||||
BlockDeviceMappings:
|
||||
- DeviceName: /dev/sda1
|
||||
Ebs:
|
||||
VolumeType: io1
|
||||
Iops: 200
|
||||
DeleteOnTermination: true
|
||||
VolumeSize: 100
|
||||
|
||||
MyEIP:
|
||||
Type: 'AWS::EC2::EIPAssociation'
|
||||
Condition: PublicElasticIPPresent
|
||||
Properties:
|
||||
InstanceId: !Ref OpenviduServer
|
||||
EIP: !Ref PublicElasticIP
|
||||
|
||||
WaitCondition:
|
||||
Type: 'AWS::CloudFormation::WaitCondition'
|
||||
CreationPolicy:
|
||||
ResourceSignal:
|
||||
Timeout: PT30M
|
||||
Count: '1'
|
||||
|
||||
WebServerSecurityGroup:
|
||||
Type: 'AWS::EC2::SecurityGroup'
|
||||
Properties:
|
||||
GroupDescription: SSH, Proxy and OpenVidu WebRTC Ports
|
||||
SecurityGroupIngress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 22
|
||||
ToPort: 22
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 80
|
||||
ToPort: 80
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 443
|
||||
ToPort: 443
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 3478
|
||||
ToPort: 3478
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: udp
|
||||
FromPort: 3478
|
||||
ToPort: 3478
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: udp
|
||||
FromPort: 40000
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 40000
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
|
||||
Outputs:
|
||||
OpenViduServerURL:
|
||||
Description: Use this URL to connect OpenVidu Server
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !GetAtt
|
||||
- OpenviduServer
|
||||
- PublicDnsName
|
||||
OpenViduServerURLLE:
|
||||
Description: Use this URL to connect OpenVidu Server
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !Ref MyDomainName
|
||||
Condition: WhichCertPresent
|
||||
OpenViduCallURL:
|
||||
Description: If you choose to deploy OpenVidu Call application, use this URL
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !GetAtt
|
||||
- OpenviduServer
|
||||
- PublicDnsName
|
||||
OpenViduCallURLLE:
|
||||
Description: If you choose to deploy OpenVidu Call application, use this URL
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !Ref MyDomainName
|
||||
Condition: WhichCertPresent
|
|
@ -0,0 +1,144 @@
|
|||
---
|
||||
AWSTemplateFormatVersion: 2010-09-09
|
||||
Description: Openvidu Server CE CloudFormation AMI template.
|
||||
|
||||
Mappings:
|
||||
AMIMAP:
|
||||
eu-west-1:
|
||||
AMI: AMIEUWEST1
|
||||
us-east-1:
|
||||
AMI: AMIUSEAST1
|
||||
|
||||
Resources:
|
||||
OpenviduServerCE:
|
||||
Type: 'AWS::EC2::Instance'
|
||||
Metadata:
|
||||
Comment: "Install OpenVidu Server CE"
|
||||
AWS::CloudFormation::Init:
|
||||
config:
|
||||
files:
|
||||
"/etc/cfn/cfn-hup.conf":
|
||||
content: !Sub |
|
||||
[main]
|
||||
stack=${AWS::StackId}
|
||||
region=${AWS::Region}
|
||||
mode: "000400"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/etc/cfn/hooks.d/cfn-auto-reloader.conf":
|
||||
content: !Sub |
|
||||
[cfn-auto-reloader-hook]
|
||||
triggers=post.update
|
||||
path=Resources.OpenviduServerCE.Metadata.AWS::CloudFormation::Init
|
||||
action=/usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource OpenviduServerCE --region ${AWS::Region}
|
||||
mode: "000400"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/installDockerAndDockerCompose.sh":
|
||||
content: |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Install Docker
|
||||
apt-get update && apt-get install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||
apt-key fingerprint 0EBFCD88
|
||||
add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
|
||||
apt-get update && apt-get install -y \
|
||||
docker-ce \
|
||||
docker-ce-cli \
|
||||
containerd.io
|
||||
|
||||
# Install docker-compose
|
||||
curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/installOpenviduCE.sh":
|
||||
content: !Sub |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Install openvidu-ce
|
||||
cd /opt
|
||||
curl https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/install_openvidu_OPENVIDU_VERSION.sh | bash
|
||||
|
||||
# Define Installation Type
|
||||
sed -i "s/Installation Mode: On Premises/Installation Mode: Cloud Formation/" /opt/openvidu/docker-compose.yml
|
||||
|
||||
# Configure crash report
|
||||
mkdir -p /opt/openvidu/kms-crashes
|
||||
sed -i "s/enabled=1/enabled=0/" /etc/default/apport
|
||||
echo "kernel.core_pattern=/opt/openvidu/kms-crashes/core_%e_%p_%u_%t" >> /etc/sysctl.conf
|
||||
sysctl --system
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/getDockerImages.sh":
|
||||
content: !Sub |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Openvidu recording
|
||||
docker pull openvidu/openvidu-recording:OPENVIDU_RECORDING_DOCKER_TAG
|
||||
|
||||
# Openvidu CE images
|
||||
cd /opt/openvidu
|
||||
docker-compose pull
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
Properties:
|
||||
ImageId: !FindInMap [AMIMAP, !Ref 'AWS::Region', AMI]
|
||||
InstanceType: "t2.2xlarge"
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Ref AWS::StackName
|
||||
UserData:
|
||||
"Fn::Base64":
|
||||
!Sub |
|
||||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
apt-get update && apt-get install -y \
|
||||
python-pip \
|
||||
ec2-instance-connect
|
||||
pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
|
||||
|
||||
cfn-init --region ${AWS::Region} --stack ${AWS::StackId} --resource OpenviduServerCE
|
||||
|
||||
/usr/local/bin/installDockerAndDockerCompose.sh || { echo "[Openvidu] error installing docker and compose"; exit 1; }
|
||||
|
||||
/usr/local/bin/installOpenviduCE.sh || { echo "[Openvidu] error installing Openvidu CE"; exit 1; }
|
||||
|
||||
/usr/local/bin/getDockerImages.sh || { echo "[Openvidu] error getting docker images"; exit 1; }
|
||||
|
||||
# sending the finish call
|
||||
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource WaitCondition --region ${AWS::Region}
|
||||
|
||||
# Cleaning the house
|
||||
shred -u /var/log/cloud-init-output.log
|
||||
shred -u /etc/ssh/*_key /etc/ssh/*_key.pub
|
||||
shred -u /usr/local/bin/installDockerAndDockerCompose.sh
|
||||
shred -u /usr/local/bin/installOpenviduCE.sh
|
||||
shred -u /usr/local/bin/getDockerImages.sh
|
||||
find /var/lib/cloud/instances/$(curl http://169.254.169.254/latest/meta-data/instance-id) -type f | xargs shred -u
|
||||
rm -rf /var/lib/cloud/instances/$(curl http://169.254.169.254/latest/meta-data/instance-id)
|
||||
|
||||
WaitCondition:
|
||||
Type: AWS::CloudFormation::WaitCondition
|
||||
CreationPolicy:
|
||||
ResourceSignal:
|
||||
Timeout: PT10M
|
||||
Count: 1
|
|
@ -0,0 +1,79 @@
|
|||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
|
||||
CF_OVP_TARGET=${CF_OVP_TARGET:-nomarket}
|
||||
|
||||
if [ ${CF_OVP_TARGET} == "market" ]; then
|
||||
export AWS_ACCESS_KEY_ID=${NAEVA_AWS_ACCESS_KEY_ID}
|
||||
export AWS_SECRET_ACCESS_KEY=${NAEVA_AWS_SECRET_ACCESS_KEY}
|
||||
export AWS_DEFAULT_REGION=us-east-1
|
||||
else
|
||||
export AWS_DEFAULT_REGION=eu-west-1
|
||||
fi
|
||||
|
||||
DATESTAMP=$(date +%s)
|
||||
TEMPJSON=$(mktemp -t cloudformation-XXX --suffix .json)
|
||||
|
||||
# Get Latest Ubuntu AMI id from specified region
|
||||
# Parameters
|
||||
# $1 Aws region
|
||||
getUbuntuAmiId() {
|
||||
local AMI_ID=$(
|
||||
aws --region ${1} ec2 describe-images \
|
||||
--filters Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64* \
|
||||
--query 'Images[*].[ImageId,CreationDate]' \
|
||||
--output text \
|
||||
| sort -k2 -r | head -n1 | cut -d$'\t' -f1
|
||||
)
|
||||
echo $AMI_ID
|
||||
}
|
||||
|
||||
AMIEUWEST1=$(getUbuntuAmiId 'eu-west-1')
|
||||
AMIUSEAST1=$(getUbuntuAmiId 'us-east-1')
|
||||
|
||||
# Copy templates to feed
|
||||
cp cfn-mkt-ov-ce-ami.yaml.template cfn-mkt-ov-ce-ami.yaml
|
||||
|
||||
## Setting Openvidu Version and Ubuntu Latest AMIs
|
||||
sed -i "s/OPENVIDU_VERSION/${OPENVIDU_VERSION}/g" cfn-mkt-ov-ce-ami.yaml
|
||||
sed -i "s/OPENVIDU_RECORDING_DOCKER_TAG/${OPENVIDU_RECORDING_DOCKER_TAG}/g" cfn-mkt-ov-ce-ami.yaml
|
||||
sed -i "s/AMIEUWEST1/${AMIEUWEST1}/g" cfn-mkt-ov-ce-ami.yaml
|
||||
sed -i "s/AMIUSEAST1/${AMIUSEAST1}/g" cfn-mkt-ov-ce-ami.yaml
|
||||
|
||||
## OpenVidu AMI
|
||||
|
||||
# Copy template to S3
|
||||
aws s3 cp cfn-mkt-ov-ce-ami.yaml s3://aws.openvidu.io
|
||||
TEMPLATE_URL=https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/cfn-mkt-ov-ce-ami.yaml
|
||||
|
||||
aws cloudformation create-stack \
|
||||
--stack-name openvidu-ce-${DATESTAMP} \
|
||||
--template-url ${TEMPLATE_URL} \
|
||||
--disable-rollback
|
||||
|
||||
aws cloudformation wait stack-create-complete --stack-name openvidu-ce-${DATESTAMP}
|
||||
|
||||
echo "Getting instance ID"
|
||||
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=openvidu-ce-${DATESTAMP}" | jq -r ' .Reservations[] | .Instances[] | .InstanceId')
|
||||
|
||||
echo "Stopping the instance"
|
||||
aws ec2 stop-instances --instance-ids ${INSTANCE_ID}
|
||||
|
||||
echo "wait for the instance to stop"
|
||||
aws ec2 wait instance-stopped --instance-ids ${INSTANCE_ID}
|
||||
|
||||
echo "Creating AMI"
|
||||
OV_RAW_AMI_ID=$(aws ec2 create-image --instance-id ${INSTANCE_ID} --name OpenViduServerCE-${OPENVIDU_VERSION}-${DATESTAMP} --description "Openvidu Server CE" --output text)
|
||||
|
||||
echo "Cleaning up"
|
||||
aws cloudformation delete-stack --stack-name openvidu-ce-${DATESTAMP}
|
||||
|
||||
# Wait for the instance
|
||||
aws ec2 wait image-available --image-ids ${OV_RAW_AMI_ID}
|
||||
|
||||
# Updating the template
|
||||
sed "s/OV_AMI_ID/${OV_RAW_AMI_ID}/" CF-OpenVidu.yaml.template > CF-OpenVidu-${OPENVIDU_VERSION}.yaml
|
||||
sed -i "s/OPENVIDU_VERSION/${OPENVIDU_VERSION}/g" CF-OpenVidu-${OPENVIDU_VERSION}.yaml
|
||||
|
||||
rm $TEMPJSON
|
||||
rm cfn-mkt-ov-ce-ami.yaml
|
|
@ -0,0 +1,83 @@
|
|||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
|
||||
# Replicate AMIs in all regions
|
||||
#
|
||||
# Input parameters:
|
||||
#
|
||||
# OV_AMI_NAME OpenVidu AMI Name
|
||||
# OV_AMI_ID OpenVidu AMI ID
|
||||
|
||||
export AWS_DEFAULT_REGION=eu-west-1
|
||||
if [ ${CF_OVP_TARGET} == "market" ]; then
|
||||
export AWS_ACCESS_KEY_ID=${NAEVA_AWS_ACCESS_KEY_ID}
|
||||
export AWS_SECRET_ACCESS_KEY=${NAEVA_AWS_SECRET_ACCESS_KEY}
|
||||
fi
|
||||
|
||||
echo "Making original AMI public"
|
||||
aws ec2 wait image-exists --image-ids ${OV_AMI_ID}
|
||||
aws ec2 wait image-available --image-ids ${OV_AMI_ID}
|
||||
aws ec2 modify-image-attribute --image-id ${OV_AMI_ID} --launch-permission "Add=[{Group=all}]"
|
||||
|
||||
TARGET_REGIONS="eu-north-1
|
||||
eu-west-3
|
||||
eu-west-2
|
||||
eu-west-1
|
||||
sa-east-1
|
||||
ca-central-1
|
||||
ap-south-1
|
||||
ap-southeast-1
|
||||
ap-southeast-2
|
||||
ap-northeast-1
|
||||
ap-northeast-2
|
||||
ap-east-1
|
||||
eu-central-1
|
||||
us-east-1
|
||||
us-east-2
|
||||
us-west-1
|
||||
us-west-2
|
||||
me-south-1
|
||||
af-south-1"
|
||||
|
||||
AMI_IDS=()
|
||||
REGIONS=()
|
||||
for REGION in ${TARGET_REGIONS}
|
||||
do
|
||||
ID=$(aws ec2 copy-image --name ${OV_AMI_NAME} --source-image-id ${OV_AMI_ID} --source-region ${AWS_DEFAULT_REGION} --region ${REGION} --output text --query 'ImageId')
|
||||
echo "Replicated AMI in region ${REGION} with id ${ID}"
|
||||
AMI_IDS+=($ID)
|
||||
REGIONS+=($REGION)
|
||||
done
|
||||
|
||||
if [ "${#AMI_IDS[@]}" -ne "${#REGIONS[@]}" ]; then
|
||||
echo "The number of elements in array of AMI ids and array of regions is not equal"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting for images to be available..."
|
||||
echo "-------------------------------------"
|
||||
ITER=0
|
||||
for i in "${AMI_IDS[@]}"
|
||||
do
|
||||
AMI_ID=${AMI_IDS[$ITER]}
|
||||
REGION=${REGIONS[$ITER]}
|
||||
aws ec2 wait image-exists --region ${REGION} --image-ids ${AMI_ID}
|
||||
echo "${AMI_ID} of region ${REGION} exists"
|
||||
aws ec2 wait image-available --region ${REGION} --image-ids ${AMI_ID}
|
||||
echo "${AMI_ID} of region ${REGION} available"
|
||||
aws ec2 modify-image-attribute --region ${REGION} --image-id ${AMI_ID} --launch-permission "Add=[{Group=all}]"
|
||||
echo "${AMI_ID} of region ${REGION} is now public"
|
||||
echo "-------------------------------------"
|
||||
ITER=$(expr $ITER + 1)
|
||||
done
|
||||
|
||||
echo "OV IDs"
|
||||
ITER=0
|
||||
for i in "${AMI_IDS[@]}"
|
||||
do
|
||||
AMI_ID=${AMI_IDS[$ITER]}
|
||||
REGION=${REGIONS[$ITER]}
|
||||
echo " ${REGION}:"
|
||||
echo " AMI: ${AMI_ID}"
|
||||
ITER=$(expr $ITER + 1)
|
||||
done
|
|
@ -3,6 +3,7 @@
|
|||
# Global variables
|
||||
OPENVIDU_FOLDER=openvidu
|
||||
OPENVIDU_VERSION=master
|
||||
DOWNLOAD_URL=https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}
|
||||
|
||||
fatal_error() {
|
||||
printf "\n =======¡ERROR!======="
|
||||
|
@ -25,23 +26,23 @@ new_ov_installation() {
|
|||
# Download necessary files
|
||||
printf '\n => Downloading Openvidu CE files:'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/.env \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/.env \
|
||||
--output "${OPENVIDU_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/docker-compose.override.yml \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/docker-compose.override.yml \
|
||||
--output "${OPENVIDU_FOLDER}/docker-compose.override.yml" || fatal_error "Error when downloading the file 'docker-compose.override.yml'"
|
||||
printf '\n - docker-compose.override.yml'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml \
|
||||
--output "${OPENVIDU_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/openvidu \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/openvidu \
|
||||
--output "${OPENVIDU_FOLDER}/openvidu" || fatal_error "Error when downloading the file 'openvidu'"
|
||||
printf '\n - openvidu'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/readme.md \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/readme.md \
|
||||
--output "${OPENVIDU_FOLDER}/readme.md" || fatal_error "Error when downloading the file 'readme.md'"
|
||||
printf '\n - readme.md'
|
||||
|
||||
|
@ -69,7 +70,8 @@ new_ov_installation() {
|
|||
printf '\n 3. Start OpenVidu'
|
||||
printf '\n $ ./openvidu start'
|
||||
printf '\n'
|
||||
printf '\n For more information, check readme.md'
|
||||
printf '\n For more information, check:'
|
||||
printf "\n https://docs.openvidu.io/en/${OPENVIDU_VERSION//v}/deployment/deploying-on-premises/"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
exit 0
|
||||
|
@ -128,23 +130,23 @@ upgrade_ov() {
|
|||
# Download necessary files
|
||||
printf '\n => Downloading new Openvidu CE files:'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/docker-compose.yml \
|
||||
--output "${TMP_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/docker-compose.override.yml \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/docker-compose.override.yml \
|
||||
--output "${TMP_FOLDER}/docker-compose.override.yml" || fatal_error "Error when downloading the file 'docker-compose.override.yml'"
|
||||
printf "\n - docker-compose.override.yml"
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/.env \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/.env \
|
||||
--output "${TMP_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/openvidu \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/openvidu \
|
||||
--output "${TMP_FOLDER}/openvidu" || fatal_error "Error when downloading the file 'openvidu'"
|
||||
printf '\n - openvidu'
|
||||
|
||||
curl --silent https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}/openvidu-server/docker/openvidu-docker-compose/readme.md \
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/docker/openvidu-docker-compose/readme.md \
|
||||
--output "${TMP_FOLDER}/readme.md" || fatal_error "Error when downloading the file 'readme.md'"
|
||||
printf '\n - readme.md'
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
{"ParameterKey":"KeyName","ParameterValue":"taskcat"},
|
||||
{"ParameterKey":"OpenViduSecret","ParameterValue":"MY_SECRET"},
|
||||
{"ParameterKey":"LetsEncryptEmail","ParameterValue":""},
|
||||
{"ParameterKey":"OwnCertKEY","ParameterValue":""},
|
||||
{"ParameterKey":"PublicElasticIP","ParameterValue":""},
|
||||
{"ParameterKey":"MyDomainName","ParameterValue":""},
|
||||
{"ParameterKey":"OwnCertCRT","ParameterValue":""}
|
||||
]
|
|
@ -0,0 +1,25 @@
|
|||
---
|
||||
global:
|
||||
owner: openvidu@gmail.com
|
||||
qsname: openvidu-ce
|
||||
regions:
|
||||
- us-east-1
|
||||
- us-east-2
|
||||
- us-west-1
|
||||
- us-west-2
|
||||
- ap-south-1
|
||||
- ap-northeast-2
|
||||
- ap-southeast-1
|
||||
- ap-southeast-2
|
||||
- ap-northeast-1
|
||||
- ca-central-1
|
||||
- eu-central-1
|
||||
- eu-west-1
|
||||
- eu-west-2
|
||||
- eu-west-3
|
||||
- sa-east-1
|
||||
reporting: true
|
||||
tests:
|
||||
openvidu-all-regions:
|
||||
parameter_input: parameters_input.json
|
||||
template_file: TEMPLATE_TO_TEST
|
|
@ -0,0 +1,146 @@
|
|||
---
|
||||
AWSTemplateFormatVersion: 2010-09-09
|
||||
Description: Kurento Media Server CloudFormation AMI template.
|
||||
|
||||
Mappings:
|
||||
AMIMAP:
|
||||
eu-west-1:
|
||||
AMI: AMIEUWEST1
|
||||
us-east-1:
|
||||
AMI: AMIUSEAST1
|
||||
|
||||
Resources:
|
||||
KurentoMediaServer:
|
||||
Type: 'AWS::EC2::Instance'
|
||||
Metadata:
|
||||
Comment: "Install Kurento Media Server"
|
||||
AWS::CloudFormation::Init:
|
||||
config:
|
||||
files:
|
||||
"/etc/cfn/cfn-hup.conf":
|
||||
content: !Sub |
|
||||
[main]
|
||||
stack=${AWS::StackId}
|
||||
region=${AWS::Region}
|
||||
mode: "000400"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/etc/cfn/hooks.d/cfn-auto-reloader.conf":
|
||||
content: !Sub |
|
||||
[cfn-auto-reloader-hook]
|
||||
triggers=post.update
|
||||
path=Resources.KurentoMediaServer.Metadata.AWS::CloudFormation::Init
|
||||
action=/usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource KurentoMediaServer --region ${AWS::Region}
|
||||
mode: "000400"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/installDockerAndDockerCompose.sh":
|
||||
content: |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Install Docker
|
||||
apt-get update && apt-get install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||
apt-key fingerprint 0EBFCD88
|
||||
add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
|
||||
apt-get update && apt-get install -y \
|
||||
docker-ce \
|
||||
docker-ce-cli \
|
||||
containerd.io
|
||||
|
||||
# Install docker-compose
|
||||
curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/installMediaNode.sh":
|
||||
content: |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Install kms
|
||||
cd /opt
|
||||
curl https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/install_media_node_OPENVIDU_VERSION.sh | bash
|
||||
|
||||
# Define Installation Type
|
||||
sed -i "s/Installation Mode: On Premises/Installation Mode: Cloud Formation/" /opt/kms/docker-compose.yml
|
||||
|
||||
# Create recording folder
|
||||
mkdir -p /opt/openvidu/recordings
|
||||
chmod 777 /opt/openvidu/recordings
|
||||
|
||||
# Configure crash report
|
||||
mkdir -p /opt/openvidu/kms-crashes
|
||||
sed -i "s/enabled=1/enabled=0/" /etc/default/apport
|
||||
echo "kernel.core_pattern=/opt/openvidu/kms-crashes/core_%e_%p_%u_%t" >> /etc/sysctl.conf
|
||||
sysctl --system
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/runMediaNode.sh":
|
||||
content: |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Run KMS
|
||||
cd /opt/kms
|
||||
docker-compose up -d
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
Properties:
|
||||
ImageId: !FindInMap [AMIMAP, !Ref 'AWS::Region', AMI]
|
||||
InstanceType: "t2.2xlarge"
|
||||
KeyName: AWS_KEY_NAME
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Ref AWS::StackName
|
||||
UserData:
|
||||
"Fn::Base64":
|
||||
!Sub |
|
||||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
apt-get update && apt-get install -y \
|
||||
python-pip \
|
||||
ec2-instance-connect
|
||||
pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
|
||||
|
||||
cfn-init --region ${AWS::Region} --stack ${AWS::StackId} --resource KurentoMediaServer
|
||||
|
||||
/usr/local/bin/installDockerAndDockerCompose.sh || { echo "[Openvidu] error installing software"; exit 1; }
|
||||
|
||||
/usr/local/bin/installMediaNode.sh || { echo "[Openvidu] error installing Media Node"; exit 1; }
|
||||
|
||||
/usr/local/bin/runMediaNode.sh || { echo "[Openvidu] error running Media Node"; exit 1; }
|
||||
|
||||
# sending the finish call
|
||||
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource WaitCondition --region ${AWS::Region}
|
||||
|
||||
# Cleaning the house
|
||||
shred -v -u /var/log/cloud-init-output.log
|
||||
shred -v -u /etc/ssh/*_key /etc/ssh/*_key.pub
|
||||
shred -v -u /usr/local/bin/installDockerAndDockerCompose.sh
|
||||
shred -v -u /usr/local/bin/installMediaNode.sh
|
||||
shred -v -u /usr/local/bin/runMediaNode.sh
|
||||
find /var/lib/cloud/instances/$(curl http://169.254.169.254/latest/meta-data/instance-id) -type f | xargs shred -v -u
|
||||
rm -rf /var/lib/cloud/instances/$(curl http://169.254.169.254/latest/meta-data/instance-id)
|
||||
|
||||
WaitCondition:
|
||||
Type: AWS::CloudFormation::WaitCondition
|
||||
CreationPolicy:
|
||||
ResourceSignal:
|
||||
Timeout: PT10M
|
||||
Count: 1
|
|
@ -0,0 +1,142 @@
|
|||
---
|
||||
AWSTemplateFormatVersion: 2010-09-09
|
||||
Description: Openvidu Server Pro CloudFormation AMI template.
|
||||
|
||||
Mappings:
|
||||
AMIMAP:
|
||||
eu-west-1:
|
||||
AMI: AMIEUWEST1
|
||||
us-east-1:
|
||||
AMI: AMIUSEAST1
|
||||
|
||||
Resources:
|
||||
OpenviduServerPro:
|
||||
Type: 'AWS::EC2::Instance'
|
||||
Metadata:
|
||||
Comment: "Install OpenVidu Server Pro"
|
||||
AWS::CloudFormation::Init:
|
||||
config:
|
||||
files:
|
||||
"/etc/cfn/cfn-hup.conf":
|
||||
content: !Sub |
|
||||
[main]
|
||||
stack=${AWS::StackId}
|
||||
region=${AWS::Region}
|
||||
mode: "000400"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/etc/cfn/hooks.d/cfn-auto-reloader.conf":
|
||||
content: !Sub |
|
||||
[cfn-auto-reloader-hook]
|
||||
triggers=post.update
|
||||
path=Resources.OpenviduServerPro.Metadata.AWS::CloudFormation::Init
|
||||
action=/usr/local/bin/cfn-init -v --stack ${AWS::StackName} --resource OpenviduServerPro --region ${AWS::Region}
|
||||
mode: "000400"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/installDockerAndDockerCompose.sh":
|
||||
content: |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Install Docker
|
||||
apt-get update && apt-get install -y \
|
||||
apt-transport-https \
|
||||
ca-certificates \
|
||||
curl \
|
||||
gnupg-agent \
|
||||
software-properties-common
|
||||
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
||||
apt-key fingerprint 0EBFCD88
|
||||
add-apt-repository \
|
||||
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
|
||||
$(lsb_release -cs) \
|
||||
stable"
|
||||
|
||||
apt-get update && apt-get install -y \
|
||||
docker-ce \
|
||||
docker-ce-cli \
|
||||
containerd.io
|
||||
|
||||
# Install docker-compose
|
||||
curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/installOpenviduServerPRO.sh":
|
||||
content: !Sub |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Install openvidu-pro
|
||||
cd /opt
|
||||
curl https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/install_openvidu_pro_OPENVIDU_VERSION.sh | bash
|
||||
|
||||
# Define Installation Type
|
||||
sed -i "s/Installation Mode: On Premises/Installation Mode: Cloud Formation/" /opt/openvidu/docker-compose.yml
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
"/usr/local/bin/getDockerImages.sh":
|
||||
content: !Sub |
|
||||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# AWS cli
|
||||
docker pull amazon/aws-cli:AWS_DOCKER_TAG
|
||||
|
||||
# Openvidu recording
|
||||
docker pull openvidu/openvidu-recording:OPENVIDU_RECORDING_DOCKER_TAG
|
||||
|
||||
# Openvidu PRO images
|
||||
cd /opt/openvidu
|
||||
docker-compose pull
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
Properties:
|
||||
ImageId: !FindInMap [AMIMAP, !Ref 'AWS::Region', AMI]
|
||||
InstanceType: "t2.2xlarge"
|
||||
KeyName: AWS_KEY_NAME
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: !Ref AWS::StackName
|
||||
UserData:
|
||||
"Fn::Base64":
|
||||
!Sub |
|
||||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
apt-get update && apt-get install -y \
|
||||
python-pip \
|
||||
ec2-instance-connect
|
||||
pip install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.tar.gz
|
||||
|
||||
cfn-init --region ${AWS::Region} --stack ${AWS::StackId} --resource OpenviduServerPro
|
||||
|
||||
/usr/local/bin/installDockerAndDockerCompose.sh || { echo "[Openvidu] error installing docker and compose"; exit 1; }
|
||||
|
||||
/usr/local/bin/installOpenviduServerPRO.sh || { echo "[Openvidu] error installing Openvidu Server PRO"; exit 1; }
|
||||
|
||||
/usr/local/bin/getDockerImages.sh || { echo "[Openvidu] error getting docker images"; exit 1; }
|
||||
|
||||
# sending the finish call
|
||||
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource WaitCondition --region ${AWS::Region}
|
||||
|
||||
# Cleaning the house
|
||||
shred -u /var/log/cloud-init-output.log
|
||||
shred -u /etc/ssh/*_key /etc/ssh/*_key.pub
|
||||
shred -u /usr/local/bin/installDockerAndDockerCompose.sh
|
||||
shred -u /usr/local/bin/installOpenviduServerPRO.sh
|
||||
shred -u /usr/local/bin/getDockerImages.sh
|
||||
find /var/lib/cloud/instances/$(curl http://169.254.169.254/latest/meta-data/instance-id) -type f | xargs shred -u
|
||||
rm -rf /var/lib/cloud/instances/$(curl http://169.254.169.254/latest/meta-data/instance-id)
|
||||
|
||||
WaitCondition:
|
||||
Type: AWS::CloudFormation::WaitCondition
|
||||
CreationPolicy:
|
||||
ResourceSignal:
|
||||
Timeout: PT10M
|
||||
Count: 1
|
|
@ -0,0 +1,666 @@
|
|||
---
|
||||
AWSTemplateFormatVersion: 2010-09-09
|
||||
Description: Openvidu Pro CloudFormation template
|
||||
|
||||
Parameters:
|
||||
|
||||
# Domain and SSL certificate configuration
|
||||
|
||||
WhichCert:
|
||||
Description: >
|
||||
[selfsigned] Self signed certificate. Not recommended for production use.
|
||||
[owncert] Valid certificate purchased in a Internet services company.
|
||||
[letsencrypt] Generate a new certificate using Let's Encrypt.
|
||||
Type: String
|
||||
AllowedValues:
|
||||
- selfsigned
|
||||
- owncert
|
||||
- letsencrypt
|
||||
Default: selfsigned
|
||||
|
||||
PublicElasticIP:
|
||||
Description: "Previously created AWS Elastic IP to associate it to the OpenVidu EC2 instance. If certificate type is 'selfsigned' this value is optional. If certificate type is 'owncert' or 'letsencrypt' this value is mandatory. Example 13.33.145.23."
|
||||
Type: String
|
||||
AllowedPattern: ^$|^([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])\.([01]?\d{1,2}|2[0-4]\d|25[0-5])$
|
||||
ConstraintDescription: The public Elastic IP does not have a valid IPv4 format
|
||||
|
||||
MyDomainName:
|
||||
Description: "Valid domain name pointing to previous IP. If certificate type is 'selfsigned' this value is optional. If certificate type is 'owncert' or 'letsencrypt' this value is mandatory. Example: openvidu.company.com"
|
||||
Type: String
|
||||
AllowedPattern: ^$|^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9][a-z0-9-]{0,61}[a-z0-9]$
|
||||
ConstraintDescription: The domain name does not have a valid domain name format
|
||||
|
||||
OwnCertCRT:
|
||||
Description: "If certificate type is 'owncert' this is the URL where CRT file will be downloaded"
|
||||
Type: String
|
||||
|
||||
OwnCertKEY:
|
||||
Description: "If certificate type is 'owncert' this is the URL where KEY file will be downloaded"
|
||||
Type: String
|
||||
|
||||
LetsEncryptEmail:
|
||||
Description: "If certificate type is 'letsencrypt', this email will be used for Let's Encrypt notifications"
|
||||
Type: String
|
||||
|
||||
# OpenVidu Configuration
|
||||
|
||||
OpenViduLicense:
|
||||
Description: "Visit https://openvidu.io/account"
|
||||
Type: String
|
||||
AllowedPattern: ^(?!\s*$).+$
|
||||
NoEcho: true
|
||||
ConstraintDescription: OpenVidu Pro License is mandatory
|
||||
|
||||
OpenViduSecret:
|
||||
Description: "Secret to connect to this OpenVidu Platform. No whitespaces or quotations allowed"
|
||||
Type: String
|
||||
AllowedPattern: ^((?!")(?! ).)+$
|
||||
NoEcho: true
|
||||
ConstraintDescription: OpenVidu Secret is mandatory (no whitespaces or quotations allowed)
|
||||
|
||||
MediaNodesStartNumber:
|
||||
Description: "How many Media Nodes do you want on startup (EC2 instances will be launched)"
|
||||
Type: Number
|
||||
Default: 1
|
||||
|
||||
# Kibana configuration
|
||||
|
||||
KibanaUser:
|
||||
Description: "Username for Kibana Dashboard"
|
||||
Type: String
|
||||
AllowedPattern: ^((?!")(?! ).)+$
|
||||
ConstraintDescription: Kibana user is mandatory (no whitespaces or quotations allowed)
|
||||
Default: kibanaadmin
|
||||
|
||||
KibanaPassword:
|
||||
Description: "Password for Kibana Dashboard"
|
||||
Type: String
|
||||
AllowedPattern: ^((?!")(?! ).)+$
|
||||
NoEcho: true
|
||||
ConstraintDescription: Kibana password is mandatory (no whitespaces or quotations allowed)
|
||||
|
||||
# EC2 Instance configuration
|
||||
|
||||
AwsInstanceTypeOV:
|
||||
Description: "Specifies the EC2 instance type for your OpenVidu Server Pro Node"
|
||||
Type: String
|
||||
Default: t2.xlarge
|
||||
AllowedValues:
|
||||
- t2.large
|
||||
- t2.xlarge
|
||||
- t2.2xlarge
|
||||
- t3.large
|
||||
- t3.xlarge
|
||||
- t3.2xlarge
|
||||
- m4.large
|
||||
- m4.xlarge
|
||||
- m4.2xlarge
|
||||
- m4.4xlarge
|
||||
- m4.10xlarge
|
||||
- m4.16xlarge
|
||||
- m5.large
|
||||
- m5.xlarge
|
||||
- m5.2xlarge
|
||||
- m5.4xlarge
|
||||
- m5.8xlarge
|
||||
- m5.12xlarge
|
||||
- m5.16xlarge
|
||||
- m5.24xlarge
|
||||
- c4.large
|
||||
- c4.xlarge
|
||||
- c4.2xlarge
|
||||
- c4.4xlarge
|
||||
- c4.8xlarge
|
||||
- c5.large
|
||||
- c5.xlarge
|
||||
- c5.2xlarge
|
||||
- c5.4xlarge
|
||||
- c5.9xlarge
|
||||
- c5.12xlarge
|
||||
- c5.18xlarge
|
||||
- c5.24xlarge
|
||||
ConstraintDescription: "Must be a valid EC2 instance type"
|
||||
|
||||
AwsInstanceTypeKMS:
|
||||
Description: "Specifies the EC2 instance type for your Media Nodes"
|
||||
Type: String
|
||||
Default: t2.xlarge
|
||||
AllowedValues:
|
||||
- t2.large
|
||||
- t2.xlarge
|
||||
- t2.2xlarge
|
||||
- t3.large
|
||||
- t3.xlarge
|
||||
- t3.2xlarge
|
||||
- m4.large
|
||||
- m4.xlarge
|
||||
- m4.2xlarge
|
||||
- m4.4xlarge
|
||||
- m4.10xlarge
|
||||
- m4.16xlarge
|
||||
- m5.large
|
||||
- m5.xlarge
|
||||
- m5.2xlarge
|
||||
- m5.4xlarge
|
||||
- m5.8xlarge
|
||||
- m5.12xlarge
|
||||
- m5.16xlarge
|
||||
- m5.24xlarge
|
||||
- c4.large
|
||||
- c4.xlarge
|
||||
- c4.2xlarge
|
||||
- c4.4xlarge
|
||||
- c4.8xlarge
|
||||
- c5.large
|
||||
- c5.xlarge
|
||||
- c5.2xlarge
|
||||
- c5.4xlarge
|
||||
- c5.9xlarge
|
||||
- c5.12xlarge
|
||||
- c5.18xlarge
|
||||
- c5.24xlarge
|
||||
ConstraintDescription: "Must be a valid EC2 instance type"
|
||||
|
||||
KeyName:
|
||||
Description: "Name of an existing EC2 KeyPair to enable SSH access to the instance. It is mandatory to perform some administrative tasks of OpenVidu."
|
||||
Type: 'AWS::EC2::KeyPair::KeyName'
|
||||
ConstraintDescription: "must be the name of an existing EC2 KeyPair"
|
||||
|
||||
# Networking configuration
|
||||
|
||||
OpenViduVPC:
|
||||
Description: "Dedicated VPC for OpenVidu cluster"
|
||||
Type: AWS::EC2::VPC::Id
|
||||
|
||||
OpenViduSubnet:
|
||||
Description: "Subnet for OpenVidu cluster"
|
||||
Type: AWS::EC2::Subnet::Id
|
||||
|
||||
# Other configuration
|
||||
|
||||
WantToDeployDemos:
|
||||
Description: "Choose if you want to deploy OpenVidu Call application alongside OpenVidu platform."
|
||||
Type: String
|
||||
AllowedValues:
|
||||
- true
|
||||
- false
|
||||
Default: true
|
||||
|
||||
Mappings:
|
||||
OVAMIMAP:
|
||||
eu-west-1:
|
||||
AMI: OV_AMI_ID
|
||||
|
||||
KMSAMIMAP:
|
||||
eu-west-1:
|
||||
AMI: KMS_AMI_ID
|
||||
|
||||
Metadata:
|
||||
'AWS::CloudFormation::Interface':
|
||||
ParameterGroups:
|
||||
- Label:
|
||||
default: Domain and SSL certificate configuration
|
||||
Parameters:
|
||||
- WhichCert
|
||||
- PublicElasticIP
|
||||
- MyDomainName
|
||||
- OwnCertCRT
|
||||
- OwnCertKEY
|
||||
- LetsEncryptEmail
|
||||
- Label:
|
||||
default: OpenVidu configuration
|
||||
Parameters:
|
||||
- OpenViduLicense
|
||||
- OpenViduSecret
|
||||
- MediaNodesStartNumber
|
||||
- Label:
|
||||
default: Kibana configuration
|
||||
Parameters:
|
||||
- KibanaUser
|
||||
- KibanaPassword
|
||||
- Label:
|
||||
default: EC2 Instance configuration
|
||||
Parameters:
|
||||
- AwsInstanceTypeOV
|
||||
- AwsInstanceTypeKMS
|
||||
- KeyName
|
||||
- Label:
|
||||
default: Networking configuration
|
||||
Parameters:
|
||||
- OpenViduVPC
|
||||
- OpenViduSubnet
|
||||
- Label:
|
||||
default: Other configuration
|
||||
Parameters:
|
||||
- WantToDeployDemos
|
||||
|
||||
ParameterLabels:
|
||||
# SSL certificate configuration
|
||||
WhichCert:
|
||||
default: "Certificate Type"
|
||||
PublicElasticIP:
|
||||
default: "AWS Elastic IP (EIP)"
|
||||
MyDomainName:
|
||||
default: "Domain Name pointing to Elastic IP"
|
||||
OwnCertCRT:
|
||||
default: "URL to the CRT file (owncert)"
|
||||
OwnCertKEY:
|
||||
default: "URL to the key file (owncert)"
|
||||
LetsEncryptEmail:
|
||||
default: "Email for Let's Encrypt (letsencrypt)"
|
||||
# OpenVidu configuration
|
||||
OpenViduLicense:
|
||||
default: "OpenVidu Pro License key"
|
||||
MediaNodesStartNumber:
|
||||
default: "Initial number of Media Node in your cluster"
|
||||
OpenViduSecret:
|
||||
default: "Openvidu Secret"
|
||||
# Kibana configuration
|
||||
KibanaUser:
|
||||
default: "Kibana username"
|
||||
KibanaPassword:
|
||||
default: "Kibana password"
|
||||
# EC2 instance configuration
|
||||
AwsInstanceTypeOV:
|
||||
default: "Instance type for Openvidu Server Pro Node"
|
||||
AwsInstanceTypeKMS:
|
||||
default: "Instance type for Media Nodes"
|
||||
KeyName:
|
||||
default: "SSH Key"
|
||||
# Networking configuration
|
||||
OpenViduVPC:
|
||||
default: "OpenVidu VPC"
|
||||
OpenViduSubnet:
|
||||
default: "OpenVidu Subnet"
|
||||
# Other configuration
|
||||
WantToDeployDemos:
|
||||
default: "Deploy OpenVidu Call application"
|
||||
|
||||
Conditions:
|
||||
WhichCertPresent: !Not [ !Equals [!Ref WhichCert, ""] ]
|
||||
PublicElasticIPPresent: !Not [ !Equals [!Ref PublicElasticIP, ""] ]
|
||||
|
||||
Resources:
|
||||
|
||||
OpenViduManageEC2Role:
|
||||
Type: 'AWS::IAM::Role'
|
||||
Properties:
|
||||
AssumeRolePolicyDocument:
|
||||
Version: 2012-10-17
|
||||
Statement:
|
||||
- Effect: Allow
|
||||
Principal:
|
||||
Service:
|
||||
- ec2.amazonaws.com
|
||||
Action:
|
||||
- 'sts:AssumeRole'
|
||||
Path: /
|
||||
Policies:
|
||||
- PolicyName: OpenViduManageEC2Policy
|
||||
PolicyDocument:
|
||||
Version: 2012-10-17
|
||||
Statement:
|
||||
- Effect: Allow
|
||||
Action:
|
||||
- 'ec2:DescribeInstances'
|
||||
- 'ec2:RunInstances'
|
||||
- 'ec2:TerminateInstances'
|
||||
- 'ec2:CreateTags'
|
||||
- 'ec2:DescribeSecurityGroups'
|
||||
- 'ec2:AuthorizeSecurityGroupIngress'
|
||||
- 'ec2:DescribeSubnets'
|
||||
- 'iam:PassRole'
|
||||
- 'route53:ChangeResourceRecordSets'
|
||||
- 'route53:ListHostedZones'
|
||||
Resource: '*'
|
||||
RoleName: !Join [ "-", [ OpenViduManageEC2Role, !Ref 'AWS::StackName', !Ref 'AWS::Region'] ]
|
||||
|
||||
OpenviduInstancesProfile:
|
||||
Type: 'AWS::IAM::InstanceProfile'
|
||||
Properties:
|
||||
InstanceProfileName: !Join [ "-", [ OpenViduInstanceProfile, !Ref 'AWS::StackName', !Ref 'AWS::Region'] ]
|
||||
Path: /
|
||||
Roles:
|
||||
- !Join [ "-", [ OpenViduManageEC2Role, !Ref 'AWS::StackName', !Ref 'AWS::Region'] ]
|
||||
DependsOn:
|
||||
- OpenViduManageEC2Role
|
||||
|
||||
OpenViduServer:
|
||||
Type: AWS::EC2::Instance
|
||||
Metadata:
|
||||
Comment: OpenVidu Pro
|
||||
AWS::CloudFormation::Init:
|
||||
config:
|
||||
files:
|
||||
'/usr/local/bin/check_app_ready.sh':
|
||||
content: |
|
||||
#!/bin/bash
|
||||
while true; do
|
||||
HTTP_STATUS=$(curl -Ik http://localhost:5443/ | head -n1 | awk '{print $2}')
|
||||
if [ $HTTP_STATUS == 200 ]; then
|
||||
break
|
||||
fi
|
||||
sleep 5
|
||||
done
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/feedGroupVars.sh':
|
||||
content: !Sub
|
||||
- |
|
||||
#!/bin/bash -xe
|
||||
|
||||
WORKINGDIR=/opt/openvidu
|
||||
|
||||
# Pro License
|
||||
sed -i "s/OPENVIDU_PRO_LICENSE=/OPENVIDU_PRO_LICENSE=${OpenViduLicense}/" $WORKINGDIR/.env
|
||||
|
||||
# Replace secret
|
||||
sed -i "s/OPENVIDU_SECRET=/OPENVIDU_SECRET=${OpenViduSecret}/" $WORKINGDIR/.env
|
||||
|
||||
# Replace domain name
|
||||
if [[ "${MyDomainName}" != '' && "${PublicElasticIP}" != '' ]]; then
|
||||
sed -i "s/DOMAIN_OR_PUBLIC_IP=/DOMAIN_OR_PUBLIC_IP=${MyDomainName}/" $WORKINGDIR/.env
|
||||
elif [[ "${MyDomainName}" == '' && "${PublicElasticIP}" != '' ]]; then
|
||||
sed -i "s/DOMAIN_OR_PUBLIC_IP=/DOMAIN_OR_PUBLIC_IP=${PublicElasticIP}/" $WORKINGDIR/.env
|
||||
else
|
||||
[ ! -d "/usr/share/openvidu" ] && mkdir -p /usr/share/openvidu
|
||||
PublicHostname=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
|
||||
sed -i "s/DOMAIN_OR_PUBLIC_IP=/DOMAIN_OR_PUBLIC_IP=$PublicHostname/" $WORKINGDIR/.env
|
||||
echo $PublicHostname > /usr/share/openvidu/old-host-name
|
||||
fi
|
||||
|
||||
# Openvidu Pro mode
|
||||
sed -i "s/OPENVIDU_PRO_CLUSTER_MODE=manual/OPENVIDU_PRO_CLUSTER_MODE=auto/" $WORKINGDIR/.env
|
||||
|
||||
# Openvidu Pro Media Nodes
|
||||
sed -i "s/#OPENVIDU_PRO_CLUSTER_MEDIA_NODES=/OPENVIDU_PRO_CLUSTER_MEDIA_NODES=${MediaNodesStartNumber}/" $WORKINGDIR/.env
|
||||
|
||||
# Openvidu Pro enviroment
|
||||
sed -i "s/OPENVIDU_PRO_CLUSTER_ENVIRONMENT=on_premise/OPENVIDU_PRO_CLUSTER_ENVIRONMENT=aws/" $WORKINGDIR/.env
|
||||
|
||||
# Replace certificated type
|
||||
sed -i "s/CERTIFICATE_TYPE=selfsigned/CERTIFICATE_TYPE=${WhichCert}/" $WORKINGDIR/.env
|
||||
sed -i "s/LETSENCRYPT_EMAIL=user@example.com/LETSENCRYPT_EMAIL=${LetsEncryptEmail}/" $WORKINGDIR/.env
|
||||
|
||||
# Replace Kibana Conf
|
||||
sed -i "s/KIBANA_USER=kibanaadmin/KIBANA_USER=${KibanaUser}/" $WORKINGDIR/.env
|
||||
sed -i "s/KIBANA_PASSWORD=/KIBANA_PASSWORD=${KibanaPassword}/" $WORKINGDIR/.env
|
||||
|
||||
# Replace vars AWS
|
||||
sed -i "s/#AWS_DEFAULT_REGION=/AWS_DEFAULT_REGION=${AWS::Region}/" $WORKINGDIR/.env
|
||||
sed -i "s/#AWS_IMAGE_ID=/AWS_IMAGE_ID=${kmsAmi}/" $WORKINGDIR/.env
|
||||
sed -i "s/#AWS_INSTANCE_TYPE=/AWS_INSTANCE_TYPE=${AwsInstanceTypeKMS}/" $WORKINGDIR/.env
|
||||
sed -i "s/#AWS_KEY_NAME=/AWS_KEY_NAME=${KeyName}/" $WORKINGDIR/.env
|
||||
sed -i "s/#AWS_SUBNET_ID=/AWS_SUBNET_ID=${OpenViduSubnet}/" $WORKINGDIR/.env
|
||||
sed -i "s/#AWS_STACK_ID=/AWS_STACK_ID=$(echo ${AWS::StackId} | sed 's#/#\\/#g')/" $WORKINGDIR/.env
|
||||
sed -i "s/#AWS_STACK_NAME=/AWS_STACK_NAME=${AWS::StackName}/" $WORKINGDIR/.env
|
||||
|
||||
# Get security group id of kms and use it as env variable
|
||||
SECGRPIDKMS=$(/usr/local/bin/getSecurityGroupKms.sh)
|
||||
sed -i "s/#AWS_SECURITY_GROUP=/AWS_SECURITY_GROUP=$SECGRPIDKMS/" $WORKINGDIR/.env
|
||||
|
||||
# Without Application
|
||||
if [ "${WantToDeployDemos}" == "false" ]; then
|
||||
sed -i "s/WITH_APP=true/WITH_APP=false/" $WORKINGDIR/docker-compose.yml
|
||||
rm $WORKINGDIR/docker-compose.override.yml
|
||||
fi
|
||||
- kmsAmi: !FindInMap [KMSAMIMAP, !Ref 'AWS::Region', AMI]
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/buildCerts.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
WORKINGDIR=/opt/openvidu
|
||||
wget --no-check-certificate -O $WORKINGDIR/owncert/certificate.cert ${OwnCertCRT}
|
||||
wget --no-check-certificate -O $WORKINGDIR/owncert/certificate.key ${OwnCertKEY}
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/getSecurityGroupKms.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 describe-security-groups \
|
||||
--region ${AWS::Region} \
|
||||
--output text \
|
||||
--filters "Name=tag:aws:cloudformation:logical-id,Values=KMSSecurityGroup" \
|
||||
"Name=tag:aws:cloudformation:stack-id,Values=${AWS::StackId}" \
|
||||
--query 'SecurityGroups[].GroupId[]'
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/getSecurityGroupOpenVidu.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 describe-security-groups \
|
||||
--region ${AWS::Region} \
|
||||
--output text \
|
||||
--filters "Name=tag:aws:cloudformation:logical-id,Values=OpenViduSecurityGroup" \
|
||||
"Name=tag:aws:cloudformation:stack-id,Values=${AWS::StackId}" \
|
||||
--query 'SecurityGroups[].GroupId[]'
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/getCidrBlocKSubnet.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 describe-subnets \
|
||||
--region ${AWS::Region} \
|
||||
--output text \
|
||||
--filters "Name=subnet-id,Values=${OpenViduSubnet}" \
|
||||
--query 'Subnets[].CidrBlock[]'
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/create_security_group_rules.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
SECGRPIDKMS=$(/usr/local/bin/getSecurityGroupKms.sh)
|
||||
SECGRPIDOV=$(/usr/local/bin/getSecurityGroupOpenVidu.sh)
|
||||
SUBNET_CIDR=$(/usr/local/bin/getCidrBlocKSubnet.sh)
|
||||
|
||||
# Create Security group rules OpenVidu
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 authorize-security-group-ingress --group-id $SECGRPIDOV --protocol tcp --port 5044 --cidr $SUBNET_CIDR
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 authorize-security-group-ingress --group-id $SECGRPIDOV --protocol tcp --port 9200 --cidr $SUBNET_CIDR
|
||||
|
||||
# Create security group rules for KMS
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 authorize-security-group-ingress --group-id $SECGRPIDKMS --protocol tcp --port 8888 --cidr $SUBNET_CIDR
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 authorize-security-group-ingress --group-id $SECGRPIDKMS --protocol tcp --port 3000 --cidr $SUBNET_CIDR
|
||||
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
'/usr/local/bin/restartPRO.sh':
|
||||
content: !Sub |
|
||||
#!/bin/bash -x
|
||||
WORKINGDIR=/opt/openvidu
|
||||
|
||||
# Get new amazon URL
|
||||
OldPublicHostname=$(cat /usr/share/openvidu/old-host-name)
|
||||
PublicHostname=$(curl http://169.254.169.254/latest/meta-data/public-hostname)
|
||||
sed -i "s/$OldPublicHostname/$PublicHostname/" $WORKINGDIR/.env
|
||||
echo $PublicHostname > /usr/share/openvidu/old-host-name
|
||||
|
||||
# Restart all services
|
||||
pushd /opt/openvidu
|
||||
docker-compose up -d
|
||||
popd
|
||||
mode: "000755"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
Properties:
|
||||
ImageId: !FindInMap [OVAMIMAP, !Ref 'AWS::Region', AMI]
|
||||
InstanceType: !Ref AwsInstanceTypeOV
|
||||
KeyName: !Ref KeyName
|
||||
IamInstanceProfile: !Ref OpenviduInstancesProfile
|
||||
SubnetId: !Ref OpenViduSubnet
|
||||
SecurityGroupIds:
|
||||
- !GetAtt 'OpenViduSecurityGroup.GroupId'
|
||||
Tags:
|
||||
- Key: Name
|
||||
Value: 'OpenVidu Server'
|
||||
- Key: 'ov-cluster-member'
|
||||
Value: 'server'
|
||||
UserData:
|
||||
"Fn::Base64":
|
||||
!Sub |
|
||||
#!/bin/bash -xe
|
||||
|
||||
cfn-init --region ${AWS::Region} --stack ${AWS::StackId} --resource OpenViduServer
|
||||
|
||||
# Replace .env variables
|
||||
/usr/local/bin/feedGroupVars.sh || { echo "[Openvidu] Parameters incorrect/insufficient"; exit 1; }
|
||||
|
||||
# Create security groups
|
||||
/usr/local/bin/create_security_group_rules.sh || { echo "[Openvidu] Error creating security groups"; exit 1; }
|
||||
|
||||
# Launch on reboot
|
||||
echo "@reboot /usr/local/bin/restartPRO.sh" | crontab
|
||||
|
||||
# Download certs if "WichCert" mode
|
||||
if [ "${WhichCert}" == "owncert" ]; then
|
||||
/usr/local/bin/buildCerts.sh || { echo "[Openvidu] error with the certificate files"; exit 1; }
|
||||
fi
|
||||
|
||||
# Start openvidu application
|
||||
pushd /opt/openvidu
|
||||
docker-compose up -d
|
||||
popd
|
||||
|
||||
# Wait for the app
|
||||
/usr/local/bin/check_app_ready.sh
|
||||
|
||||
# sending the finish call
|
||||
/usr/local/bin/cfn-signal -e $? --stack ${AWS::StackId} --resource WaitCondition --region ${AWS::Region}
|
||||
|
||||
BlockDeviceMappings:
|
||||
- DeviceName: /dev/sda1
|
||||
Ebs:
|
||||
VolumeType: io1
|
||||
Iops: 200
|
||||
DeleteOnTermination: true
|
||||
VolumeSize: 50
|
||||
|
||||
KMSSecurityGroup:
|
||||
Type: 'AWS::EC2::SecurityGroup'
|
||||
Properties:
|
||||
VpcId: !Ref OpenViduVPC
|
||||
GroupDescription: SSH, Proxy and KMS WebRTC Ports
|
||||
GroupName: !Join [ "-", [ !Ref 'AWS::StackName', 'KMSSecurityGroup'] ]
|
||||
SecurityGroupIngress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 22
|
||||
ToPort: 22
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: udp
|
||||
FromPort: 40000
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 40000
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
SecurityGroupEgress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 1
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: udp
|
||||
FromPort: 1
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
|
||||
OpenViduSecurityGroup:
|
||||
Type: 'AWS::EC2::SecurityGroup'
|
||||
Properties:
|
||||
GroupDescription: SSH, Proxy and OpenVidu WebRTC Ports
|
||||
GroupName: !Join [ "-", [ !Ref 'AWS::StackName', 'OpenViduSecurityGroup'] ]
|
||||
VpcId: !Ref OpenViduVPC
|
||||
SecurityGroupIngress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 22
|
||||
ToPort: 22
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 80
|
||||
ToPort: 80
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 443
|
||||
ToPort: 443
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 3478
|
||||
ToPort: 3478
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: udp
|
||||
FromPort: 3478
|
||||
ToPort: 3478
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: udp
|
||||
FromPort: 40000
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: tcp
|
||||
FromPort: 40000
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
SecurityGroupEgress:
|
||||
- IpProtocol: tcp
|
||||
FromPort: 1
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
- IpProtocol: udp
|
||||
FromPort: 1
|
||||
ToPort: 65535
|
||||
CidrIp: 0.0.0.0/0
|
||||
|
||||
WaitCondition:
|
||||
Type: AWS::CloudFormation::WaitCondition
|
||||
CreationPolicy:
|
||||
ResourceSignal:
|
||||
Timeout: PT25M
|
||||
Count: 1
|
||||
|
||||
MyEIP:
|
||||
Type: AWS::EC2::EIPAssociation
|
||||
Condition: PublicElasticIPPresent
|
||||
Properties:
|
||||
InstanceId: !Ref OpenViduServer
|
||||
EIP: !Ref PublicElasticIP
|
||||
|
||||
Outputs:
|
||||
OpenViduInspector:
|
||||
Description: "Use this URL to connect OpenVidu with user and password"
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !GetAtt OpenViduServer.PublicDnsName
|
||||
- '/inspector'
|
||||
|
||||
OpenViduInspectorLE:
|
||||
Description: "Use this URL to connect to OpenVidu with user and password if you're using Let's Encrypt"
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !Ref MyDomainName
|
||||
- '/inspector'
|
||||
Condition: WhichCertPresent
|
||||
|
||||
Kibana:
|
||||
Description: "Check out graph and performance of your OpenVidu installation"
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !GetAtt OpenViduServer.PublicDnsName
|
||||
- '/kibana'
|
||||
|
||||
KibanaLE:
|
||||
Description: "Check out graph and performance of your OpenVidu installation"
|
||||
Value: !Join
|
||||
- ''
|
||||
- - 'https://'
|
||||
- !Ref MyDomainName
|
||||
- '/kibana'
|
||||
Condition: WhichCertPresent
|
|
@ -0,0 +1,141 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
CF_OVP_TARGET=${CF_OVP_TARGET:-nomarket}
|
||||
|
||||
if [ ${CF_OVP_TARGET} == "market" ]; then
|
||||
export AWS_ACCESS_KEY_ID=${NAEVA_AWS_ACCESS_KEY_ID}
|
||||
export AWS_SECRET_ACCESS_KEY=${NAEVA_AWS_SECRET_ACCESS_KEY}
|
||||
export AWS_DEFAULT_REGION=us-east-1
|
||||
else
|
||||
export AWS_DEFAULT_REGION=eu-west-1
|
||||
fi
|
||||
|
||||
if [ "${OPENVIDU_PRO_IS_SNAPSHOT}" == "true" ]; then
|
||||
OPENVIDU_PRO_VERSION=${OPENVIDU_PRO_VERSION}-SNAPSHOT
|
||||
fi
|
||||
|
||||
DATESTAMP=$(date +%s)
|
||||
TEMPJSON=$(mktemp -t cloudformation-XXX --suffix .json)
|
||||
|
||||
# Get Latest Ubuntu AMI id from specified region
|
||||
# Parameters
|
||||
# $1 Aws region
|
||||
getUbuntuAmiId() {
|
||||
local AMI_ID=$(
|
||||
aws --region ${1} ec2 describe-images \
|
||||
--filters Name=name,Values=ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64* \
|
||||
--query 'Images[*].[ImageId,CreationDate]' \
|
||||
--output text \
|
||||
| sort -k2 -r | head -n1 | cut -d$'\t' -f1
|
||||
)
|
||||
echo $AMI_ID
|
||||
}
|
||||
|
||||
AMIEUWEST1=$(getUbuntuAmiId 'eu-west-1')
|
||||
AMIUSEAST1=$(getUbuntuAmiId 'us-east-1')
|
||||
|
||||
# Copy templates to feed
|
||||
cp cfn-mkt-kms-ami.yaml.template cfn-mkt-kms-ami.yaml
|
||||
cp cfn-mkt-ov-ami.yaml.template cfn-mkt-ov-ami.yaml
|
||||
|
||||
## Setting Openvidu Version and Ubuntu Latest AMIs
|
||||
if [[ ! -z ${AWS_KEY_NAME} ]]; then
|
||||
sed -i "s/ KeyName: AWS_KEY_NAME/ KeyName: ${AWS_KEY_NAME}/g" cfn-mkt-ov-ami.yaml
|
||||
sed -i "s/ KeyName: AWS_KEY_NAME/ KeyName: ${AWS_KEY_NAME}/g" cfn-mkt-kms-ami.yaml
|
||||
else
|
||||
sed -i '/ KeyName: AWS_KEY_NAME/d' cfn-mkt-ov-ami.yaml
|
||||
sed -i '/ KeyName: AWS_KEY_NAME/d' cfn-mkt-kms-ami.yaml
|
||||
fi
|
||||
sed -i "s/AWS_KEY_NAME/${AWS_KEY_NAME}/g" cfn-mkt-ov-ami.yaml
|
||||
sed -i "s/OPENVIDU_VERSION/${OPENVIDU_PRO_VERSION}/g" cfn-mkt-ov-ami.yaml
|
||||
sed -i "s/AWS_DOCKER_TAG/${AWS_DOCKER_TAG}/g" cfn-mkt-ov-ami.yaml
|
||||
sed -i "s/OPENVIDU_RECORDING_DOCKER_TAG/${OPENVIDU_RECORDING_DOCKER_TAG}/g" cfn-mkt-ov-ami.yaml
|
||||
sed -i "s/AMIEUWEST1/${AMIEUWEST1}/g" cfn-mkt-ov-ami.yaml
|
||||
sed -i "s/AMIUSEAST1/${AMIUSEAST1}/g" cfn-mkt-ov-ami.yaml
|
||||
|
||||
sed -i "s/AWS_KEY_NAME/${AWS_KEY_NAME}/g" cfn-mkt-kms-ami.yaml
|
||||
sed -i "s/OPENVIDU_VERSION/${OPENVIDU_PRO_VERSION}/g" cfn-mkt-kms-ami.yaml
|
||||
sed -i "s/AMIEUWEST1/${AMIEUWEST1}/g" cfn-mkt-kms-ami.yaml
|
||||
sed -i "s/AMIUSEAST1/${AMIUSEAST1}/g" cfn-mkt-kms-ami.yaml
|
||||
|
||||
## KMS AMI
|
||||
|
||||
# Copy template to S3
|
||||
if [ ${CF_OVP_TARGET} == "market" ]; then
|
||||
aws s3 cp cfn-mkt-kms-ami.yaml s3://naeva-openvidu-pro
|
||||
TEMPLATE_URL=https://s3-eu-west-1.amazonaws.com/naeva-openvidu-pro/cfn-mkt-kms-ami.yaml
|
||||
else
|
||||
aws s3 cp cfn-mkt-kms-ami.yaml s3://aws.openvidu.io
|
||||
TEMPLATE_URL=https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/cfn-mkt-kms-ami.yaml
|
||||
fi
|
||||
|
||||
aws cloudformation create-stack \
|
||||
--stack-name kms-${DATESTAMP} \
|
||||
--template-url ${TEMPLATE_URL} \
|
||||
--disable-rollback
|
||||
|
||||
aws cloudformation wait stack-create-complete --stack-name kms-${DATESTAMP}
|
||||
|
||||
echo "Getting instance ID"
|
||||
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=kms-${DATESTAMP}" | jq -r ' .Reservations[] | .Instances[] | .InstanceId')
|
||||
|
||||
echo "Stopping the instance"
|
||||
aws ec2 stop-instances --instance-ids ${INSTANCE_ID}
|
||||
|
||||
echo "wait for the instance to stop"
|
||||
aws ec2 wait instance-stopped --instance-ids ${INSTANCE_ID}
|
||||
|
||||
echo "Creating AMI"
|
||||
KMS_RAW_AMI_ID=$(aws ec2 create-image --instance-id ${INSTANCE_ID} --name KMS-ov-${OPENVIDU_PRO_VERSION}-${DATESTAMP} --description "Kurento Media Server" --output text)
|
||||
|
||||
echo "Cleaning up"
|
||||
aws cloudformation delete-stack --stack-name kms-${DATESTAMP}
|
||||
|
||||
## OpenVidu AMI
|
||||
|
||||
# Copy template to S3
|
||||
if [ ${CF_OVP_TARGET} == "market" ]; then
|
||||
aws s3 cp cfn-mkt-ov-ami.yaml s3://naeva-openvidu-pro
|
||||
TEMPLATE_URL=https://s3-eu-west-1.amazonaws.com/naeva-openvidu-pro/cfn-mkt-ov-ami.yaml
|
||||
else
|
||||
aws s3 cp cfn-mkt-ov-ami.yaml s3://aws.openvidu.io
|
||||
TEMPLATE_URL=https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/cfn-mkt-ov-ami.yaml
|
||||
fi
|
||||
|
||||
aws cloudformation create-stack \
|
||||
--stack-name openvidu-${DATESTAMP} \
|
||||
--template-url ${TEMPLATE_URL} \
|
||||
--disable-rollback
|
||||
|
||||
aws cloudformation wait stack-create-complete --stack-name openvidu-${DATESTAMP}
|
||||
|
||||
echo "Getting instance ID"
|
||||
INSTANCE_ID=$(aws ec2 describe-instances --filters "Name=tag:Name,Values=openvidu-${DATESTAMP}" | jq -r ' .Reservations[] | .Instances[] | .InstanceId')
|
||||
|
||||
echo "Stopping the instance"
|
||||
aws ec2 stop-instances --instance-ids ${INSTANCE_ID}
|
||||
|
||||
echo "wait for the instance to stop"
|
||||
aws ec2 wait instance-stopped --instance-ids ${INSTANCE_ID}
|
||||
|
||||
echo "Creating AMI"
|
||||
OV_RAW_AMI_ID=$(aws ec2 create-image --instance-id ${INSTANCE_ID} --name OpenViduServerPro-${OPENVIDU_PRO_VERSION}-${DATESTAMP} --description "Openvidu Server Pro" --output text)
|
||||
|
||||
echo "Cleaning up"
|
||||
aws cloudformation delete-stack --stack-name openvidu-${DATESTAMP}
|
||||
|
||||
# Wait for the instance
|
||||
aws ec2 wait image-available --image-ids ${OV_RAW_AMI_ID}
|
||||
|
||||
# Updating the template
|
||||
if [ ${CF_OVP_TARGET} == "market" ]; then
|
||||
sed "s/OV_AMI_ID/${OV_RAW_AMI_ID}/" cfn-mkt-openvidu-server-pro.yaml.template > cfn-mkt-openvidu-server-pro-${OPENVIDU_PRO_VERSION}.yaml
|
||||
sed -i "s/KMS_AMI_ID/${KMS_RAW_AMI_ID}/g" cfn-mkt-openvidu-server-pro-${OPENVIDU_PRO_VERSION}.yaml
|
||||
else
|
||||
sed "s/OV_AMI_ID/${OV_RAW_AMI_ID}/" cfn-openvidu-server-pro-no-market.yaml.template > cfn-openvidu-server-pro-no-market-${OPENVIDU_PRO_VERSION}.yaml
|
||||
sed -i "s/KMS_AMI_ID/${KMS_RAW_AMI_ID}/g" cfn-openvidu-server-pro-no-market-${OPENVIDU_PRO_VERSION}.yaml
|
||||
fi
|
||||
|
||||
rm $TEMPJSON
|
||||
rm cfn-mkt-kms-ami.yaml
|
||||
rm cfn-mkt-ov-ami.yaml
|
|
@ -0,0 +1,47 @@
|
|||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
|
||||
# Remove the list of AMIs in each region
|
||||
|
||||
export AWS_ACCESS_KEY_ID=
|
||||
export AWS_SECRET_ACCESS_KEY=
|
||||
|
||||
LIST="us-east-2:ami-0b779580e2c11e904
|
||||
us-west-1:ami-085b7176f53c6d7fe
|
||||
us-west-2:ami-029d0ac01cf0f56be
|
||||
ap-south-1:ami-044a9335de8413f90
|
||||
ap-northeast-2:ami-031f6637449d2821d
|
||||
ap-southeast-1:ami-0aba433c88526cc8a
|
||||
ap-southeast-2:ami-0ee526f6103ac2bd9
|
||||
ap-northeast-1:ami-03b3cc03809d43b36
|
||||
ca-central-1:ami-071388f538500db04
|
||||
eu-central-1:ami-080a9cbd1d3e64583
|
||||
eu-west-1:ami-05e6bc185f28b6338
|
||||
eu-west-2:ami-0f06e2c003eef90f1
|
||||
eu-west-3:ami-0fd9b5eaf08fc0936
|
||||
eu-north-1:ami-0e7717a400ba2f1c1
|
||||
sa-east-1:ami-0cd51a71e9791197a
|
||||
us-east-2:ami-0064508c09a32a93f
|
||||
us-west-1:ami-088d1a7099fa57038
|
||||
us-west-2:ami-080d4d462cff92974
|
||||
ap-south-1:ami-00a60b079166e7dd4
|
||||
ap-northeast-2:ami-0f4edc3faf639e044
|
||||
ap-southeast-1:ami-0235dbfa3662608a0
|
||||
ap-southeast-2:ami-0f5f46178512e6e07
|
||||
ap-northeast-1:ami-047b086aa0745ce19
|
||||
ca-central-1:ami-0777b151c44ef9944
|
||||
eu-central-1:ami-00dd31f7b896f233f
|
||||
eu-west-1:ami-0fb9f924ede905546
|
||||
eu-west-2:ami-0defcea3b8c198e1e
|
||||
eu-west-3:ami-0c56da0b482bdf48e
|
||||
eu-north-1:ami-054fc49723d3d516a
|
||||
sa-east-1:ami-0dca8c31325d33c72"
|
||||
|
||||
for line in ${LIST}
|
||||
do
|
||||
REGION=$(echo ${line} | cut -d":" -f1)
|
||||
AMI_ID=$(echo ${line} | cut -d":" -f2)
|
||||
export AWS_DEFAULT_REGION=${REGION}
|
||||
aws ec2 deregister-image --image-id $AMI_ID
|
||||
sleep 1
|
||||
done
|
|
@ -0,0 +1,121 @@
|
|||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
|
||||
# Replicate AMIs in all regions
|
||||
#
|
||||
# Input parameters:
|
||||
#
|
||||
# KMS_AMI_NAME Media server AMI Name
|
||||
# KMS_AMI_ID Media server AMI ID
|
||||
#
|
||||
# OV_AMI_NAME OpenVidu AMI Name
|
||||
# OV_AMI_ID OpenVidu AMI ID
|
||||
|
||||
export AWS_DEFAULT_REGION=eu-west-1
|
||||
if [ ${CF_OVP_TARGET} == "market" ]; then
|
||||
export AWS_ACCESS_KEY_ID=${NAEVA_AWS_ACCESS_KEY_ID}
|
||||
export AWS_SECRET_ACCESS_KEY=${NAEVA_AWS_SECRET_ACCESS_KEY}
|
||||
fi
|
||||
|
||||
echo "Making original AMIs public"
|
||||
|
||||
aws ec2 wait image-exists --image-ids ${OV_AMI_ID}
|
||||
aws ec2 wait image-available --image-ids ${OV_AMI_ID}
|
||||
aws ec2 modify-image-attribute --image-id ${OV_AMI_ID} --launch-permission "Add=[{Group=all}]"
|
||||
|
||||
aws ec2 wait image-exists --image-ids ${KMS_AMI_ID}
|
||||
aws ec2 wait image-available --image-ids ${KMS_AMI_ID}
|
||||
aws ec2 modify-image-attribute --image-id ${KMS_AMI_ID} --launch-permission "Add=[{Group=all}]"
|
||||
|
||||
TARGET_REGIONS="eu-north-1
|
||||
eu-west-3
|
||||
eu-west-2
|
||||
eu-west-1
|
||||
sa-east-1
|
||||
ca-central-1
|
||||
ap-south-1
|
||||
ap-southeast-1
|
||||
ap-southeast-2
|
||||
ap-northeast-1
|
||||
ap-northeast-2
|
||||
ap-east-1
|
||||
eu-central-1
|
||||
us-east-1
|
||||
us-east-2
|
||||
us-west-1
|
||||
us-west-2
|
||||
me-south-1
|
||||
af-south-1"
|
||||
|
||||
OPENVIDU_SERVER_PRO_AMI_IDS=()
|
||||
MEDIA_NODE_AMI_IDS=()
|
||||
REGIONS=()
|
||||
for REGION in ${TARGET_REGIONS}
|
||||
do
|
||||
REGIONS+=($REGION)
|
||||
ID=$(aws ec2 copy-image --name ${OV_AMI_NAME} --source-image-id ${OV_AMI_ID} --source-region ${AWS_DEFAULT_REGION} --region ${REGION} --output text --query 'ImageId')
|
||||
echo "Replicated OpenVidu Server Pro AMI in region ${REGION} with id ${ID}"
|
||||
OPENVIDU_SERVER_PRO_AMI_IDS+=($ID)
|
||||
ID=$(aws ec2 copy-image --name ${KMS_AMI_NAME} --source-image-id ${KMS_AMI_ID} --source-region ${AWS_DEFAULT_REGION} --region ${REGION} --output text --query 'ImageId')
|
||||
echo "Replicated Media Node AMI in region ${REGION} with id ${ID}"
|
||||
MEDIA_NODE_AMI_IDS+=($ID)
|
||||
done
|
||||
|
||||
if [ "${#OPENVIDU_SERVER_PRO_AMI_IDS[@]}" -ne "${#REGIONS[@]}" ]; then
|
||||
echo "The number of elements in array of OpenVidu Server Pro AMI ids and array of regions is not equal"
|
||||
exit 1
|
||||
fi
|
||||
if [ "${#MEDIA_NODE_AMI_IDS[@]}" -ne "${#REGIONS[@]}" ]; then
|
||||
echo "The number of elements in array of Media Node AMI ids and array of regions is not equal"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Waiting for images to be available..."
|
||||
echo "-------------------------------------"
|
||||
ITER=0
|
||||
for i in "${REGIONS[@]}"
|
||||
do
|
||||
REGION=${REGIONS[$ITER]}
|
||||
# OpenVidu Server Pro Node
|
||||
OV_AMI_ID=${OPENVIDU_SERVER_PRO_AMI_IDS[$ITER]}
|
||||
aws ec2 wait image-exists --region ${REGION} --image-ids ${OV_AMI_ID}
|
||||
echo "${OV_AMI_ID} of region ${REGION} exists"
|
||||
aws ec2 wait image-available --region ${REGION} --image-ids ${OV_AMI_ID}
|
||||
echo "${OV_AMI_ID} of region ${REGION} available"
|
||||
aws ec2 modify-image-attribute --region ${REGION} --image-id ${OV_AMI_ID} --launch-permission "Add=[{Group=all}]"
|
||||
echo "${OV_AMI_ID} of region ${REGION} is now public"
|
||||
# Media Node
|
||||
KMS_AMI_ID=${MEDIA_NODE_AMI_IDS[$ITER]}
|
||||
aws ec2 wait image-exists --region ${REGION} --image-ids ${KMS_AMI_ID}
|
||||
echo "${KMS_AMI_ID} of region ${REGION} exists"
|
||||
aws ec2 wait image-available --region ${REGION} --image-ids ${KMS_AMI_ID}
|
||||
echo "${KMS_AMI_ID} of region ${REGION} available"
|
||||
aws ec2 modify-image-attribute --region ${REGION} --image-id ${KMS_AMI_ID} --launch-permission "Add=[{Group=all}]"
|
||||
echo "${KMS_AMI_ID} of region ${REGION} is now public"
|
||||
echo "-------------------------------------"
|
||||
ITER=$(expr $ITER + 1)
|
||||
done
|
||||
|
||||
echo
|
||||
echo "OpenVidu Server Pro Node AMI IDs"
|
||||
ITER=0
|
||||
for i in "${OPENVIDU_SERVER_PRO_AMI_IDS[@]}"
|
||||
do
|
||||
AMI_ID=${OPENVIDU_SERVER_PRO_AMI_IDS[$ITER]}
|
||||
REGION=${REGIONS[$ITER]}
|
||||
echo " ${REGION}:"
|
||||
echo " AMI: ${AMI_ID}"
|
||||
ITER=$(expr $ITER + 1)
|
||||
done
|
||||
|
||||
echo
|
||||
echo "Media Node AMI IDs"
|
||||
ITER=0
|
||||
for i in "${MEDIA_NODE_AMI_IDS[@]}"
|
||||
do
|
||||
AMI_ID=${MEDIA_NODE_AMI_IDS[$ITER]}
|
||||
REGION=${REGIONS[$ITER]}
|
||||
echo " ${REGION}:"
|
||||
echo " AMI: ${AMI_ID}"
|
||||
ITER=$(expr $ITER + 1)
|
||||
done
|
|
@ -0,0 +1,71 @@
|
|||
#!/bin/bash -x
|
||||
set -eu -o pipefail
|
||||
|
||||
# Testing deployment of OpenVidu Server on AWS
|
||||
|
||||
# VARS
|
||||
DOMAIN_NAME=$(pwgen -A -0 10 1)
|
||||
TEMPFILE=$(mktemp -t file-XXX --suffix .json)
|
||||
TEMPJSON=$(mktemp -t cloudformation-XXX --suffix .json)
|
||||
TEMPLATE_FILENAME=$(ls -1 cfn-openvidu-server-pro-no-market-*.yaml )
|
||||
export AWS_DEFAULT_REGION=eu-west-1
|
||||
|
||||
aws s3 cp ${TEMPLATE_FILENAME} s3://aws.openvidu.io/cfn-openvidu-server-pro-no-market-dev.yaml # --acl public-read
|
||||
|
||||
CF_FILE="https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/cfn-openvidu-server-pro-no-market-dev.yaml"
|
||||
|
||||
cat > $TEMPJSON<<EOF
|
||||
[
|
||||
{"ParameterKey":"KeyName","ParameterValue":"nordri-aws-urjc"},
|
||||
{"ParameterKey":"MyDomainName","ParameterValue":"openvidu.mycompany.com"},
|
||||
{"ParameterKey":"PublicElasticIP","ParameterValue":"1.0.2.0"},
|
||||
{"ParameterKey":"OpenViduSecret","ParameterValue":"MY_SECRET"},
|
||||
{"ParameterKey":"KibanaUser","ParameterValue":"kibanaadmin"},
|
||||
{"ParameterKey":"KibanaPassword","ParameterValue":"MY_SECRET"},
|
||||
{"ParameterKey":"WhichCert","ParameterValue":"selfsigned"},
|
||||
{"ParameterKey":"LetsEncryptEmail","ParameterValue":"email@example.com"},
|
||||
{"ParameterKey":"OwnCertCRT","ParameterValue":"AAA"},
|
||||
{"ParameterKey":"OwnCertKEY","ParameterValue":"BBB"},
|
||||
{"ParameterKey":"FreeHTTPAccesToRecordingVideos","ParameterValue":"false"},
|
||||
{"ParameterKey":"OpenviduRecordingNotification","ParameterValue":"publisher_moderator"},
|
||||
{"ParameterKey":"OpenviduStreamsVideoMaxRecvBandwidth","ParameterValue":"0"},
|
||||
{"ParameterKey":"OpenviduStreamsVideoMinRecvBandwidth","ParameterValue":"0"},
|
||||
{"ParameterKey":"OpenviduStreamsVideoMaxSendBandwidth","ParameterValue":"0"},
|
||||
{"ParameterKey":"OpenviduStreamsVideoMinSendBandwidth","ParameterValue":"0"},
|
||||
{"ParameterKey":"OpenViduCidrBlock","ParameterValue":"172.16.0.0/16"},
|
||||
{"ParameterKey":"OpenViduSubnet","ParameterValue":"172.16.0.0/24"},
|
||||
{"ParameterKey":"OpenViduWebhook","ParameterValue":"false"},
|
||||
{"ParameterKey":"OpenViduWebhookEndpoint","ParameterValue":"http://54.154.208.234"},
|
||||
{"ParameterKey":"OpenViduWebhookHeaders","ParameterValue":"Authorization: Basic T1BFTlZJRFVBUFA6TVlfU0VDUkVU"},
|
||||
{"ParameterKey":"KurentoAvailabilityZone","ParameterValue":"eu-west-1a"}
|
||||
]
|
||||
EOF
|
||||
|
||||
aws cloudformation create-stack \
|
||||
--stack-name Openvidu-cluster-selfsigned-${DOMAIN_NAME} \
|
||||
--template-url ${CF_FILE} \
|
||||
--parameters file:///${TEMPJSON} \
|
||||
--disable-rollback \
|
||||
--capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM
|
||||
|
||||
aws cloudformation wait stack-create-complete --stack-name Openvidu-cluster-selfsigned-${DOMAIN_NAME}
|
||||
|
||||
echo "Extracting service URL..."
|
||||
URL=$(aws cloudformation describe-stacks --stack-name Openvidu-cluster-selfsigned-${DOMAIN_NAME} | jq -r '.Stacks[0] | .Outputs[] | select(.OutputKey | contains("OpenViduInspector")) | .OutputValue')
|
||||
|
||||
echo "Checking app up and ready..."
|
||||
RES=$(curl --insecure --location -u OPENVIDUAPP:MY_SECRET --output /dev/null --silent --write-out "%{http_code}\\n" ${URL} | grep "200" | uniq)
|
||||
|
||||
echo "Checking Kibana..."
|
||||
KIBANA_URL=$(aws cloudformation describe-stacks --stack-name Openvidu-cluster-selfsigned-${DOMAIN_NAME} | jq -r '.Stacks[0] | .Outputs[] | select(.OutputKey | contains("Kibana")) | .OutputValue')
|
||||
RES_KIBANA=$(curl --insecure --location -u kibanaadmin:MY_SECRET --output /dev/null --silent --write-out "%{http_code}\\n" ${KIBANA_URL} | grep "^200" | uniq)
|
||||
|
||||
if [ "$RES" != "200" ]; then
|
||||
echo "deployment failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$RES_KIBANA" != "200" ]; then
|
||||
echo "Kibana failed"
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,30 @@
|
|||
# KMS Configuration
|
||||
# --------------------------
|
||||
|
||||
# NOTE: This file doesn't need to quote assignment values, like most shells do.
|
||||
# All values are stored as-is, even if they contain spaces, so don't quote them.
|
||||
|
||||
# Kurento Media Server image
|
||||
# --------------------------
|
||||
# Docker hub kurento media server: https://hub.docker.com/r/kurento/kurento-media-server-dev
|
||||
# Uncomment the next line and define this variable with KMS image that you want use
|
||||
# KMS_IMAGE=kurento/kurento-media-server-dev:6.14.0
|
||||
|
||||
# Kurento Media Server Level logs
|
||||
# -------------------------------
|
||||
# Uncomment the next line and define this variable to change
|
||||
# the verbosity level of the logs of KMS
|
||||
# Documentation: https://doc-kurento.readthedocs.io/en/stable/features/logging.html
|
||||
# KMS_DEBUG_LEVEL=3,Kurento*:4,kms*:4,sdp*:4,webrtc*:4,*rtpendpoint:4,rtp*handler:4,rtpsynchronizer:4,agnosticbin:4
|
||||
|
||||
# Metricbeat ElasticSearch Image
|
||||
# -------------------------------
|
||||
# Docker hub kurento media server: https://www.docker.elastic.co/
|
||||
# Uncomment the next line and define this variable with METRICBEAT_IMAGE image that you want use
|
||||
# METRICBEAT_IMAGE=docker.elastic.co/beats/metricbeat:7.8.0
|
||||
|
||||
# FileBeat ElasticSearch Image
|
||||
# -------------------------------
|
||||
# Docker hub kurento media server: https://www.docker.elastic.co/
|
||||
# Uncomment the next line and define this variable with FILEBEAT_IMAGE image that you want use
|
||||
# FILEBEAT_IMAGE=docker.elastic.co/beats/filebeat:7.8.0
|
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
echo "Creating dir for beats"
|
||||
mkdir -p /opt/openvidu/beats
|
||||
echo "Copying beat config files"
|
||||
cp /beats/filebeat.yml /opt/openvidu/beats/filebeat.yml
|
||||
cp /beats/metricbeat-elasticsearch.yml /opt/openvidu/beats/metricbeat-elasticsearch.yml
|
||||
cp /beats/metricbeat-openvidu.yml /opt/openvidu/beats/metricbeat-openvidu.yml
|
|
@ -0,0 +1,41 @@
|
|||
filebeat.inputs:
|
||||
- type: container
|
||||
paths:
|
||||
- '/var/lib/docker/containers/*/*.log'
|
||||
multiline.pattern: '^\d*:\d*:\d*'
|
||||
multiline.negate: true
|
||||
multiline.match: after
|
||||
|
||||
processors:
|
||||
- add_docker_metadata:
|
||||
host: "unix:///var/run/docker.sock"
|
||||
- add_host_metadata:
|
||||
netinfo.enabled: true
|
||||
|
||||
- decode_json_fields:
|
||||
fields: ["message"]
|
||||
target: "json"
|
||||
overwrite_keys: true
|
||||
- add_fields:
|
||||
fields:
|
||||
ip: ${MEDIA_NODE_IP}
|
||||
|
||||
|
||||
output:
|
||||
elasticsearch:
|
||||
hosts: ["${OPENVIDU_SERVER_PRO_IP}:9200"]
|
||||
indices:
|
||||
- index: "filebeat-kurento-%{+yyyy.MM.dd}"
|
||||
when.or:
|
||||
- contains:
|
||||
container.image.name: kurento/kurento-media-server
|
||||
pipelines:
|
||||
- pipeline: kurento-pipeline
|
||||
when.or:
|
||||
- contains:
|
||||
container.image.name: kurento/kurento-media-server
|
||||
|
||||
logging.json: true
|
||||
logging.metrics.enabled: false
|
||||
setup.ilm.enabled: true
|
||||
setup.ilm.policy_name: "openvidu_cleanup_policy"
|
|
@ -0,0 +1,14 @@
|
|||
output:
|
||||
elasticsearch:
|
||||
hosts: ["${OPENVIDU_SERVER_PRO_IP}:9200"]
|
||||
metricbeat.modules:
|
||||
- module: system
|
||||
metricsets: [cpu]
|
||||
enabled: true
|
||||
period: ${OPENVIDU_PRO_CLUSTER_LOAD_INTERVAL}s
|
||||
processes: ['.*']
|
||||
cpu.metrics: [normalized_percentages]
|
||||
fields: {ip: "${MEDIA_NODE_IP}"}
|
||||
pipeline:
|
||||
queue.mem.events: 0
|
||||
setup.ilm.enabled: false
|
|
@ -0,0 +1,12 @@
|
|||
output:
|
||||
logstash.hosts: ["${OPENVIDU_SERVER_PRO_IP}:5044"]
|
||||
metricbeat.modules:
|
||||
- module: system
|
||||
metricsets: [cpu]
|
||||
enabled: true
|
||||
period: ${OPENVIDU_PRO_CLUSTER_LOAD_INTERVAL}s
|
||||
processes: ['.*']
|
||||
cpu.metrics: [normalized_percentages]
|
||||
fields: {ip: "${MEDIA_NODE_IP}"}
|
||||
pipeline:
|
||||
queue.mem.events: 0
|
|
@ -0,0 +1,35 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# DO NOT MODIFY THIS FILE !!!
|
||||
#
|
||||
# Configuration properties should be specified in .env file
|
||||
#
|
||||
# This docker-compose file coordinates all services of OpenVidu CE Platform.
|
||||
#
|
||||
# Openvidu Version: 2.15.0
|
||||
#
|
||||
# Installation Mode: On Premises
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
media-node-controller:
|
||||
image: openvidu/media-node-controller:1.0.0
|
||||
restart: always
|
||||
ulimits:
|
||||
core: -1
|
||||
entrypoint: ['/bin/sh', '-c', '/beats/copy_config_files.sh && /usr/local/bin/entrypoint.sh']
|
||||
environment:
|
||||
- KMS_IMAGE=${KMS_IMAGE:-kurento/kurento-media-server:6.14.0}
|
||||
- KMS_DEBUG_LEVEL=${KMS_DEBUG_LEVEL:-}
|
||||
- METRICBEAT_IMAGE=${METRICBEAT_IMAGE:-docker.elastic.co/beats/metricbeat:7.8.0}
|
||||
- FILEBEAT_IMAGE=${FILEBEAT_IMAGE:-docker.elastic.co/beats/filebeat:7.8.0}
|
||||
ports:
|
||||
- 3000:3000
|
||||
volumes:
|
||||
- /opt/openvidu/recordings:/opt/openvidu/recordings
|
||||
- /opt/openvidu/beats:/opt/openvidu/beats
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./beats:/beats
|
|
@ -0,0 +1,313 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
MEDIA_NODE_FOLDER=kms
|
||||
MEDIA_NODE_VERSION=master
|
||||
BEATS_FOLDER=${MEDIA_NODE_FOLDER}/beats
|
||||
DOWNLOAD_URL=https://raw.githubusercontent.com/OpenVidu/openvidu/${MEDIA_NODE_VERSION}
|
||||
fatal_error() {
|
||||
printf "\n =======¡ERROR!======="
|
||||
printf "\n %s" "$1"
|
||||
printf "\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
new_media_node_installation() {
|
||||
printf '\n'
|
||||
printf '\n ======================================='
|
||||
printf '\n Install Media Node %s' "${MEDIA_NODE_VERSION}"
|
||||
printf '\n ======================================='
|
||||
printf '\n'
|
||||
|
||||
# Create kms folder
|
||||
printf '\n => Creating folder '%s'...' "${MEDIA_NODE_FOLDER}"
|
||||
mkdir "${MEDIA_NODE_FOLDER}" || fatal_error "Error while creating the folder '${MEDIA_NODE_FOLDER}'"
|
||||
|
||||
# Create beats folder
|
||||
printf '\n => Creating folder '%s'...' "${BEATS_FOLDER}"
|
||||
mkdir "${BEATS_FOLDER}" || fatal_error "Error while creating the folder 'beats'"
|
||||
|
||||
# Download necessaries files
|
||||
printf '\n => Downloading Media Node files:'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/docker-compose.yml \
|
||||
--output "${MEDIA_NODE_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/.env \
|
||||
--output "${MEDIA_NODE_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/media_node \
|
||||
--output "${MEDIA_NODE_FOLDER}/media_node" || fatal_error "Error when downloading the file 'media_node'"
|
||||
printf '\n - media_node'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/filebeat.yml \
|
||||
--output "${BEATS_FOLDER}/filebeat.yml" || fatal_error "Error when downloading the file 'filebeat.yml'"
|
||||
printf '\n - filebeat.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/metricbeat-elasticsearch.yml \
|
||||
--output "${BEATS_FOLDER}/metricbeat-elasticsearch.yml" || fatal_error "Error when downloading the file 'metricbeat-elasticsearch.yml'"
|
||||
printf '\n - metricbeat-elasticsearch.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/metricbeat-openvidu.yml \
|
||||
--output "${BEATS_FOLDER}/metricbeat-openvidu.yml" || fatal_error "Error when downloading the file 'metricbeat-openvidu.yml'"
|
||||
printf '\n - metricbeat-openvidu.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/copy_config_files.sh \
|
||||
--output "${BEATS_FOLDER}/copy_config_files.sh" || fatal_error "Error when downloading the file 'copy_config_files.sh'"
|
||||
printf '\n - copy_config_files.sh'
|
||||
|
||||
# Add execution permissions
|
||||
printf "\n => Adding permission to 'media_node' program..."
|
||||
chmod +x "${MEDIA_NODE_FOLDER}/media_node" || fatal_error "Error while adding permission to 'media_node' program"
|
||||
|
||||
# Add execution permissions
|
||||
printf "\n => Adding permission to 'copy_config_files.sh' script..."
|
||||
chmod +x "${MEDIA_NODE_FOLDER}/beats/copy_config_files.sh" || fatal_error "Error while adding permission to 'copy_config_files.sh' script"
|
||||
|
||||
# Pull images
|
||||
printf "\n => Pulling images...\n"
|
||||
cd "${MEDIA_NODE_FOLDER}" || fatal_error "Error when moving to '${MEDIA_NODE_FOLDER}' folder"
|
||||
KMS_IMAGE=$(cat docker-compose.yml | grep KMS_IMAGE | sed 's/\(^.*KMS_IMAGE:-\)\(.*\)\(\}.*$\)/\2/')
|
||||
METRICBEAT_IMAGE=$(cat docker-compose.yml | grep METRICBEAT_IMAGE | sed 's/\(^.*METRICBEAT_IMAGE:-\)\(.*\)\(\}.*$\)/\2/')
|
||||
FILEBEAT_IMAGE=$(cat docker-compose.yml | grep FILEBEAT_IMAGE | sed 's/\(^.*FILEBEAT_IMAGE:-\)\(.*\)\(\}.*$\)/\2/')
|
||||
docker pull $KMS_IMAGE || fatal "Error while pulling docker image: $KMS_IMAGE"
|
||||
docker pull $METRICBEAT_IMAGE || fatal "Error while pulling docker image: $METRICBEAT_IMAGE"
|
||||
docker pull $FILEBEAT_IMAGE || fatal "Error while pulling docker image: $FILEBEAT_IMAGE"
|
||||
docker-compose pull | true
|
||||
|
||||
# Ready to use
|
||||
printf "\n"
|
||||
printf '\n ======================================='
|
||||
printf "\n Media Node successfully installed."
|
||||
printf '\n ======================================='
|
||||
printf "\n"
|
||||
printf '\n 1. Go to kms folder:'
|
||||
printf '\n $ cd kms'
|
||||
printf "\n"
|
||||
printf '\n 2. Start Media Node Controller'
|
||||
printf '\n $ ./media_node start'
|
||||
printf '\n'
|
||||
printf "\n For more information, check:"
|
||||
printf "\n https://docs.openvidu.io/en/${OPENVIDU_VERSION//v}/openvidu-pro/deployment/on-premises/#deployment-instructions"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
exit 0
|
||||
}
|
||||
|
||||
upgrade_media_node() {
|
||||
# Search local Openvidu installation
|
||||
printf '\n'
|
||||
printf '\n ============================================'
|
||||
printf '\n Search Previous Installation of Media Node'
|
||||
printf '\n ============================================'
|
||||
printf '\n'
|
||||
|
||||
SEARCH_IN_FOLDERS=(
|
||||
"${PWD}"
|
||||
"/opt/${MEDIA_NODE_FOLDER}"
|
||||
)
|
||||
|
||||
for folder in "${SEARCH_IN_FOLDERS[@]}"; do
|
||||
printf "\n => Searching in '%s' folder..." "${folder}"
|
||||
|
||||
if [ -f "${folder}/docker-compose.yml" ]; then
|
||||
MEDIA_NODE_PREVIOUS_FOLDER="${folder}"
|
||||
|
||||
printf "\n => Found installation in folder '%s'" "${folder}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -z "${MEDIA_NODE_PREVIOUS_FOLDER}" ] && fatal_error "No previous Media Node installation found"
|
||||
|
||||
# Uppgrade Media Node
|
||||
OPENVIDU_PREVIOUS_VERSION=$(grep 'Openvidu Version:' "${MEDIA_NODE_PREVIOUS_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
|
||||
[ -z "${OPENVIDU_PREVIOUS_VERSION}" ] && OPENVIDU_PREVIOUS_VERSION=2.14.0
|
||||
|
||||
# In this point using the variable 'OPENVIDU_PREVIOUS_VERSION' we can verify if the upgrade is
|
||||
# posible or not. If it is not posible launch a warning and stop the upgrade.
|
||||
|
||||
printf '\n'
|
||||
printf '\n ======================================='
|
||||
printf '\n Upgrade Media Node %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${MEDIA_NODE_VERSION}"
|
||||
printf '\n ======================================='
|
||||
printf '\n'
|
||||
|
||||
ROLL_BACK_FOLDER="${MEDIA_NODE_PREVIOUS_FOLDER}/.old-${OPENVIDU_PREVIOUS_VERSION}"
|
||||
TMP_FOLDER="${MEDIA_NODE_PREVIOUS_FOLDER}/tmp"
|
||||
ACTUAL_FOLDER="$PWD"
|
||||
|
||||
printf "\n Creating roll back folder '%s'..." ".old-${OPENVIDU_PREVIOUS_VERSION}"
|
||||
mkdir "${ROLL_BACK_FOLDER}" || fatal_error "Error while creating the folder '.old-${OPENVIDU_PREVIOUS_VERSION}'"
|
||||
|
||||
printf "\n Creating temporal folder 'tmp'..."
|
||||
mkdir "${TMP_FOLDER}" || fatal_error "Error while creating the folder 'temporal'"
|
||||
|
||||
# Download necessaries files
|
||||
printf '\n => Downloading new Media Node files:'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/docker-compose.yml \
|
||||
--output "${TMP_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/.env \
|
||||
--output "${TMP_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/media_node \
|
||||
--output "${TMP_FOLDER}/media_node" || fatal_error "Error when downloading the file 'media_node'"
|
||||
printf '\n - media_node'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/filebeat.yml \
|
||||
--output "${TMP_FOLDER}/filebeat.yml" || fatal_error "Error when downloading the file 'filebeat.yml'"
|
||||
printf '\n - filebeat.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/metricbeat-elasticsearch.yml \
|
||||
--output "${TMP_FOLDER}/metricbeat-elasticsearch.yml" || fatal_error "Error when downloading the file 'metricbeat-elasticsearch.yml'"
|
||||
printf '\n - metricbeat-elasticsearch.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/metricbeat-openvidu.yml \
|
||||
--output "${TMP_FOLDER}/metricbeat-openvidu.yml" || fatal_error "Error when downloading the file 'metricbeat-openvidu.yml'"
|
||||
printf '\n - metricbeat-openvidu.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/media-node/beats/copy_config_files.sh \
|
||||
--output "${TMP_FOLDER}/copy_config_files.sh" || fatal_error "Error when downloading the file 'copy_config_files.sh'"
|
||||
printf '\n - copy_config_files.sh'
|
||||
|
||||
# Dowloading new images and stoped actual Media Node
|
||||
printf '\n => Dowloading new images...'
|
||||
printf '\n'
|
||||
sleep 1
|
||||
|
||||
printf "\n => Moving to 'tmp' folder..."
|
||||
printf '\n'
|
||||
|
||||
# Pull images
|
||||
printf "\n => Pulling images...\n"
|
||||
cd "${TMP_FOLDER}" || fatal_error "Error when moving to '${TMP_FOLDER}' folder"
|
||||
KMS_IMAGE=$(cat docker-compose.yml | grep KMS_IMAGE | sed 's/\(^.*KMS_IMAGE:-\)\(.*\)\(\}.*$\)/\2/')
|
||||
METRICBEAT_IMAGE=$(cat docker-compose.yml | grep METRICBEAT_IMAGE | sed 's/\(^.*METRICBEAT_IMAGE:-\)\(.*\)\(\}.*$\)/\2/')
|
||||
FILEBEAT_IMAGE=$(cat docker-compose.yml | grep FILEBEAT_IMAGE | sed 's/\(^.*FILEBEAT_IMAGE:-\)\(.*\)\(\}.*$\)/\2/')
|
||||
docker pull $KMS_IMAGE || fatal "Error while pulling docker image: $KMS_IMAGE"
|
||||
docker pull $METRICBEAT_IMAGE || fatal "Error while pulling docker image: $METRICBEAT_IMAGE"
|
||||
docker pull $FILEBEAT_IMAGE || fatal "Error while pulling docker image: $FILEBEAT_IMAGE"
|
||||
docker-compose pull | true
|
||||
|
||||
printf '\n => Stoping Media Node...'
|
||||
printf '\n'
|
||||
sleep 1
|
||||
|
||||
printf "\n => Moving to 'openvidu' folder..."
|
||||
printf '\n'
|
||||
cd "${MEDIA_NODE_PREVIOUS_FOLDER}" || fatal_error "Error when moving to 'openvidu' folder"
|
||||
docker-compose down | true
|
||||
|
||||
printf '\n'
|
||||
printf '\n => Moving to working dir...'
|
||||
cd "${ACTUAL_FOLDER}" || fatal_error "Error when moving to working dir"
|
||||
|
||||
# Move old files to roll back folder
|
||||
printf '\n => Moving previous installation files to rollback folder:'
|
||||
|
||||
mv "${MEDIA_NODE_PREVIOUS_FOLDER}/docker-compose.yml" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
mv "${MEDIA_NODE_PREVIOUS_FOLDER}/media_node" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'openvidu'"
|
||||
printf '\n - media_node'
|
||||
|
||||
mv "${MEDIA_NODE_PREVIOUS_FOLDER}/readme.md" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'readme.md'"
|
||||
printf '\n - readme.md'
|
||||
|
||||
mv "${MEDIA_NODE_PREVIOUS_FOLDER}/nginx_conf" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'nginx_conf'"
|
||||
printf '\n - nginx_conf'
|
||||
|
||||
cp "${MEDIA_NODE_PREVIOUS_FOLDER}/.env" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
# Move tmp files to Openvidu
|
||||
printf '\n => Updating files:'
|
||||
|
||||
mv "${TMP_FOLDER}/docker-compose.yml" "${MEDIA_NODE_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
mv "${TMP_FOLDER}/.env" "${MEDIA_NODE_PREVIOUS_FOLDER}/.env-${MEDIA_NODE_VERSION}" || fatal_error "Error while moving previous '.env'"
|
||||
printf '\n - .env-%s' "${MEDIA_NODE_VERSION}"
|
||||
|
||||
mv "${TMP_FOLDER}/media_node" "${MEDIA_NODE_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'media_node'"
|
||||
printf '\n - media_node'
|
||||
|
||||
mkdir "${MEDIA_NODE_PREVIOUS_FOLDER}/beats" || fatal_error "Error while creating the folder 'beats'"
|
||||
|
||||
mv "${TMP_FOLDER}/filebeat.yml" "${MEDIA_NODE_PREVIOUS_FOLDER}/beats" || fatal_error "Error while updating 'filebeat.yml'"
|
||||
printf '\n - filebeat.yml'
|
||||
|
||||
mv "${TMP_FOLDER}/metricbeat-elasticsearch.yml" "${MEDIA_NODE_PREVIOUS_FOLDER}/beats" || fatal_error "Error while updating 'metricbeat-elasticsearch.yml'"
|
||||
printf '\n - metricbeat-elasticsearch.yml'
|
||||
|
||||
mv "${TMP_FOLDER}/metricbeat-openvidu.yml" "${MEDIA_NODE_PREVIOUS_FOLDER}/beats" || fatal_error "Error while updating 'metricbeat-openvidu.yml'"
|
||||
printf '\n - metricbeat-openvidu.yml'
|
||||
|
||||
mv "${TMP_FOLDER}/copy_config_files.sh" "${MEDIA_NODE_PREVIOUS_FOLDER}/beats" || fatal_error "Error while updating 'copy_config_files.sh'"
|
||||
printf '\n - copy_config_files.sh'
|
||||
|
||||
printf "\n => Deleting 'tmp' folder"
|
||||
rm -rf "${TMP_FOLDER}" || fatal_error "Error deleting 'tmp' folder"
|
||||
|
||||
# Add execution permissions
|
||||
printf "\n => Adding permission to 'media_node' program..."
|
||||
chmod +x "${MEDIA_NODE_PREVIOUS_FOLDER}/media_node" || fatal_error "Error while adding permission to 'media_node' program"
|
||||
|
||||
# Add execution permissions
|
||||
printf "\n => Adding permission to 'copy_config_files.sh' script..."
|
||||
chmod +x "${MEDIA_NODE_PREVIOUS_FOLDER}/beats/copy_config_files.sh" || fatal_error "Error while adding permission to 'copy_config_files.sh' script"
|
||||
|
||||
# Define old mode: On Premise or Cloud Formation
|
||||
OLD_MODE=$(grep -E "Installation Mode:.*$" "${ROLL_BACK_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
|
||||
[ ! -z "${OLD_MODE}" ] && sed -i -r "s/Installation Mode:.+/Installation Mode: ${OLD_MODE}/" "${MEDIA_NODE_PREVIOUS_FOLDER}/docker-compose.yml"
|
||||
|
||||
# Ready to use
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf '\n ================================================'
|
||||
printf "\n Openvidu successfully upgraded to version %s" "${OPENVIDU_VERSION}"
|
||||
printf '\n ================================================'
|
||||
printf '\n'
|
||||
printf "\n 1. A new file 'docker-compose.yml' has been created with the new OpenVidu %s services" "${OPENVIDU_VERSION}"
|
||||
printf '\n'
|
||||
printf "\n 2. The previous file '.env' remains intact, but a new file '.env-%s' has been created." "${OPENVIDU_VERSION}"
|
||||
printf "\n Transfer any configuration you wish to keep in the upgraded version from '.env' to '.env-%s'." "${OPENVIDU_VERSION}"
|
||||
printf "\n When you are OK with it, rename and leave as the only '.env' file of the folder the new '.env-%s'." "${OPENVIDU_VERSION}"
|
||||
printf '\n'
|
||||
printf '\n 3. Start new version of Media Node'
|
||||
printf '\n $ ./media_node start'
|
||||
printf '\n'
|
||||
printf "\n If you want to rollback, all the files from the previous installation have been copied to folder '.old-%s'" "${OPENVIDU_PREVIOUS_VERSION}"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
# Check docker and docker-compose installation
|
||||
if ! command -v docker > /dev/null; then
|
||||
echo "You don't have docker installed, please install it and re-run the command"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v docker-compose > /dev/null; then
|
||||
echo "You don't have docker-compose installed, please install it and re-run the command"
|
||||
exit 0
|
||||
else
|
||||
COMPOSE_VERSION=$(docker-compose version --short | sed "s/-rc[0-9]*//")
|
||||
if ! printf '%s\n%s\n' "1.24" "$COMPOSE_VERSION" | sort -V -C; then
|
||||
echo "You need a docker-compose version equal or higher than 1.24, please update your docker-compose and re-run the command"; \
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check type of installation
|
||||
if [[ ! -z "$1" && "$1" == "upgrade" ]]; then
|
||||
upgrade_media_node
|
||||
else
|
||||
new_media_node_installation
|
||||
fi
|
|
@ -0,0 +1,251 @@
|
|||
#!/bin/bash
|
||||
|
||||
upgrade_media_node() {
|
||||
UPGRADE_SCRIPT_URL="https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/install_media_node_OVVERSION.sh"
|
||||
HTTP_STATUS=$(curl -s -o /dev/null -I -w "%{http_code}" ${UPGRADE_SCRIPT_URL//OVVERSION/$1})
|
||||
|
||||
printf " => Upgrading Media Node to '%s' version" "$1"
|
||||
|
||||
if [ "$HTTP_STATUS" == "200" ]; then
|
||||
printf "\n => Downloading and upgrading new version"
|
||||
printf "\n"
|
||||
|
||||
curl --silent ${UPGRADE_SCRIPT_URL//OVVERSION/$1} | bash -s upgrade
|
||||
else
|
||||
printf "\n =======¡ERROR!======="
|
||||
printf "\n Media Node Version %s not exist" "$1"
|
||||
printf "\n"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
collect_basic_information() {
|
||||
LINUX_VERSION=$(lsb_release -d)
|
||||
DOCKER_PS=$(docker ps)
|
||||
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}')
|
||||
DOCKER_COMPOSE_VERSION=$(docker-compose version --short)
|
||||
MEDIA_NODE_FOLDER="${PWD}"
|
||||
OV_VERSION=$(grep 'Openvidu Version:' "${MEDIA_NODE_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
|
||||
OV_TYPE_INSTALLATION=$(grep 'Installation Mode:' "${MEDIA_NODE_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
|
||||
TREE_OV_DIRECTORY=$(find "." | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/")
|
||||
}
|
||||
|
||||
version_ov() {
|
||||
collect_basic_information
|
||||
|
||||
printf '\nMedia Node Information:'
|
||||
printf '\n'
|
||||
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
|
||||
printf '\n Openvidu Version: %s' "${OV_VERSION}"
|
||||
printf '\n'
|
||||
printf '\nSystem Information:'
|
||||
printf '\n'
|
||||
printf '\n Linux Version:'
|
||||
printf '\n - %s' "${LINUX_VERSION}"
|
||||
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
|
||||
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
|
||||
printf '\n'
|
||||
printf '\nInstallation Information:'
|
||||
printf '\n'
|
||||
printf '\n Installation Folder: %s' "${MEDIA_NODE_FOLDER}"
|
||||
printf '\n Installation Folder Tree:'
|
||||
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
printf '\nDocker Running Services:'
|
||||
printf '\n'
|
||||
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
generate_report() {
|
||||
collect_basic_information
|
||||
|
||||
REPORT_CREATION_DATE=$(date +"%d-%m-%Y")
|
||||
REPORT_CREATION_TIME=$(date +"%H:%M:%S")
|
||||
REPORT_NAME="media-node-report-${REPORT_CREATION_DATE}-$(date +"%H-%M").txt"
|
||||
REPORT_OUPUT="${MEDIA_NODE_FOLDER}/${REPORT_NAME}"
|
||||
CONTAINERS=$(docker ps | awk '{if(NR>1) print $NF}')
|
||||
|
||||
{
|
||||
printf "\n ======================================="
|
||||
printf "\n = REPORT INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Creation Date: %s' "${REPORT_CREATION_DATE}"
|
||||
printf '\n Creation Time: %s' "${REPORT_CREATION_TIME}"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = MEDIA NODE INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
|
||||
printf '\n Openvidu Version: %s' "${OV_VERSION}"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = SYSTEM INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Linux Version:'
|
||||
printf '\n - %s' "${LINUX_VERSION}"
|
||||
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
|
||||
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = INSTALLATION INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Installation Folder: %s' "${MEDIA_NODE_FOLDER}"
|
||||
printf '\n Installation Folder Tree:'
|
||||
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = DOCKER RUNNING SERVICES ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = CONFIGURATION FILES ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n ================ .env ================='
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
||||
cat < "${MEDIA_NODE_FOLDER}/.env"
|
||||
|
||||
printf '\n'
|
||||
printf '\n ========= docker-compose.yml =========='
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
||||
cat "${MEDIA_NODE_FOLDER}/docker-compose.yml"
|
||||
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = LOGS ="
|
||||
printf "\n ======================================="
|
||||
|
||||
for CONTAINER in $CONTAINERS
|
||||
do
|
||||
printf '\n'
|
||||
printf "\n ---------------------------------------"
|
||||
printf "\n %s" $CONTAINER
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
docker logs $CONTAINER
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
done
|
||||
|
||||
printf "\n ======================================="
|
||||
printf "\n = CONTAINER ENVS VARIABLES ="
|
||||
printf "\n ======================================="
|
||||
|
||||
for CONTAINER in $CONTAINERS
|
||||
do
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n %s" $CONTAINER
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
docker exec $CONTAINER env
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
done
|
||||
|
||||
} >> "${REPORT_OUPUT}" 2>&1
|
||||
|
||||
printf "\n Generation of the report completed with success"
|
||||
printf "\n You can get your report at path '%s'" "${REPORT_OUPUT}"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
usage() {
|
||||
printf "Usage: \n\t media_node [command]"
|
||||
printf "\n\nAvailable Commands:"
|
||||
printf "\n\tstart\t\t\tStart media node service"
|
||||
printf "\n\tstop\t\t\tStop media node service"
|
||||
printf "\n\trestart\t\t\tRestart media node service"
|
||||
printf "\n\tlogs\t\t\tShow media node logs"
|
||||
printf "\n\tupgrade\t\t\tUpgrade to the lastest Media Node version"
|
||||
printf "\n\tupgrade [version]\tUpgrade to the specific Media Node version"
|
||||
printf "\n\tversion\t\t\tShow version of Media Node"
|
||||
printf "\n\treport\t\t\tGenerate a report with the current status of Media Node"
|
||||
printf "\n\thelp\t\t\tShow help for media node command"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
stop_containers() {
|
||||
CONTAINERS=$(docker ps | awk '{if(NR>1) print $NF}')
|
||||
for CONTAINER in $CONTAINERS
|
||||
do
|
||||
[ "$(docker ps -a | grep ${CONTAINER})" ] && docker stop ${CONTAINER}
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
||||
start)
|
||||
docker-compose up -d
|
||||
docker-compose logs -f media-node-controller
|
||||
;;
|
||||
|
||||
stop)
|
||||
docker-compose down
|
||||
stop_containers
|
||||
;;
|
||||
|
||||
restart)
|
||||
docker-compose down
|
||||
stop_containers
|
||||
docker-compose up -d
|
||||
docker-compose logs -f media-node-controller
|
||||
;;
|
||||
|
||||
logs)
|
||||
docker-compose logs -f media-node-controller
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
if [ -z "$2" ]; then
|
||||
UPGRADE_VERSION="latest"
|
||||
else
|
||||
UPGRADE_VERSION="$2"
|
||||
fi
|
||||
|
||||
read -r -p " You're about to update Media Node to '${UPGRADE_VERSION}' version. Are you sure? [y/N]: " response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
upgrade_media_node "${UPGRADE_VERSION}"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
version)
|
||||
version_ov
|
||||
;;
|
||||
|
||||
report)
|
||||
read -r -p " You are about to generate a report on the current status of Media Node, this may take some time. Do you want to continue? [y/N]: " response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
generate_report
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,245 @@
|
|||
# OpenVidu configuration
|
||||
# ----------------------
|
||||
# Documentation: https://docs.openvidu.io/en/stable/reference-docs/openvidu-config/
|
||||
|
||||
# NOTE: This file doesn't need to quote assignment values, like most shells do.
|
||||
# All values are stored as-is, even if they contain spaces, so don't quote them.
|
||||
|
||||
# Domain name. If you do not have one, the public IP of the machine.
|
||||
# For example: 198.51.100.1, or openvidu.example.com
|
||||
DOMAIN_OR_PUBLIC_IP=
|
||||
|
||||
# OpenVidu PRO License
|
||||
OPENVIDU_PRO_LICENSE=
|
||||
|
||||
# OpenVidu SECRET used for apps to connect to OpenVidu server and users to access to OpenVidu Dashboard
|
||||
OPENVIDU_SECRET=
|
||||
|
||||
# Certificate type:
|
||||
# - selfsigned: Self signed certificate. Not recommended for production use.
|
||||
# Users will see an ERROR when connected to web page.
|
||||
# - owncert: Valid certificate purchased in a Internet services company.
|
||||
# Please put the certificates files inside folder ./owncert
|
||||
# with names certificate.key and certificate.cert
|
||||
# - letsencrypt: Generate a new certificate using letsencrypt. Please set the
|
||||
# required contact email for Let's Encrypt in LETSENCRYPT_EMAIL
|
||||
# variable.
|
||||
CERTIFICATE_TYPE=selfsigned
|
||||
|
||||
# If CERTIFICATE_TYPE=letsencrypt, you need to configure a valid email for notifications
|
||||
LETSENCRYPT_EMAIL=user@example.com
|
||||
|
||||
# Proxy configuration
|
||||
# If you want to change the ports on which openvidu listens, uncomment the following lines
|
||||
|
||||
# Allows any request to http://DOMAIN_OR_PUBLIC_IP:HTTP_PORT/ to be automatically
|
||||
# redirected to https://DOMAIN_OR_PUBLIC_IP:HTTPS_PORT/.
|
||||
# WARNING: the default port 80 cannot be changed during the first boot
|
||||
# if you have chosen to deploy with the option CERTIFICATE_TYPE=letsencrypt
|
||||
# HTTP_PORT=80
|
||||
|
||||
# Changes the port of all services exposed by OpenVidu.
|
||||
# SDKs, REST clients and browsers will have to connect to this port
|
||||
# HTTPS_PORT=443
|
||||
|
||||
# Access restrictions
|
||||
# In this section you will be able to restrict the IPs from which you can access to
|
||||
# Openvidu API and the Administration Panel
|
||||
# WARNING! If you touch this configuration you can lose access to the platform from some IPs.
|
||||
# Use it carefully.
|
||||
|
||||
# This section limits access to the /dashboard (OpenVidu CE) and /inspector (OpenVidu Pro) pages.
|
||||
# The form for a single IP or an IP range is:
|
||||
# ALLOWED_ACCESS_TO_DASHBOARD=198.51.100.1 and ALLOWED_ACCESS_TO_DASHBOARD=198.51.100.0/24
|
||||
# To limit multiple IPs or IP ranges, separate by commas like this:
|
||||
# ALLOWED_ACCESS_TO_DASHBOARD=198.51.100.1, 198.51.100.0/24
|
||||
# ALLOWED_ACCESS_TO_DASHBOARD=
|
||||
|
||||
# This section limits access to the Openvidu REST API.
|
||||
# The form for a single IP or an IP range is:
|
||||
# ALLOWED_ACCESS_TO_RESTAPI=198.51.100.1 and ALLOWED_ACCESS_TO_RESTAPI=198.51.100.0/24
|
||||
# To limit multiple IPs or or IP ranges, separate by commas like this:
|
||||
# ALLOWED_ACCESS_TO_RESTAPI=198.51.100.1, 198.51.100.0/24
|
||||
# ALLOWED_ACCESS_TO_RESTAPI=
|
||||
|
||||
# Mode of cluster management. Can be auto (OpenVidu manages Media Nodes on its own.
|
||||
# Parameter KMS_URIS is ignored) or manual (user must manage Media Nodes. Parameter
|
||||
# KMS_URIS is used: if any uri is provided it must be valid)
|
||||
OPENVIDU_PRO_CLUSTER_MODE=manual
|
||||
|
||||
# Which environment are you using
|
||||
# Possibles values: aws, on_premise
|
||||
OPENVIDU_PRO_CLUSTER_ENVIRONMENT=on_premise
|
||||
|
||||
# The desired number of Media Nodes on startup. First the autodiscovery process is performed.
|
||||
# If there are too many Media Nodes after that, they will be dropped until this number is reached.
|
||||
# If there are not enough, more will be launched.
|
||||
# This only takes place if OPENVIDU_PRO_CLUSTER_MODE is set to auto
|
||||
# If set to zero no media servers will be lauched.
|
||||
# Type: number >= 0
|
||||
#OPENVIDU_PRO_CLUSTER_MEDIA_NODES=
|
||||
|
||||
# How often each running Media Node will send OpenVidu Server Pro Node load metrics, in seconds.
|
||||
# This property is only used when OPENVIDU_PRO_CLUSTER_LOAD_STRATEGY is 'cpu'. Other load strategies
|
||||
# gather information synchronously when required
|
||||
# Type: number >= 0
|
||||
# OPENVIDU_PRO_CLUSTER_LOAD_INTERVAL=
|
||||
|
||||
|
||||
# Whether to enable or disable autoscaling. With autoscaling the number of Media Nodes will
|
||||
# be automatically adjusted according to existing load
|
||||
# Values: true | false
|
||||
OPENVIDU_PRO_CLUSTER_AUTOSCALING=false
|
||||
|
||||
# How often the autoscaling algorithm runs, in seconds
|
||||
# Type number >= 0
|
||||
# OPENVIDU_PRO_CLUSTER_AUTOSCALING_INTERVAL=
|
||||
|
||||
# If autoscaling is enabled, the upper limit of Media Nodes that can be reached.
|
||||
# Even when the average load exceeds the threshold, no more Media Nodes will be added to cluster
|
||||
# Type number >= 0
|
||||
# OPENVIDU_PRO_CLUSTER_AUTOSCALING_MAX_NODES=
|
||||
|
||||
# If autoscaling is enabled, the lower limit of Media Nodes that can be reached.
|
||||
# Even when the average load is inferior to the threshold, no more Media Nodes will
|
||||
# be removed from the cluster
|
||||
# OPENVIDU_PRO_CLUSTER_AUTOSCALING_MIN_NODES=
|
||||
|
||||
# If autoscaling is enabled, the upper average load threshold that will trigger the addition
|
||||
# of a new Media Node.
|
||||
# Percentage value (0 min, 100 max)
|
||||
# OPENVIDU_PRO_CLUSTER_AUTOSCALING_MAX_LOAD=
|
||||
|
||||
# If autoscaling is enabled, the lower average load threshold that will trigger the removal
|
||||
# of an existing Media Node.
|
||||
# Percentage value (0 min, 100 max)
|
||||
# OPENVIDU_PRO_CLUSTER_AUTOSCALING_MIN_LOAD=
|
||||
|
||||
# What parameter should be used to distribute the creation of new sessions
|
||||
# (and therefore distribution of load) among all available Media Nodes
|
||||
OPENVIDU_PRO_CLUSTER_LOAD_STRATEGY=streams
|
||||
|
||||
# Max days until delete indexes in state of rollover on Elasticsearch
|
||||
# Type number >= 0
|
||||
# OPENVIDU_PRO_ELASTICSEARCH_MAX_DAYS_DELETE=
|
||||
|
||||
# Private IP of OpenVidu Server Pro
|
||||
# For example 192.168.1.101
|
||||
# OPENVIDU_PRO_PRIVATE_IP=
|
||||
|
||||
# Whether to enable recording module or not
|
||||
OPENVIDU_RECORDING=false
|
||||
|
||||
# Use recording module with debug mode.
|
||||
OPENVIDU_RECORDING_DEBUG=false
|
||||
|
||||
# Openvidu Folder Record used for save the openvidu recording videos. Change it
|
||||
# with the folder you want to use from your host.
|
||||
OPENVIDU_RECORDING_PATH=/opt/openvidu/recordings
|
||||
|
||||
# System path where OpenVidu Server should look for custom recording layouts
|
||||
OPENVIDU_RECORDING_CUSTOM_LAYOUT=/opt/openvidu/custom-layout
|
||||
|
||||
# if true any client can connect to
|
||||
# https://OPENVIDU_SERVER_IP:OPENVIDU_PORT/recordings/any_session_file.mp4
|
||||
# and access any recorded video file. If false this path will be secured with
|
||||
# OPENVIDU_SECRET param just as OpenVidu Server dashboard at
|
||||
# https://OPENVIDU_SERVER_IP:OPENVIDU_PORT
|
||||
# Values: true | false
|
||||
OPENVIDU_RECORDING_PUBLIC_ACCESS=false
|
||||
|
||||
# Which users should receive the recording events in the client side
|
||||
# (recordingStarted, recordingStopped). Can be all (every user connected to
|
||||
# the session), publisher_moderator (users with role 'PUBLISHER' or
|
||||
# 'MODERATOR'), moderator (only users with role 'MODERATOR') or none
|
||||
# (no user will receive these events)
|
||||
OPENVIDU_RECORDING_NOTIFICATION=publisher_moderator
|
||||
|
||||
# Timeout in seconds for recordings to automatically stop (and the session involved to be closed)
|
||||
# when conditions are met: a session recording is started but no user is publishing to it or a session
|
||||
# is being recorded and last user disconnects. If a user publishes within the timeout in either case,
|
||||
# the automatic stop of the recording is cancelled
|
||||
# 0 means no timeout
|
||||
OPENVIDU_RECORDING_AUTOSTOP_TIMEOUT=120
|
||||
|
||||
# Maximum video bandwidth sent from clients to OpenVidu Server, in kbps.
|
||||
# 0 means unconstrained
|
||||
OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000
|
||||
|
||||
# Minimum video bandwidth sent from clients to OpenVidu Server, in kbps.
|
||||
# 0 means unconstrained
|
||||
OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
|
||||
|
||||
# Maximum video bandwidth sent from OpenVidu Server to clients, in kbps.
|
||||
# 0 means unconstrained
|
||||
OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
|
||||
|
||||
# Minimum video bandwidth sent from OpenVidu Server to clients, in kbps.
|
||||
# 0 means unconstrained
|
||||
OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
||||
|
||||
# true to enable OpenVidu Webhook service. false' otherwise
|
||||
# Values: true | false
|
||||
OPENVIDU_WEBHOOK=false
|
||||
|
||||
# HTTP endpoint where OpenVidu Server will send Webhook HTTP POST messages
|
||||
# Must be a valid URL: http(s)://ENDPOINT
|
||||
#OPENVIDU_WEBHOOK_ENDPOINT=
|
||||
|
||||
# List of headers that OpenVidu Webhook service will attach to HTTP POST messages
|
||||
#OPENVIDU_WEBHOOK_HEADERS=
|
||||
|
||||
# List of events that will be sent by OpenVidu Webhook service
|
||||
# Leave blank if all events.
|
||||
OPENVIDU_WEBHOOK_EVENTS=[sessionCreated,sessionDestroyed,participantJoined,participantLeft,webrtcConnectionCreated,webrtcConnectionDestroyed,recordingStatusChanged,filterEventDispatched,mediaNodeStatusChanged]
|
||||
|
||||
# How often the garbage collector of non active sessions runs.
|
||||
# This helps cleaning up sessions that have been initialized through
|
||||
# REST API (and maybe tokens have been created for them) but have had no users connected.
|
||||
# Default to 900s (15 mins). 0 to disable non active sessions garbage collector
|
||||
OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
|
||||
|
||||
# Minimum time in seconds that a non active session must have been in existence
|
||||
# for the garbage collector of non active sessions to remove it. Default to 3600s (1 hour).
|
||||
# If non active sessions garbage collector is disabled
|
||||
# (property 'OPENVIDU_SESSIONS_GARBAGE_INTERVAL' to 0) this property is ignored
|
||||
OPENVIDU_SESSIONS_GARBAGE_THRESHOLD=3600
|
||||
|
||||
# Call Detail Record enabled
|
||||
# Whether to enable Call Detail Record or not
|
||||
# Values: true | false
|
||||
OPENVIDU_CDR=false
|
||||
|
||||
# Path where the cdr log files are hosted
|
||||
OPENVIDU_CDR_PATH=/opt/openvidu/cdr
|
||||
|
||||
# Openvidu Server Level logs
|
||||
# --------------------------
|
||||
# Uncomment the next line and define this variable to change
|
||||
# the verbosity level of the logs of Openvidu Service
|
||||
# RECOMENDED VALUES: INFO for normal logs DEBUG for more verbose logs
|
||||
# OV_CE_DEBUG_LEVEL=INFO
|
||||
|
||||
# Java Options
|
||||
# --------------------------
|
||||
# Uncomment the next line and define this to add options to java command
|
||||
# Documentation: https://docs.oracle.com/cd/E37116_01/install.111210/e23737/configuring_jvm.htm#OUDIG00058
|
||||
# JAVA_OPTIONS=-Xms2048m -Xmx4096m
|
||||
|
||||
# Kibana And ElasticSearch Configuration
|
||||
# --------------------------
|
||||
# Kibana dashboard configuration (Credentials)
|
||||
KIBANA_USER=kibanaadmin
|
||||
KIBANA_PASSWORD=
|
||||
|
||||
# Cloudformation configuration
|
||||
# --------------------------
|
||||
# If you're working outside AWS ignore this section
|
||||
#AWS_DEFAULT_REGION=
|
||||
#AWS_IMAGE_ID=
|
||||
#AWS_INSTANCE_TYPE=
|
||||
#AWS_KEY_NAME=
|
||||
#AWS_SUBNET_ID=
|
||||
#AWS_SECURITY_GROUP=
|
||||
#AWS_STACK_ID=
|
||||
#AWS_STACK_NAME=
|
|
@ -0,0 +1,32 @@
|
|||
filebeat.inputs:
|
||||
- type: container
|
||||
paths:
|
||||
- '/var/lib/docker/containers/*/*.log'
|
||||
|
||||
processors:
|
||||
- add_docker_metadata:
|
||||
host: "unix:///var/run/docker.sock"
|
||||
- add_host_metadata:
|
||||
netinfo.enabled: true
|
||||
|
||||
- decode_json_fields:
|
||||
fields: ["message"]
|
||||
target: "json"
|
||||
overwrite_keys: true
|
||||
|
||||
output:
|
||||
elasticsearch:
|
||||
hosts: ["elasticsearch:9200"]
|
||||
indices:
|
||||
- index: "filebeat-redis-%{+yyyy.MM.dd}"
|
||||
when.or:
|
||||
- contains:
|
||||
container.image.name: openvidu/openvidu-redis
|
||||
- index: "filebeat-coturn-%{+yyyy.MM.dd}"
|
||||
when.or:
|
||||
- contains:
|
||||
container.image.name: openvidu/openvidu-coturn
|
||||
|
||||
|
||||
logging.json: true
|
||||
logging.metrics.enabled: false
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
set -eu -o pipefail
|
||||
|
||||
# Set debug mode
|
||||
DEBUG=${DEBUG:-false}
|
||||
[ "$DEBUG" == "true" ] && set -x
|
||||
|
||||
OUTPUT=$(mktemp -t openvidu-autodiscover-XXX --suffix .json)
|
||||
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 describe-instances \
|
||||
--output text \
|
||||
--filters "Name=instance-state-name,Values=running" \
|
||||
"Name=tag:ov-cluster-member,Values=kms" \
|
||||
"Name=tag:ov-stack-name,Values=${AWS_STACK_NAME}" \
|
||||
"Name=tag:ov-stack-region,Values=${AWS_DEFAULT_REGION}" \
|
||||
--query 'Reservations[*].Instances[*].{id:InstanceId,ip:PrivateIpAddress}' > ${OUTPUT}
|
||||
|
||||
cat ${OUTPUT} | jq --raw-input --slurp 'split("\n") | map(split("\t")) | .[0:-1] | map( { "id": .[0], "ip": .[1] } )'
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
set -e -o pipefail
|
||||
|
||||
# Set debug mode
|
||||
DEBUG=${DEBUG:-false}
|
||||
[ "$DEBUG" == "true" ] && set -x
|
||||
|
||||
ID=$1
|
||||
[ -z "${ID}" ] && { echo "Must provide instance ID"; exit 1; }
|
||||
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 terminate-instances --instance-ids ${ID} --output json
|
|
@ -0,0 +1,68 @@
|
|||
#!/bin/bash
|
||||
set -e -o pipefail
|
||||
|
||||
# Set debug mode
|
||||
DEBUG=${DEBUG:-false}
|
||||
[ "$DEBUG" == "true" ] && set -x
|
||||
|
||||
TMPFILE=$(mktemp -t openvidu-userdata-XXX --suffix .txt)
|
||||
OUTPUT=$(mktemp -t openvidu-launch-kms-XXX --suffix .json)
|
||||
ERROUTPUT=$(mktemp -t openvidu-launch-kms-XXX --suffix .err)
|
||||
|
||||
trap exit_on_error ERR
|
||||
|
||||
exit_on_error () {
|
||||
ERROR_TYPE=$(cat ${ERROUTPUT} | awk '{ print $4 }' | sed -r 's/\(|\)//g' | tr -d '\n')
|
||||
|
||||
case ${ERROR_TYPE}
|
||||
in
|
||||
"InvalidParameterValue")
|
||||
echo -e "Parameter invalid " $(cat ${ERROUTPUT}) >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
"UnauthorizedOperation")
|
||||
MSG_COD=$(cat ${ERROUTPUT} | awk -F: '{ print $3 }')
|
||||
MSG_DEC=$(docker run --rm amazon/aws-cli:2.0.7 sts decode-authorization-message --encoded-message ${MSG_COD})
|
||||
|
||||
echo -e "Unauthorized " $(cat ${MSG_DEC}) >&2
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
echo -e "Unknown error " $(cat ${ERROUTPUT}) >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 run-instances \
|
||||
--image-id ${AWS_IMAGE_ID} --count 1 \
|
||||
--instance-type ${AWS_INSTANCE_TYPE} \
|
||||
--key-name ${AWS_KEY_NAME} \
|
||||
--subnet-id ${AWS_SUBNET_ID} \
|
||||
--tag-specifications "ResourceType=instance,Tags=[{Key='Name',Value='Kurento Media Server'},{Key='ov-cluster-member',Value='kms'},{Key='ov-stack-name',Value='${AWS_STACK_NAME}'},{Key='ov-stack-region',Value='${AWS_DEFAULT_REGION}'}]" \
|
||||
--iam-instance-profile Name="OpenViduInstanceProfile-${AWS_STACK_NAME}-${AWS_DEFAULT_REGION}" \
|
||||
--security-group-ids ${AWS_SECURITY_GROUP} > ${OUTPUT} 2> ${ERROUTPUT}
|
||||
|
||||
docker run --rm amazon/aws-cli:2.0.7 ec2 wait instance-running --instance-ids $(cat ${OUTPUT} | jq --raw-output ' .Instances[] | .InstanceId')
|
||||
|
||||
# Generating the output
|
||||
KMS_IP=$(cat ${OUTPUT} | jq --raw-output ' .Instances[] | .NetworkInterfaces[0] | .PrivateIpAddress')
|
||||
KMS_ID=$(cat ${OUTPUT} | jq --raw-output ' .Instances[] | .InstanceId')
|
||||
|
||||
# Wait media-node controller
|
||||
attempt_counter=0
|
||||
max_attempts=10
|
||||
|
||||
until $(curl --output /dev/null --silent --head --fail -u OPENVIDUAPP:${OPENVIDU_SECRET} http://${KMS_IP}:3000/media-node/status); do
|
||||
if [ ${attempt_counter} -eq ${max_attempts} ];then
|
||||
exit 1
|
||||
fi
|
||||
attempt_counter=$(($attempt_counter+1))
|
||||
sleep 5
|
||||
done
|
||||
|
||||
jq -n \
|
||||
--arg id "${KMS_ID}" \
|
||||
--arg ip "${KMS_IP}" \
|
||||
'{ id: $id, ip: $ip }'
|
|
@ -0,0 +1,23 @@
|
|||
version: '3.1'
|
||||
|
||||
services:
|
||||
# --------------------------------------------------------------
|
||||
#
|
||||
# Change this if your want use your own application.
|
||||
# It's very important expose your application in port 5442
|
||||
# and use the http protocol.
|
||||
#
|
||||
# Default Application
|
||||
#
|
||||
# Openvidu-Call Version: 2.15.0
|
||||
#
|
||||
# --------------------------------------------------------------
|
||||
app:
|
||||
image: openvidu/openvidu-call:2.15.0
|
||||
restart: on-failure
|
||||
network_mode: host
|
||||
environment:
|
||||
- SERVER_PORT=5442
|
||||
- OPENVIDU_URL=http://localhost:5443
|
||||
- OPENVIDU_SECRET=${OPENVIDU_SECRET}
|
||||
- CALL_OPENVIDU_CERTTYPE=${CERTIFICATE_TYPE}
|
|
@ -0,0 +1,115 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
#
|
||||
# DO NOT MODIFY THIS FILE !!!
|
||||
#
|
||||
# Configuration properties should be specified in .env file
|
||||
#
|
||||
# Application based on OpenVidu should be specified in
|
||||
# docker-compose.override.yml file
|
||||
#
|
||||
# This docker-compose file coordinates all services of OpenVidu CE Platform.
|
||||
#
|
||||
# This file will be overridden when update OpenVidu Platform
|
||||
#
|
||||
# Openvidu Version: 2.15.1
|
||||
#
|
||||
# Installation Mode: On Premises
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
|
||||
openvidu-server:
|
||||
image: openvidu/openvidu-server-pro:2.15.1
|
||||
restart: on-failure
|
||||
network_mode: host
|
||||
entrypoint: ['/bin/bash', '-c', 'export COTURN_IP=`/usr/local/bin/discover_my_public_ip.sh`; /usr/local/bin/entrypoint.sh']
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ${OPENVIDU_RECORDING_PATH}:${OPENVIDU_RECORDING_PATH}
|
||||
- ${OPENVIDU_RECORDING_CUSTOM_LAYOUT}:${OPENVIDU_RECORDING_CUSTOM_LAYOUT}
|
||||
- ${OPENVIDU_CDR_PATH}:${OPENVIDU_CDR_PATH}
|
||||
- ./cluster:/opt/openvidu/cluster
|
||||
- .env:${PWD}/.env
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
- SERVER_SSL_ENABLED=false
|
||||
- SERVER_PORT=5443
|
||||
- KMS_URIS=[]
|
||||
- COTURN_REDIS_IP=127.0.0.1
|
||||
- COTURN_REDIS_PASSWORD=${OPENVIDU_SECRET}
|
||||
- OPENVIDU_PRO_CLUSTER=true
|
||||
- OPENVIDU_PRO_KIBANA_HOST=http://127.0.0.1/kibana
|
||||
- OPENVIDU_PRO_ELASTICSEARCH_HOST=http://127.0.0.1:9200
|
||||
- WAIT_KIBANA_URL=http://127.0.0.1:5601/api/status
|
||||
- DOTENV_PATH=${PWD}
|
||||
|
||||
redis:
|
||||
image: openvidu/openvidu-redis:1.0.0
|
||||
restart: always
|
||||
network_mode: host
|
||||
environment:
|
||||
- REDIS_PASSWORD=${OPENVIDU_SECRET}
|
||||
|
||||
coturn:
|
||||
image: openvidu/openvidu-coturn:1.0.0
|
||||
restart: on-failure
|
||||
network_mode: host
|
||||
environment:
|
||||
- REDIS_IP=127.0.0.1
|
||||
- TURN_LISTEN_PORT=3478
|
||||
- DB_NAME=0
|
||||
- DB_PASSWORD=${OPENVIDU_SECRET}
|
||||
- MIN_PORT=57001
|
||||
- MAX_PORT=65535
|
||||
|
||||
nginx:
|
||||
image: openvidu/openvidu-proxy:3.0.0
|
||||
restart: on-failure
|
||||
network_mode: host
|
||||
entrypoint: ['/bin/sh', '-c', 'htpasswd -bc /etc/nginx/kibana.htpasswd "${KIBANA_USER}" "${KIBANA_PASSWORD}" && /usr/local/bin/entrypoint.sh']
|
||||
volumes:
|
||||
- ./certificates:/etc/letsencrypt
|
||||
- ./owncert:/owncert
|
||||
- ${OPENVIDU_RECORDING_CUSTOM_LAYOUT}:/opt/openvidu/custom-layout
|
||||
environment:
|
||||
- DOMAIN_OR_PUBLIC_IP=${DOMAIN_OR_PUBLIC_IP}
|
||||
- CERTIFICATE_TYPE=${CERTIFICATE_TYPE}
|
||||
- LETSENCRYPT_EMAIL=${LETSENCRYPT_EMAIL}
|
||||
- PROXY_HTTP_PORT=${HTTP_PORT:-}
|
||||
- PROXY_HTTPS_PORT=${HTTPS_PORT:-}
|
||||
- ALLOWED_ACCESS_TO_DASHBOARD=${ALLOWED_ACCESS_TO_DASHBOARD:-}
|
||||
- ALLOWED_ACCESS_TO_RESTAPI=${ALLOWED_ACCESS_TO_RESTAPI:-}
|
||||
- PROXY_MODE=PRO
|
||||
- WITH_APP=true
|
||||
|
||||
elasticsearch:
|
||||
image: docker.elastic.co/elasticsearch/elasticsearch:7.8.0
|
||||
restart: always
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
ports:
|
||||
- 9200:9200
|
||||
volumes:
|
||||
- ./elasticsearch:/usr/share/elasticsearch/data
|
||||
|
||||
kibana:
|
||||
image: docker.elastic.co/kibana/kibana:7.8.0
|
||||
restart: always
|
||||
environment:
|
||||
- SERVER_BASEPATH="/kibana"
|
||||
ports:
|
||||
- 5601:5601
|
||||
|
||||
filebeat:
|
||||
image: docker.elastic.co/beats/filebeat:7.8.0
|
||||
restart: always
|
||||
user: root
|
||||
volumes:
|
||||
- ./beats/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
|
||||
- /var/lib/docker:/var/lib/docker:ro
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
command: filebeat -e -strict.perms=false
|
|
@ -0,0 +1,373 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Global variables
|
||||
OPENVIDU_FOLDER=openvidu
|
||||
OPENVIDU_VERSION=master
|
||||
AWS_SCRIPTS_FOLDER=${OPENVIDU_FOLDER}/cluster/aws
|
||||
ELASTICSEARCH_FOLDER=${OPENVIDU_FOLDER}/elasticsearch
|
||||
BEATS_FOLDER=${OPENVIDU_FOLDER}/beats
|
||||
DOWNLOAD_URL=https://raw.githubusercontent.com/OpenVidu/openvidu/${OPENVIDU_VERSION}
|
||||
|
||||
fatal_error() {
|
||||
printf "\n =======¡ERROR!======="
|
||||
printf "\n %s" "$1"
|
||||
printf "\n"
|
||||
exit 0
|
||||
}
|
||||
|
||||
new_ov_installation() {
|
||||
printf '\n'
|
||||
printf '\n ======================================='
|
||||
printf '\n Install Openvidu PRO %s' "${OPENVIDU_VERSION}"
|
||||
printf '\n ======================================='
|
||||
printf '\n'
|
||||
|
||||
# Create folder openvidu-docker-compose
|
||||
printf '\n => Creating folder '%s'...' "${OPENVIDU_FOLDER}"
|
||||
mkdir "${OPENVIDU_FOLDER}" || fatal_error "Error while creating the folder '${OPENVIDU_FOLDER}'"
|
||||
|
||||
# Create aws scripts folder
|
||||
printf "\n => Creating folder 'cluster/aws'..."
|
||||
mkdir -p "${AWS_SCRIPTS_FOLDER}" || fatal_error "Error while creating the folder 'cluster/aws'"
|
||||
|
||||
# Create beats folder
|
||||
printf "\n => Creating folder 'beats'..."
|
||||
mkdir -p "${BEATS_FOLDER}" || fatal_error "Error while creating the folder 'beats'"
|
||||
|
||||
# Create elasticsearch folder
|
||||
printf "\n => Creating folder 'elasticsearch'..."
|
||||
mkdir -p "${ELASTICSEARCH_FOLDER}" || fatal_error "Error while creating the folder 'elasticsearch'"
|
||||
|
||||
printf "\n => Changing permission to 'elasticsearch' folder..."
|
||||
chown 1000:1000 "${ELASTICSEARCH_FOLDER}" || fatal_error "Error while changing permission to 'elasticsearch' folder"
|
||||
|
||||
# Download necessary files
|
||||
printf '\n => Downloading Openvidu PRO files:'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/cluster/aws/openvidu_autodiscover.sh \
|
||||
--output "${AWS_SCRIPTS_FOLDER}/openvidu_autodiscover.sh" || fatal_error "Error when downloading the file 'openvidu_autodiscover.sh'"
|
||||
printf '\n - openvidu_autodiscover.sh'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/cluster/aws/openvidu_drop.sh \
|
||||
--output "${AWS_SCRIPTS_FOLDER}/openvidu_drop.sh" || fatal_error "Error when downloading the file 'openvidu_drop.sh'"
|
||||
printf '\n - openvidu_drop.sh'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/cluster/aws/openvidu_launch_kms.sh \
|
||||
--output "${AWS_SCRIPTS_FOLDER}/openvidu_launch_kms.sh" || fatal_error "Error when downloading the file 'openvidu_launch_kms.sh'"
|
||||
printf '\n - openvidu_launch_kms.sh'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/beats/filebeat.yml \
|
||||
--output "${BEATS_FOLDER}/filebeat.yml" || fatal_error "Error when downloading the file 'filebeat.yml'"
|
||||
printf '\n - filebeat.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/.env \
|
||||
--output "${OPENVIDU_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/docker-compose.override.yml \
|
||||
--output "${OPENVIDU_FOLDER}/docker-compose.override.yml" || fatal_error "Error when downloading the file 'docker-compose.override.yml'"
|
||||
printf '\n - docker-compose.override.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/docker-compose.yml \
|
||||
--output "${OPENVIDU_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/openvidu \
|
||||
--output "${OPENVIDU_FOLDER}/openvidu" || fatal_error "Error when downloading the file 'openvidu'"
|
||||
printf '\n - openvidu'
|
||||
|
||||
# Add execution permissions
|
||||
printf "\n => Adding permission:"
|
||||
|
||||
chmod +x "${OPENVIDU_FOLDER}/openvidu" || fatal_error "Error while adding permission to 'openvidu' program"
|
||||
printf '\n - openvidu'
|
||||
|
||||
chmod +x "${AWS_SCRIPTS_FOLDER}/openvidu_autodiscover.sh" || fatal_error "Error while adding permission to 'openvidu_autodiscover.sh' program"
|
||||
printf '\n - openvidu_autodiscover.sh'
|
||||
|
||||
chmod +x "${AWS_SCRIPTS_FOLDER}/openvidu_drop.sh" || fatal_error "Error while adding permission to 'openvidu' openvidu_drop.sh"
|
||||
printf '\n - openvidu_drop.sh'
|
||||
|
||||
chmod +x "${AWS_SCRIPTS_FOLDER}/openvidu_launch_kms.sh" || fatal_error "Error while adding permission to 'openvidu_launch_kms.sh' program"
|
||||
printf '\n - openvidu_launch_kms.sh'
|
||||
|
||||
# Create own certificated folder
|
||||
printf "\n => Creating folder 'owncert'..."
|
||||
mkdir "${OPENVIDU_FOLDER}/owncert" || fatal_error "Error while creating the folder 'owncert'"
|
||||
|
||||
# Ready to use
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf '\n ======================================='
|
||||
printf '\n Openvidu PRO successfully installed.'
|
||||
printf '\n ======================================='
|
||||
printf '\n'
|
||||
printf '\n 1. Go to openvidu folder:'
|
||||
printf '\n $ cd openvidu'
|
||||
printf '\n'
|
||||
printf '\n 2. Configure OPENVIDU_DOMAIN_OR_PUBLIC_IP, OPENVIDU_PRO_LICENSE, OPENVIDU_SECRET, and KIBANA_PASSWORD in .env file:'
|
||||
printf '\n $ nano .env'
|
||||
printf '\n'
|
||||
printf '\n 3. Start OpenVidu'
|
||||
printf '\n $ ./openvidu start'
|
||||
printf '\n'
|
||||
printf "\n CAUTION: The folder 'openvidu/elasticsearch' use user and group 1000 permissions. This folder is necessary for store elasticsearch data."
|
||||
printf "\n For more information, check:"
|
||||
printf "\n https://docs.openvidu.io/en/${OPENVIDU_VERSION//v}/openvidu-pro/deployment/on-premises/#deployment-instructions"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
exit 0
|
||||
}
|
||||
|
||||
upgrade_ov() {
|
||||
# Search local Openvidu installation
|
||||
printf '\n'
|
||||
printf '\n ============================================'
|
||||
printf '\n Search Previous Installation of Openvidu'
|
||||
printf '\n ============================================'
|
||||
printf '\n'
|
||||
|
||||
SEARCH_IN_FOLDERS=(
|
||||
"${PWD}"
|
||||
"/opt/${OPENVIDU_FOLDER}"
|
||||
)
|
||||
|
||||
for folder in "${SEARCH_IN_FOLDERS[@]}"; do
|
||||
printf "\n => Searching in '%s' folder..." "${folder}"
|
||||
|
||||
if [ -f "${folder}/docker-compose.yml" ]; then
|
||||
OPENVIDU_PREVIOUS_FOLDER="${folder}"
|
||||
|
||||
printf "\n => Found installation in folder '%s'" "${folder}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
[ -z "${OPENVIDU_PREVIOUS_FOLDER}" ] && fatal_error "No previous Openvidu installation found"
|
||||
|
||||
# Uppgrade Openvidu
|
||||
OPENVIDU_PREVIOUS_VERSION=$(grep 'Openvidu Version:' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
|
||||
[ -z "${OPENVIDU_PREVIOUS_VERSION}" ] && OPENVIDU_PREVIOUS_VERSION=2.13.0
|
||||
|
||||
# In this point using the variable 'OPENVIDU_PREVIOUS_VERSION' we can verify if the upgrade is
|
||||
# posible or not. If it is not posible launch a warning and stop the upgrade.
|
||||
|
||||
printf '\n'
|
||||
printf '\n ======================================='
|
||||
printf '\n Upgrade Openvidu PRO %s to %s' "${OPENVIDU_PREVIOUS_VERSION}" "${OPENVIDU_VERSION}"
|
||||
printf '\n ======================================='
|
||||
printf '\n'
|
||||
|
||||
ROLL_BACK_FOLDER="${OPENVIDU_PREVIOUS_FOLDER}/.old-${OPENVIDU_PREVIOUS_VERSION}"
|
||||
TMP_FOLDER="${OPENVIDU_PREVIOUS_FOLDER}/tmp"
|
||||
ACTUAL_FOLDER="${PWD}"
|
||||
USE_OV_CALL=$(grep -E '^ image: openvidu/openvidu-call:.*$' "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.override.yml" | tr -d '[:space:]')
|
||||
|
||||
printf "\n Creating rollback folder '%s'..." ".old-${OPENVIDU_PREVIOUS_VERSION}"
|
||||
mkdir "${ROLL_BACK_FOLDER}" || fatal_error "Error while creating the folder '.old-${OPENVIDU_PREVIOUS_VERSION}'"
|
||||
|
||||
printf "\n Creating temporal folder 'tmp'..."
|
||||
mkdir "${TMP_FOLDER}" || fatal_error "Error while creating the folder 'temporal'"
|
||||
|
||||
# Download necessary files
|
||||
printf '\n => Downloading new Openvidu PRO files:'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/cluster/aws/openvidu_autodiscover.sh \
|
||||
--output "${TMP_FOLDER}/openvidu_autodiscover.sh" || fatal_error "Error when downloading the file 'openvidu_autodiscover.sh'"
|
||||
printf '\n - openvidu_autodiscover.sh'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/cluster/aws/openvidu_drop.sh \
|
||||
--output "${TMP_FOLDER}/openvidu_drop.sh" || fatal_error "Error when downloading the file 'openvidu_drop.sh'"
|
||||
printf '\n - openvidu_drop.sh'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/cluster/aws/openvidu_launch_kms.sh \
|
||||
--output "${TMP_FOLDER}/openvidu_launch_kms.sh" || fatal_error "Error when downloading the file 'openvidu_launch_kms.sh'"
|
||||
printf '\n - openvidu_launch_kms.sh'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/beats/filebeat.yml \
|
||||
--output "${TMP_FOLDER}/filebeat.yml" || fatal_error "Error when downloading the file 'filebeat.yml'"
|
||||
printf '\n - filebeat.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/.env \
|
||||
--output "${TMP_FOLDER}/.env" || fatal_error "Error when downloading the file '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/docker-compose.override.yml \
|
||||
--output "${TMP_FOLDER}/docker-compose.override.yml" || fatal_error "Error when downloading the file 'docker-compose.override.yml'"
|
||||
printf '\n - docker-compose.override.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/docker-compose.yml \
|
||||
--output "${TMP_FOLDER}/docker-compose.yml" || fatal_error "Error when downloading the file 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
curl --silent ${DOWNLOAD_URL}/openvidu-server/deployments/pro/docker-compose/openvidu-server-pro/openvidu \
|
||||
--output "${TMP_FOLDER}/openvidu" || fatal_error "Error when downloading the file 'openvidu'"
|
||||
printf '\n - openvidu'
|
||||
|
||||
# Dowloading new images and stoped actual Openvidu
|
||||
printf '\n => Dowloading new images...'
|
||||
printf '\n'
|
||||
sleep 1
|
||||
|
||||
printf "\n => Moving to 'tmp' folder..."
|
||||
printf '\n'
|
||||
cd "${TMP_FOLDER}" || fatal_error "Error when moving to 'tmp' folder"
|
||||
printf '\n'
|
||||
docker-compose pull | true
|
||||
|
||||
printf '\n => Stoping Openvidu...'
|
||||
printf '\n'
|
||||
sleep 1
|
||||
|
||||
printf "\n => Moving to 'openvidu' folder..."
|
||||
printf '\n'
|
||||
cd "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error when moving to 'openvidu' folder"
|
||||
printf '\n'
|
||||
docker-compose down | true
|
||||
|
||||
printf '\n'
|
||||
printf '\n => Moving to working dir...'
|
||||
cd "${ACTUAL_FOLDER}" || fatal_error "Error when moving to working dir"
|
||||
|
||||
# Move old files to rollback folder
|
||||
printf '\n => Moving previous installation files to rollback folder:'
|
||||
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
if [ ! -z "${USE_OV_CALL}" ]; then
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.override.yml" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'docker-compose.override.yml'"
|
||||
printf '\n - docker-compose.override.yml'
|
||||
fi
|
||||
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/openvidu" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'openvidu'"
|
||||
printf '\n - openvidu'
|
||||
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/readme.md" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'readme.md'"
|
||||
printf '\n - readme.md'
|
||||
|
||||
mv "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous 'cluster/aws'"
|
||||
printf '\n - cluster/aws'
|
||||
|
||||
cp "${OPENVIDU_PREVIOUS_FOLDER}/.env" "${ROLL_BACK_FOLDER}" || fatal_error "Error while moving previous '.env'"
|
||||
printf '\n - .env'
|
||||
|
||||
# Move tmp files to Openvidu
|
||||
printf '\n => Updating files:'
|
||||
|
||||
mv "${TMP_FOLDER}/docker-compose.yml" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'docker-compose.yml'"
|
||||
printf '\n - docker-compose.yml'
|
||||
|
||||
if [ ! -z "${USE_OV_CALL}" ]; then
|
||||
mv "${TMP_FOLDER}/docker-compose.override.yml" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'docker-compose.override.yml'"
|
||||
printf '\n - docker-compose.override.yml'
|
||||
else
|
||||
mv "${TMP_FOLDER}/docker-compose.override.yml" "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.override.yml-${OPENVIDU_VERSION}" || fatal_error "Error while updating 'docker-compose.override.yml'"
|
||||
printf '\n - docker-compose.override.yml-%s' "${OPENVIDU_VERSION}"
|
||||
fi
|
||||
|
||||
mv "${TMP_FOLDER}/.env" "${OPENVIDU_PREVIOUS_FOLDER}/.env-${OPENVIDU_VERSION}" || fatal_error "Error while moving previous '.env'"
|
||||
printf '\n - .env-%s' "${OPENVIDU_VERSION}"
|
||||
|
||||
mv "${TMP_FOLDER}/openvidu" "${OPENVIDU_PREVIOUS_FOLDER}" || fatal_error "Error while updating 'openvidu'"
|
||||
printf '\n - openvidu'
|
||||
|
||||
mkdir "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws" || fatal_error "Error while creating the folder 'cluster/aws'"
|
||||
|
||||
mkdir "${OPENVIDU_PREVIOUS_FOLDER}/beats" || fatal_error "Error while creating the folder 'beats'"
|
||||
|
||||
mv "${TMP_FOLDER}/openvidu_autodiscover.sh" "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws" || fatal_error "Error while updating 'openvidu_autodiscover.sh'"
|
||||
printf '\n - openvidu_autodiscover.sh'
|
||||
|
||||
mv "${TMP_FOLDER}/openvidu_drop.sh" "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws" || fatal_error "Error while updating 'openvidu_drop.sh'"
|
||||
printf '\n - openvidu_drop.sh'
|
||||
|
||||
mv "${TMP_FOLDER}/openvidu_launch_kms.sh" "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws" || fatal_error "Error while updating 'openvidu_launch_kms.sh'"
|
||||
printf '\n - openvidu_launch_kms.sh'
|
||||
|
||||
mv "${TMP_FOLDER}/filebeat.yml" "${OPENVIDU_PREVIOUS_FOLDER}/beats/filebeat.yml" || fatal_error "Error while updating 'filebeat.yml'"
|
||||
printf '\n - filebeat.yml'
|
||||
|
||||
printf "\n => Deleting 'tmp' folder"
|
||||
rm -rf "${TMP_FOLDER}" || fatal_error "Error deleting 'tmp' folder"
|
||||
|
||||
# Add execution permissions
|
||||
printf "\n => Adding permission to 'openvidu' program..."
|
||||
|
||||
chmod +x "${OPENVIDU_PREVIOUS_FOLDER}/openvidu" || fatal_error "Error while adding permission to 'openvidu' program"
|
||||
printf '\n - openvidu'
|
||||
|
||||
chmod +x "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws/openvidu_autodiscover.sh" || fatal_error "Error while adding permission to 'openvidu_autodiscover.sh' program"
|
||||
printf '\n - openvidu_autodiscover.sh'
|
||||
|
||||
chmod +x "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws/openvidu_drop.sh" || fatal_error "Error while adding permission to 'openvidu' openvidu_drop.sh"
|
||||
printf '\n - openvidu_drop.sh'
|
||||
|
||||
chmod +x "${OPENVIDU_PREVIOUS_FOLDER}/cluster/aws/openvidu_launch_kms.sh" || fatal_error "Error while adding permission to 'openvidu_launch_kms.sh' program"
|
||||
printf '\n - openvidu_launch_kms.sh'
|
||||
|
||||
# Define old mode: On Premise or Cloud Formation
|
||||
OLD_MODE=$(grep -E "Installation Mode:.*$" "${ROLL_BACK_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
|
||||
[ ! -z "${OLD_MODE}" ] && sed -i -r "s/Installation Mode:.+/Installation Mode: ${OLD_MODE}/" "${OPENVIDU_PREVIOUS_FOLDER}/docker-compose.yml"
|
||||
|
||||
# In Aws, update AMI ID
|
||||
CHECK_AWS=$(curl -s -o /dev/null -w "%{http_code}" http://169.254.169.254)
|
||||
if [[ ${CHECK_AWS} == "200" ]]; then
|
||||
AWS_REGION=$(grep -E "AWS_DEFAULT_REGION=.*$" "${OPENVIDU_PREVIOUS_FOLDER}/.env" | cut -d'=' -f2)
|
||||
[[ -z ${AWS_REGION} ]] && fatal_error "Error while getting AWS_REGION"
|
||||
NEW_AMI_ID=$(curl https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/CF-OpenVidu-Pro-${OPENVIDU_VERSION//v}.yaml --silent |
|
||||
sed -n -e '/KMSAMIMAP:/,/Metadata:/ p' |
|
||||
grep -A 1 ${AWS_REGION} | grep AMI | tr -d " " | cut -d":" -f2)
|
||||
[[ -z ${NEW_AMI_ID} ]] && fatal_error "Error while getting new AWS_IMAGE_ID for Media Nodes"
|
||||
sed -i "s/.*AWS_IMAGE_ID=.*/AWS_IMAGE_ID=${NEW_AMI_ID}/" "${OPENVIDU_PREVIOUS_FOLDER}/.env" || fatal_error "Error while updating new AWS_IMAGE_ID for Media Nodes"
|
||||
fi
|
||||
|
||||
# Ready to use
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf '\n ================================================'
|
||||
printf "\n Openvidu successfully upgraded to version %s" "${OPENVIDU_VERSION}"
|
||||
printf '\n ================================================'
|
||||
printf '\n'
|
||||
printf "\n 1. A new file 'docker-compose.yml' has been created with the new OpenVidu %s services" "${OPENVIDU_VERSION}"
|
||||
printf '\n'
|
||||
printf "\n 2. The previous file '.env' remains intact, but a new file '.env-%s' has been created." "${OPENVIDU_VERSION}"
|
||||
printf "\n Transfer any configuration you wish to keep in the upgraded version from '.env' to '.env-%s'." "${OPENVIDU_VERSION}"
|
||||
printf "\n When you are OK with it, rename and leave as the only '.env' file of the folder the new '.env-%s'." "${OPENVIDU_VERSION}"
|
||||
printf '\n'
|
||||
printf "\n 3. If you were using Openvidu Call application, it has been automatically updated in file 'docker-compose.override.yml'."
|
||||
printf "\n However, if you were using your own application, a file called 'docker-compose.override.yml-%s'" "${OPENVIDU_VERSION}"
|
||||
printf "\n has been created with the latest version of Openvidu Call. If you don't plan to use it you can delete it."
|
||||
printf '\n'
|
||||
printf '\n 4. Start new version of Openvidu'
|
||||
printf '\n $ ./openvidu start'
|
||||
printf '\n'
|
||||
printf "\n If you want to rollback, all the files from the previous installation have been copied to folder '.old-%s'" "${OPENVIDU_PREVIOUS_VERSION}"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
# Check docker and docker-compose installation
|
||||
if ! command -v docker > /dev/null; then
|
||||
echo "You don't have docker installed, please install it and re-run the command"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! command -v docker-compose > /dev/null; then
|
||||
echo "You don't have docker-compose installed, please install it and re-run the command"
|
||||
exit 0
|
||||
else
|
||||
COMPOSE_VERSION=$(docker-compose version --short | sed "s/-rc[0-9]*//")
|
||||
if ! printf '%s\n%s\n' "1.24" "$COMPOSE_VERSION" | sort -V -C; then
|
||||
echo "You need a docker-compose version equal or higher than 1.24, please update your docker-compose and re-run the command"; \
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check type of installation
|
||||
if [[ ! -z "$1" && "$1" == "upgrade" ]]; then
|
||||
upgrade_ov
|
||||
else
|
||||
new_ov_installation
|
||||
fi
|
|
@ -0,0 +1,259 @@
|
|||
#!/bin/bash
|
||||
|
||||
upgrade_ov() {
|
||||
UPGRADE_SCRIPT_URL="https://s3-eu-west-1.amazonaws.com/aws.openvidu.io/install_openvidu_pro_OVVERSION.sh"
|
||||
HTTP_STATUS=$(curl -s -o /dev/null -I -w "%{http_code}" ${UPGRADE_SCRIPT_URL//OVVERSION/$1})
|
||||
|
||||
printf " => Upgrading Openvidu PRO to '%s' version" "$1"
|
||||
|
||||
if [ "$HTTP_STATUS" == "200" ]; then
|
||||
printf "\n => Downloading and upgrading new version"
|
||||
printf "\n"
|
||||
|
||||
curl --silent ${UPGRADE_SCRIPT_URL//OVVERSION/$1} | bash -s upgrade
|
||||
else
|
||||
printf "\n =======¡ERROR!======="
|
||||
printf "\n Openvidu PRO Version '%s' not exist" "$1"
|
||||
printf "\n"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
collect_basic_information() {
|
||||
LINUX_VERSION=$(lsb_release -d)
|
||||
DOCKER_PS=$(docker ps)
|
||||
DOCKER_VERSION=$(docker version --format '{{.Server.Version}}')
|
||||
DOCKER_COMPOSE_VERSION=$(docker-compose version --short)
|
||||
OV_FOLDER="${PWD}"
|
||||
OV_VERSION=$(grep 'Openvidu Version:' "${OV_FOLDER}/docker-compose.yml" | awk '{ print $4 }')
|
||||
CONTAINERS=$(docker ps | awk '{if(NR>1) print $NF}')
|
||||
|
||||
if [ ! -z "$(grep -E '^ image: openvidu/openvidu-call:.*$' "${OV_FOLDER}/docker-compose.override.yml" | tr -d '[:space:]')" ]; then
|
||||
OV_CALL_VERSION=$(grep -E 'Openvidu-Call Version:' "${OV_FOLDER}/docker-compose.override.yml" | awk '{ print $4 }')
|
||||
fi
|
||||
[ -z "${OV_CALL_VERSION}" ] && OV_CALL_VERSION="No present"
|
||||
|
||||
OV_TYPE_INSTALLATION=$(grep 'Installation Mode:' "${OV_FOLDER}/docker-compose.yml" | awk '{ print $4,$5 }')
|
||||
TREE_OV_DIRECTORY=$(find "." ! -path '*/0/*' | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/|-\1/")
|
||||
}
|
||||
|
||||
version_ov() {
|
||||
collect_basic_information
|
||||
|
||||
printf '\nOpenvidu Information:'
|
||||
printf '\n'
|
||||
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
|
||||
printf '\n Openvidu Version: %s' "${OV_VERSION}"
|
||||
printf '\n Openvidu Call Version: %s' "${OV_CALL_VERSION}"
|
||||
printf '\n'
|
||||
printf '\nSystem Information:'
|
||||
printf '\n'
|
||||
printf '\n Linux Version:'
|
||||
printf '\n - %s' "${LINUX_VERSION}"
|
||||
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
|
||||
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
|
||||
printf '\n'
|
||||
printf '\nInstallation Information:'
|
||||
printf '\n'
|
||||
printf '\n Installation Folder: %s' "${OV_FOLDER}"
|
||||
printf '\n Installation Folder Tree:'
|
||||
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
printf '\nDocker Running Services:'
|
||||
printf '\n'
|
||||
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
generate_report() {
|
||||
collect_basic_information
|
||||
|
||||
REPORT_CREATION_DATE=$(date +"%d-%m-%Y")
|
||||
REPORT_CREATION_TIME=$(date +"%H:%M:%S")
|
||||
REPORT_NAME="openvidu-report-${REPORT_CREATION_DATE}-$(date +"%H-%M").txt"
|
||||
REPORT_OUPUT="${OV_FOLDER}/${REPORT_NAME}"
|
||||
|
||||
{
|
||||
printf "\n ======================================="
|
||||
printf "\n = REPORT INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Creation Date: %s' "${REPORT_CREATION_DATE}"
|
||||
printf '\n Creation Time: %s' "${REPORT_CREATION_TIME}"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = OPENVIDU INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Installation Type: %s' "${OV_TYPE_INSTALLATION}"
|
||||
printf '\n Openvidu Version: %s' "${OV_VERSION}"
|
||||
printf '\n Openvidu Call Version: %s' "${OV_CALL_VERSION}"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = SYSTEM INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Linux Version:'
|
||||
printf '\n - %s' "${LINUX_VERSION}"
|
||||
printf '\n Docker Version: %s' "${DOCKER_VERSION}"
|
||||
printf '\n Docker Compose Version: %s' "${DOCKER_COMPOSE_VERSION}"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = INSTALLATION INFORMATION ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n Installation Folder: %s' "${OV_FOLDER}"
|
||||
printf '\n Installation Folder Tree:'
|
||||
printf '\n%s' "$(echo "${TREE_OV_DIRECTORY}" | sed -e 's/.//' -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = DOCKER RUNNING SERVICES ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n %s' "$(echo "${DOCKER_PS}" | sed -e ':a' -e 'N;$!ba' -e 's/\n/\n\t/g')"
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = CONFIGURATION FILES ="
|
||||
printf "\n ======================================="
|
||||
printf '\n'
|
||||
printf '\n ================ .env ================='
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
||||
cat < "${OV_FOLDER}/.env" | sed -r -e "s/OPENVIDU_SECRET=.+/OPENVIDU_SECRET=****/" -e "s/OPENVIDU_PRO_LICENSE=.+/OPENVIDU_PRO_LICENSE=****/" -e "s/KIBANA_PASSWORD=.+/KIBANA_PASSWORD=****/"
|
||||
|
||||
printf '\n'
|
||||
printf '\n ========= docker-compose.yml =========='
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
||||
cat "${OV_FOLDER}/docker-compose.yml"
|
||||
|
||||
printf '\n'
|
||||
printf '\n ==== docker-compose.override.yml ===='
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
|
||||
if [ -f "${OV_FOLDER}/docker-compose.override.yml" ]; then
|
||||
cat < "${OV_FOLDER}/docker-compose.override.yml"
|
||||
else
|
||||
printf '\n The docker-compose.override.yml file is not present'
|
||||
fi
|
||||
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n = LOGS ="
|
||||
printf "\n ======================================="
|
||||
|
||||
for CONTAINER in $CONTAINERS
|
||||
do
|
||||
printf '\n'
|
||||
printf "\n ---------------------------------------"
|
||||
printf "\n %s" $CONTAINER
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
docker logs $CONTAINER
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
done
|
||||
|
||||
printf "\n ======================================="
|
||||
printf "\n = CONTAINER ENVS VARIABLES ="
|
||||
printf "\n ======================================="
|
||||
|
||||
for CONTAINER in $CONTAINERS
|
||||
do
|
||||
printf '\n'
|
||||
printf "\n ======================================="
|
||||
printf "\n %s" $CONTAINER
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
docker exec $CONTAINER env
|
||||
printf "\n ---------------------------------------"
|
||||
printf '\n'
|
||||
printf '\n'
|
||||
done
|
||||
|
||||
} >> "${REPORT_OUPUT}" 2>&1
|
||||
|
||||
printf "\n Generation of the report completed with success"
|
||||
printf "\n You can get your report at path '%s'" "${REPORT_OUPUT}"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
usage() {
|
||||
printf "Usage: \n\t openvidu [command]"
|
||||
printf "\n\nAvailable Commands:"
|
||||
printf "\n\tstart\t\t\tStart all services"
|
||||
printf "\n\tstop\t\t\tStop all services"
|
||||
printf "\n\trestart\t\t\tRestart all stoped and running services"
|
||||
printf "\n\tlogs\t\t\tShow openvidu-server logs"
|
||||
printf "\n\tupgrade\t\t\tUpgrade to the lastest Openvidu version"
|
||||
printf "\n\tupgrade [version]\tUpgrade to the specific Openvidu version"
|
||||
printf "\n\tversion\t\t\tShow version of Openvidu Server"
|
||||
printf "\n\treport\t\t\tGenerate a report with the current status of Openvidu"
|
||||
printf "\n\thelp\t\t\tShow help for openvidu command"
|
||||
printf "\n"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
||||
start)
|
||||
docker-compose up -d
|
||||
docker-compose logs -f openvidu-server
|
||||
;;
|
||||
|
||||
stop)
|
||||
docker-compose down
|
||||
;;
|
||||
|
||||
restart)
|
||||
docker-compose down
|
||||
docker-compose up -d
|
||||
docker-compose logs -f openvidu-server
|
||||
;;
|
||||
|
||||
logs)
|
||||
docker-compose logs -f openvidu-server
|
||||
;;
|
||||
|
||||
upgrade)
|
||||
if [ -z "$2" ]; then
|
||||
UPGRADE_VERSION="latest"
|
||||
else
|
||||
UPGRADE_VERSION="$2"
|
||||
fi
|
||||
|
||||
read -r -p " You're about to update Openvidu PRO to '${UPGRADE_VERSION}' version. Are you sure? [y/N]: " response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
upgrade_ov "${UPGRADE_VERSION}"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
version)
|
||||
version_ov
|
||||
;;
|
||||
|
||||
report)
|
||||
read -r -p " You are about to generate a report on the current status of Openvidu, this may take some time. Do you want to continue? [y/N]: " response
|
||||
case "$response" in
|
||||
[yY][eE][sS]|[yY])
|
||||
generate_report
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
{"ParameterKey":"KeyName","ParameterValue":"taskcat"},
|
||||
{"ParameterKey":"KurentoAvailabilityZone","ParameterValue":"$[taskcat_genaz_1]"},
|
||||
{"ParameterKey":"AwsInstanceTypeOV","ParameterValue":"c5.2xlarge"},
|
||||
{"ParameterKey":"AwsInstanceTypeKMS","ParameterValue":"c5.2xlarge"},
|
||||
{"ParameterKey":"KurentoAsgSize","ParameterValue":"1"},
|
||||
{"ParameterKey":"OpenViduSecret","ParameterValue":"MY_SECRET"},
|
||||
{"ParameterKey":"KibanaPassword","ParameterValue":"MY_SECRET"},
|
||||
{"ParameterKey":"HTTPSAccess","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"SSHCidr","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"UDPRange","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"TCPRange","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"LetsEncryptEmail","ParameterValue":"email@example.com"},
|
||||
{"ParameterKey":"OwnCertCRT","ParameterValue":"AAA"},
|
||||
{"ParameterKey":"OwnCertKEY","ParameterValue":"BBB"},
|
||||
{"ParameterKey":"OpenViduWebhookHeaders","ParameterValue":"Authorization: Basic T1BFTlZJRFVBUFA6TVlfU0VDUkVU"},
|
||||
{"ParameterKey":"OpenViduCidrBlock","ParameterValue":"172.16.0.0/16"},
|
||||
{"ParameterKey":"OpenViduSubnet","ParameterValue":"172.16.0.0/24"}
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
[
|
||||
{"ParameterKey":"KeyName","ParameterValue":"taskcat"},
|
||||
{"ParameterKey":"KurentoAvailabilityZone","ParameterValue":"$[taskcat_genaz_1]"},
|
||||
{"ParameterKey":"AwsInstanceTypeOV","ParameterValue":"t2.2xlarge"},
|
||||
{"ParameterKey":"AwsInstanceTypeKMS","ParameterValue":"t2.2xlarge"},
|
||||
{"ParameterKey":"KurentoAsgSize","ParameterValue":"1"},
|
||||
{"ParameterKey":"OpenViduSecret","ParameterValue":"MY_SECRET"},
|
||||
{"ParameterKey":"KibanaPassword","ParameterValue":"MY_SECRET"},
|
||||
{"ParameterKey":"HTTPSAccess","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"SSHCidr","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"UDPRange","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"TCPRange","ParameterValue":"0.0.0.0/0"},
|
||||
{"ParameterKey":"LetsEncryptEmail","ParameterValue":"email@example.com"},
|
||||
{"ParameterKey":"OwnCertCRT","ParameterValue":"AAA"},
|
||||
{"ParameterKey":"OwnCertKEY","ParameterValue":"BBB"},
|
||||
{"ParameterKey":"OpenViduWebhookHeaders","ParameterValue":"Authorization: Basic T1BFTlZJRFVBUFA6TVlfU0VDUkVU"},
|
||||
{"ParameterKey":"OpenViduCidrBlock","ParameterValue":"172.16.0.0/16"},
|
||||
{"ParameterKey":"OpenViduSubnet","ParameterValue":"172.16.0.0/24"}
|
||||
]
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
global:
|
||||
owner: openvidu@gmail.com
|
||||
qsname: openvidu-pro-clustering
|
||||
regions:
|
||||
- us-east-1
|
||||
- us-east-2
|
||||
- us-west-1
|
||||
- us-west-2
|
||||
- ap-south-1
|
||||
- ap-northeast-2
|
||||
- ap-southeast-1
|
||||
- ap-southeast-2
|
||||
- ap-northeast-1
|
||||
- ca-central-1
|
||||
- eu-central-1
|
||||
- eu-west-1
|
||||
- eu-west-2
|
||||
- eu-west-3
|
||||
- sa-east-1
|
||||
reporting: true
|
||||
tests:
|
||||
openvidu-all-regions:
|
||||
parameter_input: parameters_input.json
|
||||
template_file: TEMPLATE_TO_TEST
|
||||
openvidu-stockholm:
|
||||
parameter_input: parameters_input-stockholm.json
|
||||
template_file: TEMPLATE_TO_TEST
|
||||
regions:
|
||||
- eu-north-1
|
Loading…
Reference in New Issue