Added files for allowing tutorials deployment with docker

This commit is contained in:
Carlos Santos 2023-01-11 16:01:59 +01:00
parent 435bb758bb
commit 820e9585ac
65 changed files with 8981 additions and 21128 deletions

View File

@ -0,0 +1,2 @@
**/node_modules
**/.angular

View File

@ -0,0 +1,24 @@
FROM node:16-alpine3.16
COPY . ./openvidu-angular
WORKDIR /openvidu-angular
# Install openvidu-angular dependencies and build it for production
RUN npm install && \
npm run build:prod
# Copy openvidu-basic-node
RUN cp -r ./openvidu-basic-node /opt/ && \
rm -rf ../openvidu-angular
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
cp -r ../openvidu-basic-node .
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .
rm -rf ./openvidu-basic-node

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec node index.js "$*"

View File

@ -1,32 +0,0 @@
// @ts-check
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
/**
* @type { import("protractor").Config }
*/
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
browserName: 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};

View File

@ -1,23 +0,0 @@
import { AppPage } from './app.po';
import { browser, logging } from 'protractor';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getTitleText()).toEqual('openvidu-angular app is running!');
});
afterEach(async () => {
// Assert that there are no errors emitted from the browser
const logs = await browser.manage().logs().get(logging.Type.BROWSER);
expect(logs).not.toContain(jasmine.objectContaining({
level: logging.Level.SEVERE,
} as logging.Entry));
});
});

View File

@ -1,11 +0,0 @@
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo(): Promise<unknown> {
return browser.get(browser.baseUrl) as Promise<unknown>;
}
getTitleText(): Promise<string> {
return element(by.css('app-root .content span')).getText() as Promise<string>;
}
}

View File

