-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
127 changed files
with
27,520 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Build OpenVidu Call for production | ||
FROM --platform=linux/amd64 node:20 as openvidu-call-build | ||
|
||
WORKDIR /openvidu-call | ||
|
||
ARG BASE_HREF=/ | ||
|
||
COPY . . | ||
|
||
# Build OpenVidu Call frontend | ||
RUN cd openvidu-call-front && npm install && \ | ||
npm run prod:build ${BASE_HREF} && \ | ||
cd ../ && rm -rf openvidu-call-front | ||
|
||
FROM node:20-alpine3.19 | ||
|
||
WORKDIR /opt/openvidu-call | ||
|
||
COPY --from=openvidu-call-build /openvidu-call/openvidu-call-back . | ||
|
||
RUN npm install -g npm | ||
|
||
# Install backend dependencies and build it for production | ||
RUN npm install && \ | ||
npm run build | ||
|
||
# Entrypoint | ||
COPY docker/entrypoint.sh /usr/local/bin/entrypoint.sh | ||
RUN apk add --no-cache curl && \ | ||
chmod +x /usr/local/bin/entrypoint.sh && \ | ||
chown -R node:node /opt/openvidu-call | ||
|
||
USER node | ||
|
||
EXPOSE $SERVER_PORT | ||
|
||
CMD ["/usr/local/bin/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -x | ||
|
||
IMAGE=${1:-?echo "Error: You need to specify an image name as first argument"?} | ||
if [[ -n $IMAGE ]]; then | ||
cd .. | ||
export BUILDKIT_PROGRESS=plain && docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$IMAGE" --build-arg BASE_HREF=/ . | ||
else | ||
echo "Error: You need to specify a version as first argument" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash -x | ||
|
||
IMAGE="${1:-?echo "Error: You need to specify an image name as first argument"?}" | ||
if [[ -n $VERSION ]]; then | ||
cd .. | ||
docker build --pull --no-cache --rm=true -f docker/Dockerfile -t "$IMAGE"-demos --build-arg BASE_HREF=/openvidu-call/ . | ||
else | ||
echo "Error: You need to specify a version as first argument" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh | ||
|
||
# Function to handle termination signals | ||
terminate_process() { | ||
echo "Terminating Node.js process..." | ||
pkill -TERM node | ||
} | ||
|
||
# Trap termination signals | ||
trap terminate_process TERM INT | ||
|
||
if [ -z "${LIVEKIT_URL}" ]; then | ||
echo "LIVEKIT_URL is required" | ||
echo "example: docker run -e LIVEKIT_URL=https://livekit-server:7880 -e LIVEKIT_API_KEY=api_key -e LIVEKIT_API_SECRET=api_secret -p 5000:5000 openvidu-call" | ||
exit 1 | ||
fi | ||
if [ -z "${LIVEKIT_API_KEY}" ]; then | ||
echo "LIVEKIT_API_KEY is required" | ||
echo "example: docker run -e LIVEKIT_URL=https://livekit-server:7880 -e LIVEKIT_API_KEY=api_key -e LIVEKIT_API_SECRET=api_secret -p 5000:5000 openvidu-call" | ||
exit 1 | ||
fi | ||
if [ -z "${LIVEKIT_API_SECRET}" ]; then | ||
echo "LIVEKIT_API_SECRET is required" | ||
echo "example: docker run -e LIVEKIT_URL=https://livekit-server:7880 -e LIVEKIT_API_KEY=api_key -e LIVEKIT_API_SECRET=api_secret -p 5000:5000 openvidu-call" | ||
exit 1 | ||
fi | ||
|
||
# openvidu-call configuration | ||
cat>/opt/openvidu-call/.env<<EOF | ||
SERVER_PORT=${SERVER_PORT} | ||
LIVEKIT_URL=${LIVEKIT_URL} | ||
LIVEKIT_URL_PRIVATE=${LIVEKIT_URL_PRIVATE} | ||
LIVEKIT_API_KEY=${LIVEKIT_API_KEY} | ||
LIVEKIT_API_SECRET=${LIVEKIT_API_SECRET} | ||
USE_HTTPS=${USE_HTTPS} | ||
CALL_ADMIN_SECRET=${CALL_ADMIN_SECRET} | ||
CALL_PRIVATE_ACCESS=${CALL_PRIVATE_ACCESS} | ||
CALL_USER=${CALL_USER} | ||
CALL_SECRET=${CALL_SECRET} | ||
CALL_RECORDING=${CALL_RECORDING} | ||
CALL_BROADCAST=${CALL_BROADCAST} | ||
CALL_RECORDING_PATH=${CALL_RECORDING_PATH} | ||
EOF | ||
|
||
cd /opt/openvidu-call | ||
node dist/server.js & | ||
|
||
# Save the PID of the Node.js process | ||
node_pid=$! | ||
|
||
# Wait for the Node.js process to finish | ||
wait $node_pid |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true, | ||
"node": true | ||
}, | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": { | ||
"@typescript-eslint/no-inferrable-types": "warn", | ||
"@typescript-eslint/no-unused-vars": "warn", | ||
"lines-between-class-members": [ | ||
"warn", | ||
{ | ||
"enforce": [ | ||
{ | ||
"blankLine": "always", | ||
"prev": "method", | ||
"next": "method" | ||
} | ||
] | ||
} | ||
], | ||
"padding-line-between-statements": [ | ||
"warn", | ||
{ | ||
"blankLine": "always", | ||
"prev": "*", | ||
"next": ["if", "for", "while", "switch"] | ||
}, | ||
{ | ||
"blankLine": "always", | ||
"prev": ["if", "for", "while", "switch"], | ||
"next": "*" | ||
}, | ||
{ "blankLine": "always", "prev": "*", "next": "block-like" }, | ||
{ "blankLine": "always", "prev": "block-like", "next": "*" } | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"trailingComma": "none", | ||
"semi": true, | ||
"bracketSpacing": true, | ||
"useTabs": true, | ||
"jsxSingleQuote": true, | ||
"tabWidth": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "Launch OpenVidu Call Back", | ||
"program": "${workspaceFolder}/src/server.ts", | ||
"preLaunchTask": "tsc: build - tsconfig.json", | ||
"outFiles": ["${workspaceFolder}/dist/**/*.js"] | ||
} | ||
] | ||
} |
Oops, something went wrong.