Update openvidu-call upgrading process

This commit is contained in:
pabloFuente 2022-05-13 13:59:29 +02:00
parent 2058eab433
commit ad5ae366b4
5 changed files with 23 additions and 105 deletions

View File

@ -1,52 +1,7 @@
## OpenVidu Call docker deployment
OpenVidu bases its deployment on Docker **since 2.13.0 version**.
**NOTE: docker can be use with OpenVidu Call since 2.14.0 version and above.**
### Build OpenVidu Call container
You have several options to build it:
#### stable.dockerfile
The aim of this docker file is generate a docker image from a OpenVidu Call release.
You must add a `RELEASE_VERSION` that you want to build.
To build it:
```bash
docker build -f stable.dockerfile -t <your-tag-name> --build-arg RELEASE_VERSION=<your-release-version> .
```
#### prod.dockerfile
The aim of this docker file is generate a docker image from a OpenVidu Call branch.
To build it:
```bash
docker build -f prod.dockerfile -t <your-tag-name> --build-arg BRANCH_NAME=<branch-name> --build-arg BASE_HREF=<your-base-href>.
```
By default, the **BRANCH_NAME** name will be `master` and **BASE_HREF** will be `/`.
#### dev.dockerfile
The aim of this docker file is generate a docker image from a OpenVidu Call branch intalling the `openvidu-browser` with the latest changes from **master** branch.
```bash
docker build -f dev.dockerfile -t <your-tag-name> --build-arg BRANCH_NAME=<branch-name> --build-arg BASE_HREF=<your-base-href>.
```
### Run OpenVidu Call container
## OpenVidu Call docker
To build the Docker image:
```
docker run -p 5000:<your_port> -e SERVER_PORT=<your_port> -e OPENVIDU_URL=<your_openvidu_url> -e OPENVIDU_SECRET=<your_secret> openvidu/openvidu-call:X.Y.Z
docker build -f Dockerfile -t <your-tag-name> --build-arg RELEASE_VERSION=<your-release-version> .
```
Go to **http://localhost:your_port**

View File

@ -1,43 +0,0 @@
# Build OpenVidu Call for production
FROM node:lts-alpine3.13 as openvidu-call-build
WORKDIR /openvidu-call
ARG BRANCH_NAME=master
ARG BASE_HREF=/
RUN apk add wget unzip
# Download openvidu-call from specific branch (master by default), intall openvidu-browser and build for production
RUN wget "https://github.com/OpenVidu/openvidu-call/archive/${BRANCH_NAME}.zip" -O openvidu-call.zip && \
unzip openvidu-call.zip && \
rm openvidu-call.zip && \
mv openvidu-call-${BRANCH_NAME}/openvidu-call-front/ . && \
mv openvidu-call-${BRANCH_NAME}/openvidu-call-back/ . && \
rm openvidu-call-front/package-lock.json && \
rm openvidu-call-back/package-lock.json && \
rm -rf openvidu-call-${BRANCH_NAME} && \
# Install openvidu-call-front dependencies and build it for production
npm i --prefix openvidu-call-front && \
npm run build-prod ${BASE_HREF} --prefix openvidu-call-front && \
rm -rf openvidu-call-front && \
# Install openvidu-call-back dependencies and build it for production
npm i --prefix openvidu-call-back && \
npm run build --prefix openvidu-call-back && \
mv openvidu-call-back/dist . && \
rm -rf openvidu-call-back
FROM node:lts-alpine3.13
WORKDIR /opt/openvidu-call
COPY --from=openvidu-call-build /openvidu-call/dist .
# Entrypoint
COPY ./entrypoint.sh /usr/local/bin
RUN apk add curl && \
chmod +x /usr/local/bin/entrypoint.sh && \
npm install -g nodemon
# CMD /usr/local/bin/entrypoint.sh
CMD ["/usr/local/bin/entrypoint.sh"]

View File

@ -1,33 +1,37 @@
#!/usr/bin/env bash
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
if [[ -z "$1" ]]; then
echo "RELEASE_VERSION argument is required" 1>&2
fi
if [[ -z "$2" ]]; then
echo "BRANCH_NAME argument is required" 1>&2
fi
echo "Example of use: ./run.sh 2.14.0 master" 1>&2
if [[ -z "$1" ]]; then
echo "RELEASE_VERSION argument is required" 1>&2
echo "Example of use: ./run.sh 2.22.0" 1>&2
exit 1
fi
RELEASE_VERSION=$1
BRANCH_NAME=$2
CALL_BASE_HREF=/
DEMOS_BASE_HREF=/openvidu-call/
printf '\n -------------------------------------------------------------'
printf '\n Upgrading dependencies'
printf '\n -------------------------------------------------------------'
printf '\n'
cd ../openvidu-call/openvidu-call-front || exit 1
npm version ${RELEASE_VERSION} || exit 1
npm install openvidu-angular@${RELEASE_VERSION} || exit 1
cd ../openvidu-call-back || exit 1
npm install openvidu-node-client@${RELEASE_VERSION} || exit 1
printf '\n'
printf '\n -------------------------------------------------------------'
printf '\n Installing OpenVidu Call with the following arguments:'
printf '\n'
printf '\n Call container tag: openvidu/openvidu-call:%s' "${RELEASE_VERSION}"
printf '\n Demos container tag: openvidu/openvidu-call-demos:%s' "${RELEASE_VERSION}"
printf '\n Branch to build: %s' "${BRANCH_NAME}"
printf '\n -------------------------------------------------------------'
printf '\n'
docker build -f prod.dockerfile -t openvidu/openvidu-call:${RELEASE_VERSION} --build-arg BRANCH_NAME=${BRANCH_NAME} --build-arg BASE_HREF=${CALL_BASE_HREF} .
docker build -f prod.dockerfile -t openvidu/openvidu-call:${RELEASE_VERSION}-demos --build-arg BRANCH_NAME=${BRANCH_NAME} --build-arg BASE_HREF=${DEMOS_BASE_HREF} .
docker build -f Dockerfile -t openvidu/openvidu-call:${RELEASE_VERSION} --build-arg BASE_HREF=${CALL_BASE_HREF} .
docker build -f Dockerfile -t openvidu/openvidu-call:${RELEASE_VERSION}-demos --build-arg BASE_HREF=${DEMOS_BASE_HREF} .
printf '\n'
printf '\n Pushing containers to OpenVidu DockerHub'

View File

@ -42,7 +42,9 @@ NPM_TUTORIALS="openvidu-insecure-angular
openvidu-recording-node
openvidu-react-native
openvidu-electron
openvidu-insecure-vue"
openvidu-insecure-vue
openvidu-call/openvidu-call-front
openvidu-call/openvidu-call-back"
MAVEN_TUTORIALS="openvidu-js-java
openvidu-mvc-java
@ -59,7 +61,7 @@ find . -type f -name 'package.json' -exec sed -i "s/\"openvidu-browser\": \"$FRO
# Updating openvidu-react dependencies in package.json files [openvidu-library-react]
find . -type f -name 'package.json' -exec sed -i "s/\"openvidu-react\": \"$FROM_VERSION\"/\"openvidu-react\": \"$TO_VERSION\"/" {} \;
# Updating openvidu-angular dependencies in package.json files [openvidu-library-angular]
# Updating openvidu-angular dependencies in package.json files [openvidu-call, openvidu-components/*]
find . -type f -name 'package.json' -exec sed -i "s/\"openvidu-angular\": \"$FROM_VERSION\"/\"openvidu-angular\": \"$TO_VERSION\"/" {} \;
# Updating openvidu-react-native-adapter dependencies in package.json files [openvidu-react-native]