@ -1,13 +0,0 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/e2e",
"module": "commonjs",
"target": "es2018",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,9 @@
"version": "2.25.0",
"license": "Apache-2.0",
"scripts": {
"start": "ng serve"
"start": "./node_modules/@angular/cli/bin/ng.js serve",
"build": "./node_modules/@angular/cli/bin/ng.js build",
"build:prod": "./node_modules/@angular/cli/bin/ng.js build --output-path ./openvidu-basic-node/public/ --configuration production"
},
"dependencies": {
"@angular/animations": "15.0.4",
@ -24,18 +26,8 @@
"@angular/cli": "15.0.4",
"@angular/compiler-cli": "15.0.4",
"@angular/language-service": "15.0.4",
"@types/jasmine": "4.3.1",
"@types/jasminewd2": "2.0.10",
"@types/node": "18.11.18",
"codelyzer": "^0.0.28",
"jasmine-core": "4.5.0",
"jasmine-spec-reporter": "7.0.0",
"karma": "6.4.1",
"karma-chrome-launcher": "3.1.1",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.0.0",
"protractor": "7.0.0",
"codelyzer": "6.0.2",
"ts-node": "10.9.1",
"tslint": "6.1.3",
"typescript": "4.8.4"

View File

@ -1,6 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Component, HostListener, OnDestroy } from '@angular/core';
import { OpenVidu, Publisher, Session, StreamEvent, StreamManager, Subscriber } from 'openvidu-browser';
import { environment } from '../environments/environment';
@Component({
@ -10,7 +11,7 @@ import { OpenVidu, Publisher, Session, StreamEvent, StreamManager, Subscriber }
})
export class AppComponent implements OnDestroy {
APPLICATION_SERVER_URL = 'http://localhost:5000/';
APPLICATION_SERVER_URL = environment.applicationServerUrl;
// OpenVidu objects
OV: OpenVidu;
@ -152,12 +153,12 @@ export class AppComponent implements OnDestroy {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -1,3 +1,5 @@
export const environment = {
production: true
production: true,
applicationServerUrl: '',
};

View File

@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
applicationServerUrl: 'http://localhost:5000/',
};
/*

View File

@ -0,0 +1,17 @@
FROM node:16-alpine3.16
# Copy openvidu-basic-node
COPY ./openvidu-basic-node /opt/openvidu-basic-node
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
# Copy static files to openvidu-basic-node
RUN mkdir -p /opt/openvidu-basic-node/public
COPY ./web /opt/openvidu-basic-node/public
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
cp -r ../openvidu-basic-node .
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .
rm -rf ./openvidu-basic-node

View File

@ -0,0 +1,17 @@
#!/bin/sh
if [ -n "${OPENVIDU_APPLICATION_SERVER_URL}" ]; then
# Replace OPENVIDU_APPLICATION_SERVER_URL at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"${OPENVIDU_APPLICATION_SERVER_URL}/\";|" \
public/app.js
fi
if [ -n "${SERVER_PORT}" ]; then
# Replace SERVER_PORT at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"http://localhost:${SERVER_PORT}/\";|" \
public/app.js
fi
exec node index.js "$*"

View File

@ -1,10 +0,0 @@
version: '3.1'
services:
app:
image: openvidu/openvidu-getaroom-demo:2.22.0
restart: on-failure
network_mode: host
environment:
- OPENVIDU_URL=https://${DOMAIN_OR_PUBLIC_IP:-}:${HTTPS_PORT:-443}
- OPENVIDU_SECRET=${OPENVIDU_SECRET}

View File

@ -7,4 +7,12 @@ if [ -n "${OPENVIDU_APPLICATION_SERVER_URL}" ]; then
public/app.js
fi
if [ -n "${SERVER_PORT}" ]; then
# Replace SERVER_PORT at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"http://localhost:${SERVER_PORT}/\";|" \
public/app.js
fi
exec node index.js "$*"

View File

@ -0,0 +1,17 @@
FROM node:16-alpine3.16
# Copy openvidu-basic-node
COPY ./openvidu-basic-node /opt/openvidu-basic-node
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
# Copy static files to openvidu-basic-node
RUN mkdir -p /opt/openvidu-basic-node/public
COPY ./web /opt/openvidu-basic-node/public
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
cp -r ../openvidu-basic-node .
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .
rm -rf ./openvidu-basic-node

View File

@ -0,0 +1,17 @@
#!/bin/sh
if [ -n "${OPENVIDU_APPLICATION_SERVER_URL}" ]; then
# Replace OPENVIDU_APPLICATION_SERVER_URL at frontend app
sed -i \
"s|APPLICATION_SERVER_URL = \"http://localhost:5000/\";|APPLICATION_SERVER_URL = \"${OPENVIDU_APPLICATION_SERVER_URL}/\";|" \
public/app.js
fi
if [ -n "${SERVER_PORT}" ]; then
# Replace SERVER_PORT at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"http://localhost:${SERVER_PORT}/\";|" \
public/app.js
fi
exec node index.js "$*"

View File

@ -0,0 +1,26 @@
FROM maven:3.6.3 as build
WORKDIR /openvidu-ipcameras
COPY ./pom.xml pom.xml
COPY ./src/main src/main
RUN mvn clean install
RUN mvn -o package
FROM alpine:3.11
RUN apk update && \
apk add openjdk11-jre && \
rm -rf /var/cache/apk/*
# Install basic-webinar
RUN mkdir -p /opt/openvidu-ipcameras
COPY --from=build /openvidu-ipcameras/target/openvidu-ipcameras-*.jar /opt/openvidu-ipcameras/openvidu-ipcameras.jar
# Entrypoint
COPY ./docker/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
CMD /usr/local/bin/entrypoint.sh

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
docker build -f docker/Dockerfile -t "$1" .

View File

@ -0,0 +1,13 @@
#!/bin/sh
[ ! -z "${OPENVIDU_URL}" ] && echo "OPENVIDU_URL: ${OPENVIDU_URL}" || echo "OPENVIDU_URL: default"
[ ! -z "${OPENVIDU_SECRET}" ] && echo "OPENVIDU_SECRET: ${OPENVIDU_SECRET}" || echo "OPENVIDU_SECRET: default"
[ ! -z "${SERVER_PORT}" ] && echo "SERVER_PORT: ${SERVER_PORT}" || echo "SERVER_PORT: default"
# Run Application
JAVA_PROPERTIES="-Djava.security.egd=file:/dev/./urandom"
[ ! -z "${OPENVIDU_URL}" ] && JAVA_PROPERTIES=" ${JAVA_PROPERTIES} -Dopenvidu.url=${OPENVIDU_URL}"
[ ! -z "${OPENVIDU_SECRET}" ] && JAVA_PROPERTIES=" ${JAVA_PROPERTIES} -Dopenvidu.secret=${OPENVIDU_SECRET}"
[ ! -z "${SERVER_PORT}" ] && JAVA_PROPERTIES=" ${JAVA_PROPERTIES} -Dserver.port=${SERVER_PORT}"
java ${JAVA_PROPERTIES} -jar /opt/openvidu-ipcameras/openvidu-ipcameras.jar

View File

@ -1,10 +0,0 @@
version: '3.1'
services:
app:
image: openvidu/openvidu-js-screen-share-demo:2.22.0
restart: on-failure
network_mode: host
environment:
- OPENVIDU_URL=https://${DOMAIN_OR_PUBLIC_IP:-}:${HTTPS_PORT:-443}
- OPENVIDU_SECRET=${OPENVIDU_SECRET}

View File

@ -7,4 +7,11 @@ if [ -n "${OPENVIDU_APPLICATION_SERVER_URL}" ]; then
public/app.js
fi
if [ -n "${SERVER_PORT}" ]; then
# Replace SERVER_PORT at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"http://localhost:${SERVER_PORT}/\";|" \
public/app.js
fi
exec node index.js "$*"

View File

@ -1,10 +0,0 @@
version: '3.1'
services:
app:
image: openvidu/openvidu-js-demo:2.22.0
restart: on-failure
network_mode: host
environment:
- OPENVIDU_URL=https://${DOMAIN_OR_PUBLIC_IP:-}:${HTTPS_PORT:-443}
- OPENVIDU_SECRET=${OPENVIDU_SECRET}

View File

@ -7,4 +7,11 @@ if [ -n "${OPENVIDU_APPLICATION_SERVER_URL}" ]; then
public/app.js
fi
if [ -n "${SERVER_PORT}" ]; then
# Replace SERVER_PORT at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"http://localhost:${SERVER_PORT}/\";|" \
public/app.js
fi
exec node index.js "$*"

View File

@ -0,0 +1,2 @@
**/node_modules
**/build

View File

@ -0,0 +1,24 @@
FROM node:16-alpine3.16
COPY . ./openvidu-library-react
WORKDIR /openvidu-library-react
# Install openvidu-library-react dependencies and build it
RUN npm install && \
npm run build && \
cp -r ./build/ ./openvidu-basic-node/public
# Copy openvidu-basic-node
RUN cp -r ./openvidu-basic-node /opt/openvidu-basic-node && \
rm -rf ../openvidu-library-react
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
cp -r ../openvidu-basic-node .
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .
rm -rf ./openvidu-basic-node

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec node index.js "$*"

View File

@ -2612,9 +2612,9 @@
"integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ=="
},
"node_modules/@types/react": {
"version": "18.0.26",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.26.tgz",
"integrity": "sha512-hCR3PJQsAIXyxhTNSiDFY//LhnMZWpNNr5etoCqx/iUfGc5gXWtQR2Phl908jVR6uPXacojQWTg4qRpkxTuGug==",
"version": "16.14.34",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.34.tgz",
"integrity": "sha512-b99nWeGGReLh6aKBppghVqp93dFJtgtDOzc8NXM6hewD8PQ2zZG5kBLgbx+VJr7Q7WBMjHxaIl3dwpwwPIUgyA==",
"dependencies": {
"@types/prop-types": "*",
"@types/scheduler": "*",
@ -19923,9 +19923,9 @@
"integrity": "sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ=="
},
"@types/react": {
"version": "18.0.26",
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.0.26.tgz",
"integrity": "sha512-hCR3PJQsAIXyxhTNSiDFY//LhnMZWpNNr5etoCqx/iUfGc5gXWtQR2Phl908jVR6uPXacojQWTg4qRpkxTuGug==",
"version": "16.14.34",
"resolved": "https://registry.npmjs.org/@types/react/-/react-16.14.34.tgz",
"integrity": "sha512-b99nWeGGReLh6aKBppghVqp93dFJtgtDOzc8NXM6hewD8PQ2zZG5kBLgbx+VJr7Q7WBMjHxaIl3dwpwwPIUgyA==",
"requires": {
"@types/prop-types": "*",
"@types/scheduler": "*",

View File

@ -1,13 +1,13 @@
import React, { Component } from 'react';
import './App.css';
import OpenViduSession from 'openvidu-react';
import axios from 'axios';
import OpenViduSession from 'openvidu-react';
class App extends Component {
constructor(props) {
super(props);
this.APPLICATION_SERVER_URL = "http://localhost:5000/";
this.APPLICATION_SERVER_URL = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:5000/';
this.state = {
mySessionId: 'SessionA',
myUserName: 'OpenVidu_User_' + Math.floor(Math.random() * 100),

View File

@ -0,0 +1,2 @@
**/node_modules
**/build

View File

@ -0,0 +1,24 @@
FROM node:16-alpine3.16
COPY . ./openvidu-react
WORKDIR /openvidu-react
# Install openvidu-react dependencies and build it
RUN npm install && \
npm run build && \
cp -r ./build/ ./openvidu-basic-node/public
# Copy openvidu-basic-node
RUN cp -r ./openvidu-basic-node /opt/openvidu-basic-node && \
rm -rf ../openvidu-react
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
cp -r ../openvidu-basic-node .
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .
rm -rf ./openvidu-basic-node

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec node index.js "$*"

View File

@ -5,8 +5,7 @@ import React, { Component } from 'react';
import './App.css';
import UserVideoComponent from './UserVideoComponent';
const APPLICATION_SERVER_URL = "http://localhost:5000/";
const APPLICATION_SERVER_URL = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:5000/';
class App extends Component {
constructor(props) {
@ -317,12 +316,12 @@ class App extends Component {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/

View File

@ -0,0 +1,26 @@
FROM maven:3.6.3 as build
WORKDIR /openvidu-recording-java
COPY ./pom.xml pom.xml
COPY ./src/main src/main
RUN mvn clean install
RUN mvn -o package
FROM alpine:3.11
RUN apk update && \
apk add openjdk11-jre && \
rm -rf /var/cache/apk/*
# Install basic-webinar
RUN mkdir -p /opt/openvidu-recording-java
COPY --from=build /openvidu-recording-java/target/openvidu-recording-java-*.jar /opt/openvidu-recording-java/openvidu-recording-java.jar
# Entrypoint
COPY ./docker/entrypoint.sh /usr/local/bin
RUN chmod +x /usr/local/bin/entrypoint.sh
CMD /usr/local/bin/entrypoint.sh

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
docker build -f docker/Dockerfile -t "$1" .

View File

@ -0,0 +1,13 @@
#!/bin/sh
[ ! -z "${OPENVIDU_URL}" ] && echo "OPENVIDU_URL: ${OPENVIDU_URL}" || echo "OPENVIDU_URL: default"
[ ! -z "${OPENVIDU_SECRET}" ] && echo "OPENVIDU_SECRET: ${OPENVIDU_SECRET}" || echo "OPENVIDU_SECRET: default"
[ ! -z "${SERVER_PORT}" ] && echo "SERVER_PORT: ${SERVER_PORT}" || echo "SERVER_PORT: default"
# Run Application
JAVA_PROPERTIES="-Djava.security.egd=file:/dev/./urandom"
[ ! -z "${OPENVIDU_URL}" ] && JAVA_PROPERTIES=" ${JAVA_PROPERTIES} -Dopenvidu.url=${OPENVIDU_URL}"
[ ! -z "${OPENVIDU_SECRET}" ] && JAVA_PROPERTIES=" ${JAVA_PROPERTIES} -Dopenvidu.secret=${OPENVIDU_SECRET}"
[ ! -z "${SERVER_PORT}" ] && JAVA_PROPERTIES=" ${JAVA_PROPERTIES} -Dserver.port=${SERVER_PORT}"
java ${JAVA_PROPERTIES} -jar /opt/openvidu-recording-java/openvidu-recording-java.jar

View File

@ -0,0 +1,13 @@
FROM node:16-alpine3.16
# Copy openvidu-recording-node
COPY . /opt/openvidu-recording-node
# Install openvidu-recording-node dependencies
RUN npm --prefix /opt/openvidu-recording-node install
WORKDIR /opt/openvidu-recording-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec node server.js "$*"

View File

@ -3,16 +3,8 @@
var OpenVidu = require('openvidu-node-client').OpenVidu;
var OpenViduRole = require('openvidu-node-client').OpenViduRole;
// Check launch arguments: must receive openvidu-server URL and the secret
if (process.argv.length != 4) {
console.log("Usage: node " + __filename + " OPENVIDU_URL OPENVIDU_SECRET");
process.exit(-1);
}
// For demo purposes we ignore self-signed certificate
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
var port = process.env.PORT || 5000;
var useSSL = (process.env.USE_SSL === 'false') ? false : true
// Node imports
var express = require('express');
@ -21,6 +13,30 @@ var httpServer = (useSSL) ? require('https') : require('http');
var bodyParser = require('body-parser'); // Pull information from HTML POST (express4)
var app = express(); // Create our app with express
// Environment variable: PORT where the node server is listening
var SERVER_PORT = process.env.SERVER_PORT || 5000;
// Environment variable: URL where our OpenVidu server is listening
var OPENVIDU_URL = process.env.OPENVIDU_URL || process.argv[2] || 'http://localhost:4443';
// Environment variable: secret shared with our OpenVidu server
var OPENVIDU_SECRET = process.env.OPENVIDU_SECRET || process.argv[3] || 'MY_SECRET';
var useSSL = (process.env.USE_SSL === 'false') ? false : true
// Entrypoint to OpenVidu Node Client SDK
var OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
// Collection to pair session names with OpenVidu Session objects
var mapSessions = {};
// Collection to pair session names with tokens
var mapSessionNamesTokens = {};
// Listen (start app with node server.js)
var options = (useSSL) ? {
key: fs.readFileSync('openvidukey.pem'),
cert: fs.readFileSync('openviducert.pem')
} : {}
// Server configuration
app.use(express.static(__dirname + '/public')); // Set the static files location
app.use(bodyParser.urlencoded({
@ -31,29 +47,12 @@ app.use(bodyParser.json({
type: 'application/vnd.api+json'
})); // Parse application/vnd.api+json as json
// Listen (start app with node server.js)
var options = (useSSL) ? {
key: fs.readFileSync('openvidukey.pem'),
cert: fs.readFileSync('openviducert.pem')
} : {}
httpServer.createServer(options, app).listen(port);
// Environment variable: URL where our OpenVidu server is listening
var OPENVIDU_URL = process.argv[2];
// Environment variable: secret shared with our OpenVidu server
var OPENVIDU_SECRET = process.argv[3];
// Entrypoint to OpenVidu Node Client SDK
var OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
// Collection to pair session names with OpenVidu Session objects
var mapSessions = {};
// Collection to pair session names with tokens
var mapSessionNamesTokens = {};
console.log(`App listening with ${(useSSL) ? "https": "http"} on port ${port} connected to OpenVidu at ${OPENVIDU_URL}`);
httpServer.createServer(options, app).listen(SERVER_PORT, () => {
console.log(`App listening with ${(useSSL) ? "https": "http"} on port ${SERVER_PORT}`);
console.log(`OPENVIDU_URL: ${OPENVIDU_URL}`);
console.log(`OPENVIDU_SECRET: ${OPENVIDU_SECRET}`);
});
/* Session API */

View File

@ -10,7 +10,7 @@ RUN mvn -o package
FROM alpine:3.11
RUN apk update && \
apk add openjdk8-jre && \
apk add openjdk11-jre && \
rm -rf /var/cache/apk/*
# Install basic-webinar

View File

@ -5,4 +5,4 @@ if [ $# -eq 0 ]; then
fi
pushd ../
docker build -f docker/Dockerfile -t "$1" .
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .

View File

@ -1,11 +0,0 @@
version: '3.1'
services:
app:
image: openvidu/openvidu-basic-webinar-demo:2.18.0
restart: on-failure
network_mode: host
environment:
- SERVER_PORT=5442
- OPENVIDU_URL=http://localhost:5443
- OPENVIDU_SECRET=${OPENVIDU_SECRET}

View File

@ -0,0 +1,13 @@
FROM node:16-alpine3.16
# Copy openvidu-roles-node
COPY . /opt/openvidu-roles-node
# Install openvidu-roles-node dependencies
RUN npm --prefix /opt/openvidu-roles-node install
WORKDIR /opt/openvidu-roles-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,8 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec node server.js "$*"

View File

@ -3,11 +3,6 @@
var OpenVidu = require('openvidu-node-client').OpenVidu;
var OpenViduRole = require('openvidu-node-client').OpenViduRole;
// Check launch arguments: must receive openvidu-server URL and the secret
if (process.argv.length != 4) {
console.log("Usage: node " + __filename + " OPENVIDU_URL OPENVIDU_SECRET");
process.exit(-1);
}
// For demo purposes we ignore self-signed certificate
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"
@ -19,27 +14,26 @@ var https = require('https');
var bodyParser = require('body-parser'); // Pull information from HTML POST (express4)
var app = express(); // Create our app with express
// Server configuration
app.use(session({
saveUninitialized: true,
resave: false,
secret: 'MY_SECRET'
}));
app.use(express.static(__dirname + '/public')); // Set the static files location
app.use(bodyParser.urlencoded({
'extended': 'true'
})); // Parse application/x-www-form-urlencoded
app.use(bodyParser.json()); // Parse application/json
app.use(bodyParser.json({
type: 'application/vnd.api+json'
})); // Parse application/vnd.api+json as json
// Environment variable: PORT where the node server is listening
var SERVER_PORT = process.env.SERVER_PORT || 5000;
// Environment variable: URL where our OpenVidu server is listening
var OPENVIDU_URL = process.env.OPENVIDU_URL || process.argv[2] || 'http://localhost:4443';
// Environment variable: secret shared with our OpenVidu server
var OPENVIDU_SECRET = process.env.OPENVIDU_SECRET || process.argv[3] || 'MY_SECRET';
// Entrypoint to OpenVidu Node Client SDK
var OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
// Collection to pair session names with OpenVidu Session objects
var mapSessions = {};
// Collection to pair session names with tokens
var mapSessionNamesTokens = {};
// Listen (start app with node server.js)
var options = {
key: fs.readFileSync('openvidukey.pem'),
cert: fs.readFileSync('openviducert.pem')
};
https.createServer(options, app).listen(5000);
// Mock database
var users = [{
@ -56,20 +50,28 @@ var users = [{
role: OpenViduRole.SUBSCRIBER
}];
// Environment variable: URL where our OpenVidu server is listening
var OPENVIDU_URL = process.argv[2];
// Environment variable: secret shared with our OpenVidu server
var OPENVIDU_SECRET = process.argv[3];
// Entrypoint to OpenVidu Node Client SDK
var OV = new OpenVidu(OPENVIDU_URL, OPENVIDU_SECRET);
// Server configuration
app.use(session({
saveUninitialized: true,
resave: false,
secret: 'MY_SECRET'
}));
app.use(express.static(__dirname + '/public')); // Set the static files location
app.use(bodyParser.urlencoded({
'extended': 'true'
})); // Parse application/x-www-form-urlencoded
app.use(bodyParser.json()); // Parse application/json
app.use(bodyParser.json({
type: 'application/vnd.api+json'
})); // Parse application/vnd.api+json as json
// Collection to pair session names with OpenVidu Session objects
var mapSessions = {};
// Collection to pair session names with tokens
var mapSessionNamesTokens = {};
console.log("App listening on port 5000");
https.createServer(options, app).listen(SERVER_PORT, () => {
console.log(`App listening on port ${SERVER_PORT}`);
console.log(`OPENVIDU_URL: ${OPENVIDU_URL}`);
console.log(`OPENVIDU_SECRET: ${OPENVIDU_SECRET}`);
});
/* CONFIGURATION */

View File

@ -1,10 +0,0 @@
version: '3.1'
services:
app:
image: openvidu/openvidu-speech-to-text-demo:2.22.0
restart: on-failure
network_mode: host
environment:
- OPENVIDU_URL=https://${DOMAIN_OR_PUBLIC_IP:-}:${HTTPS_PORT:-443}
- OPENVIDU_SECRET=${OPENVIDU_SECRET}

View File

@ -7,4 +7,11 @@ if [ -n "${OPENVIDU_APPLICATION_SERVER_URL}" ]; then
public/app.js
fi
if [ -n "${SERVER_PORT}" ]; then
# Replace SERVER_PORT at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"http://localhost:${SERVER_PORT}/\";|" \
public/app.js
fi
exec node index.js "$*"

View File

@ -0,0 +1,17 @@
FROM node:16-alpine3.16
# Copy openvidu-basic-node
COPY ./openvidu-basic-node /opt/openvidu-basic-node
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
# Copy static files to openvidu-basic-node
RUN mkdir -p /opt/openvidu-basic-node/public
COPY ./web /opt/openvidu-basic-node/public
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
cp -r ../openvidu-basic-node .
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .
rm -rf ./openvidu-basic-node

View File

@ -0,0 +1,17 @@
#!/bin/sh
if [ -n "${OPENVIDU_APPLICATION_SERVER_URL}" ]; then
# Replace OPENVIDU_APPLICATION_SERVER_URL at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"${OPENVIDU_APPLICATION_SERVER_URL}/\";|" \
public/app.js
fi
if [ -n "${SERVER_PORT}" ]; then
# Replace SERVER_PORT at frontend app
sed -i \
"s|var APPLICATION_SERVER_URL = \"http://localhost:5000/\";|var APPLICATION_SERVER_URL = \"http://localhost:${SERVER_PORT}/\";|" \
public/app.js
fi
exec node index.js "$*"

View File

@ -0,0 +1,2 @@
**/node_modules
**/dist

View File

@ -0,0 +1,24 @@
FROM node:16-alpine3.16
COPY . ./openvidu-vue
WORKDIR /openvidu-vue
# Install openvidu-vue dependencies and build it
RUN npm install && \
npm run build && \
cp -r ./dist/ ./openvidu-basic-node/public
# Copy openvidu-basic-node
RUN cp -r ./openvidu-basic-node /opt/openvidu-basic-node && \
rm -rf ../openvidu-vue
# Install openvidu-basic-node dependencies
RUN npm --prefix /opt/openvidu-basic-node install
WORKDIR /opt/openvidu-basic-node
COPY docker/entrypoint.sh .
ENTRYPOINT [ "./entrypoint.sh" ]

View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ $# -eq 0 ]; then
echo "No version argument provided. Usage: \"./create_image.sh <IMAGE_NAME>\""
exit 1
fi
pushd ../
cp -r ../openvidu-basic-node .
trap 'rm -rf ./openvidu-basic-node' ERR
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$1" .
rm -rf ./openvidu-basic-node

View File

@ -0,0 +1,3 @@
#!/bin/sh
exec node index.js "$*"

File diff suppressed because it is too large Load Diff

View File

@ -14,12 +14,12 @@
"vue": "2.6.12"
},
"devDependencies": {
"@vue/cli-plugin-babel": "4.5.11",
"@vue/cli-plugin-eslint": "4.5.11",
"@vue/cli-service": "4.5.11",
"babel-eslint": "10.1.0",
"eslint": "7.21.0",
"eslint-plugin-vue": "7.7.0",
"@babel/eslint-parser": "7.19.1",
"@vue/cli-plugin-babel": "5.0.8",
"@vue/cli-plugin-eslint": "5.0.8",
"@vue/cli-service": "5.0.8",
"eslint": "8.31.0",
"eslint-plugin-vue": "9.8.0",
"vue-template-compiler": "2.6.12"
},
"eslintConfig": {
@ -32,7 +32,7 @@
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
"parser": "@babel/eslint-parser"
},
"rules": {}
},

View File

@ -43,13 +43,13 @@
</template>
<script>
import { OpenVidu } from "openvidu-browser";
import axios from "axios";
import { OpenVidu } from "openvidu-browser";
import UserVideo from "./components/UserVideo";
axios.defaults.headers.post["Content-Type"] = "application/json";
const APPLICATION_SERVER_URL = "http://localhost:5000/";
const APPLICATION_SERVER_URL = process.env.NODE_ENV === 'production' ? '' : 'http://localhost:5000/';
export default {
name: "App",
@ -169,12 +169,12 @@ export default {
* --------------------------------------------
* The methods below request the creation of a Session and a Token to
* your application server. This keeps your OpenVidu deployment secure.
*
*
* In this sample code, there is no user control at all. Anybody could
* access your application server endpoints! In a real production
* environment, your application server must identify the user to allow
* access to the endpoints.
*
*
* Visit https://docs.openvidu.io/en/stable/application-server to learn
* more about the integration of OpenVidu in your application server.
*/