From ad5ae366b41af3d352e02008f999a60071e1cbee Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Fri, 13 May 2022 13:59:29 +0200 Subject: [PATCH] Update openvidu-call upgrading process --- .../docker/{custom.dockerfile => Dockerfile} | 0 openvidu-call/docker/README.md | 51 ++----------------- openvidu-call/docker/prod.dockerfile | 43 ---------------- openvidu-call/docker/run.sh | 28 +++++----- update-tutorials.sh | 6 ++- 5 files changed, 23 insertions(+), 105 deletions(-) rename openvidu-call/docker/{custom.dockerfile => Dockerfile} (100%) delete mode 100644 openvidu-call/docker/prod.dockerfile diff --git a/openvidu-call/docker/custom.dockerfile b/openvidu-call/docker/Dockerfile similarity index 100% rename from openvidu-call/docker/custom.dockerfile rename to openvidu-call/docker/Dockerfile diff --git a/openvidu-call/docker/README.md b/openvidu-call/docker/README.md index 6179fecb..407586e4 100644 --- a/openvidu-call/docker/README.md +++ b/openvidu-call/docker/README.md @@ -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 --build-arg 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 --build-arg BRANCH_NAME= --build-arg 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 --build-arg BRANCH_NAME= --build-arg BASE_HREF=. -``` -### Run OpenVidu Call container +## OpenVidu Call docker +To build the Docker image: ``` -docker run -p 5000: -e SERVER_PORT= -e OPENVIDU_URL= -e OPENVIDU_SECRET= openvidu/openvidu-call:X.Y.Z +docker build -f Dockerfile -t --build-arg RELEASE_VERSION= . ``` - -Go to **http://localhost:your_port** \ No newline at end of file diff --git a/openvidu-call/docker/prod.dockerfile b/openvidu-call/docker/prod.dockerfile deleted file mode 100644 index a44ccda8..00000000 --- a/openvidu-call/docker/prod.dockerfile +++ /dev/null @@ -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"] diff --git a/openvidu-call/docker/run.sh b/openvidu-call/docker/run.sh index ccc73949..8c339297 100755 --- a/openvidu-call/docker/run.sh +++ b/openvidu-call/docker/run.sh @@ -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' diff --git a/update-tutorials.sh b/update-tutorials.sh index ccbdef1a..e6895aa0 100755 --- a/update-tutorials.sh +++ b/update-tutorials.sh @@ -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]