Update documantation & scripts.

This commit is contained in:
dev
2024-12-12 00:20:41 +02:00
parent 59fea610aa
commit 7b6b7fd5cc
16 changed files with 415 additions and 117 deletions

View File

@@ -1,50 +1,84 @@
# Callaba On-Premise Installation on Linux
# Callaba On-Premise 8.1 Installation
## Requirements
- Ubuntu 22.04
- Docker
## Preparation
## Step 1. Preparation
- Clone the repository:
```console
git clone https://gitlab.callabacloud.com/callaba-8/linux.git
git clone https://gitlab.callabacloud.com/callaba-8/linux-8.1.git
```
- Navigate to the folder:
```console
cd linux/
cd linux-8.1/
```
- Update packages and install requirements. If the machine is clean, you can simply run:
```console
bash prepare.sh
sudo bash prepare.sh
```
## Installation
## Step 2. Installation with regular CPU transcoding usage
After the requirements are installed, run the installation script. When prompted, enter your login and password for the registry:
```console
bash install.sh
sudo bash install.sh 8.1.NDI.pre
```
## Update
## Or installation with NVIDIA GPU support
After the requirements are installed, run the installation script. When prompted, enter your login and password for the registry:
```console
sudo bash install.sh 8.1.NDI.pre nvidia
```
## Or installation with XILINX accelerated transcoding support
After the requirements are installed, run the installation script. When prompted, enter your login and password for the registry:
```console
sudo bash install.sh 8.1.NDI.pre xilinx
```
## Step 3. Launch Callaba Dashboard
After installation, please wait 2-3 minutes for the dashboard to initialize. It will be available at [http://127.0.0.1:80](http://127.0.0.1:80).
![Image Description](./dashboard.png)
## Step 4. Login to Callaba Dashboard
By default, the login and password are `admin/password`. To purchase a license, use your [personal account](https://callaba.io/auth/sign-in) for on-premise.
## Update or downgrade
To update Callaba, run the following command:
```console
bash update.sh
sudo bash install.sh VERSION GPU_TYPE (nvidia | xilinx or cpu)
```
## Rollback
If something goes wrong, rollback the application using:
```console
bash rollback.sh
```
## Removal
## Uninstall
To remove Callaba, run the following command. **Note:** This will delete all data and images:
```console
bash remove.sh
sudo bash remove.sh
```
## Reset password
To reset Callaba password, run the following command:
```console
sudo bash remove.sh
```
## Contact support
Use the **Contact Support** button directly from your dashboard.
![Image Description](./assets/support.png)

1
STACK_VERSION.txt Normal file
View File

@@ -0,0 +1 @@
8.1.NDI.pre

BIN
assets/dashboard.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
assets/support.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

View File

@@ -0,0 +1,129 @@
version: '3.9'
services:
cc-mongo:
container_name: callabacloud-mongo
image: registry.callabacloud.com/callaba-selfhosted/cc-mongo:${STACK_VERSION}-selfhosted
restart: always
network_mode: "host"
command: ["mongod", "--quiet", "--config", "/etc/mongodb.conf", "--replSet", "rs0", "--bind_ip_all", "--port", "27017"]
volumes:
- db_data:/data/db2
cc-mongo-certdb:
container_name: callabacloud-mongo-certdb
image: registry.callabacloud.com/callaba-selfhosted/cc-mongo:${STACK_VERSION}-selfhosted
restart: always
network_mode: "host"
command: ["mongod", "--quiet", "--config", "/etc/mongodb.conf", "--bind_ip_all", "--port", "27018"]
volumes:
- cert_db_data:/data/db2
cc-api:
container_name: callabacloud-api
image: registry.callabacloud.com/callaba-selfhosted/cc-api-prod:${STACK_VERSION}-selfhosted
restart: always
cap_add:
- SYS_ADMIN
devices:
- /dev/fuse
- /dev/mapper/vgubuntu-root
security_opt:
- apparmor:unconfined
volumes:
- records:/cc-api/recorded
- uploads:/cc-api/uploaded
- pass:/opt/volume
- certs:/cc-api/build/ssl
- configs:/cc-api/build/nginx-http-conf/
- rtmp_configs:/cc-api/build/tmp-rtmp-conf
- chunks:/mnt
- ./webrtc/livekit.yaml:/etc/livekit.yaml
- ./webrtc/egress.conf:/etc/egress.conf
- ./webrtc/ingress.conf:/etc/ingress.conf
- ./webrtc/ndi-config.v1.json:/etc/ndi-config.v1.json
- ./webrtc/etc-ntpsec-ntp.conf:/etc/etc-ntpsec-ntp.conf
# external
- /var/run/docker.sock:/var/run/docker.sock
- /dev/fuse:/dev/fuse
- /var/run/dbus:/var/run/dbus
network_mode: "host"
extra_hosts:
- "localhost-event:127.0.0.1"
privileged: true
depends_on:
- cc-mongo
environment:
- NVIDIA_VISIBLE_DEVICES=all
- NVIDIA_DRIVER_CAPABILITIES=all
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
cc-nginx:
container_name: callabacloud-nginx
image: registry.callabacloud.com/callaba-selfhosted/cc-nginx-prod:${STACK_VERSION}-selfhosted
restart: always
cap_add:
- SYS_ADMIN
devices:
- /dev/fuse
security_opt:
- apparmor:unconfined
volumes:
- certs:/etc/ssl/callaba/
- configs:/etc/nginx/conf.d
- rtmp_configs:/etc/nginx/rtmp_conf.d/
- chunks:/mnt
- /dev/fuse:/dev/fuse
network_mode: "host"
extra_hosts:
- "localhost-event:127.0.0.1"
depends_on:
- cc-api
cc-front:
container_name: callabacloud-front
image: registry.callabacloud.com/callaba-selfhosted/cc-front-prod:${STACK_VERSION}-selfhosted
restart: always
network_mode: "host"
cc-monitoring:
image: registry.callabacloud.com/callaba-selfhosted/cc-monitoring:${STACK_VERSION}
container_name: callabacloud-monitoring
restart: always
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- grafana_data:/var/lib/grafana/
- prometheus_data:/data/
ports:
- 127.0.0.1:3031:3031
volumes:
records:
name: callabacloud-records
uploads:
name: callabacloud-uploads
db_data:
name: callabacloud-db_data
cert_db_data:
name: callabacloud-cert_db_data
pass:
name: callabacloud-pass
certs:
name: callabacloud-certs
grafana_data:
name: callabacloud-grafana_data
prometheus_data:
name: callabacloud-prometheus_data
configs:
name: callabacloud-configs
rtmp_configs:
name: callabacloud-rtmp_configs
chunks:
name: callabacloud-chunks

View File

@@ -39,8 +39,8 @@ services:
- ./webrtc/livekit.yaml:/etc/livekit.yaml
- ./webrtc/egress.conf:/etc/egress.conf
- ./webrtc/ingress.conf:/etc/ingress.conf
- ./ndi-config.v1.json:/etc/ndi-config.v1.json
- ./etc-ntpsec-ntp.conf:/etc/etc-ntpsec-ntp.conf
- ./webrtc/ndi-config.v1.json:/etc/ndi-config.v1.json
- ./webrtc/etc-ntpsec-ntp.conf:/etc/etc-nuspec-ntp.conf
# external
- /var/run/docker.sock:/var/run/docker.sock
- /dev/fuse:/dev/fuse
@@ -60,6 +60,13 @@ services:
- configs:/etc/nginx/conf.d
- rtmp_configs:/etc/nginx/rtmp_conf.d/
- chunks:/mnt
- /dev/fuse:/dev/fuse
cap_add:
- SYS_ADMIN
devices:
- /dev/fuse
security_opt:
- apparmor:unconfined
network_mode: "host"
extra_hosts:
- "localhost-event:127.0.0.1"

View File

@@ -1,66 +1,104 @@
#!/bin/bash
STACK_VERSION=""
STACK_VERSION=$1
PROCESSOR_TYPE=$2
$COMPOSE_FILE
get_stack_version() {
if [ $# -gt 0 ]; then
STACK_VERSION="$1"
if [[ -n "$STACK_VERSION" ]]; then
echo 'use provided version'
echo $STACK_VERSION
else
STACK_VERSION=$(curl -X 'GET' 'https://api.callabacloud.com/getCallabaCloudVersion' --header "Content-Type: application/json" -d '{"version_name":"parrot"}' | jq -r '.[].version_number')
STACK_VERSION=$(curl -X 'GET' 'https://api.callabacloud.com/getCallabaCloudVersion' \
--header "Content-Type: application/json" \
-d '{"version_name":"parrot"}' | jq -r '.[].version_number')
echo 'use version by default'
fi
if [[ $? -ne 0 ]]; then
if [[ $? -ne 0 || -z "$STACK_VERSION" ]]; then
echo "Error: Failed to get stack version"
exit 1
fi
echo $STACK_VERSION >STACK_VERSION.txt
export STACK_VERSION
}
start_docker_compose() {
echo $STACK_VERSION
sudo -E docker-compose -f docker-compose.cc-full-run-linux.yml up -d
if [[ "$PROCESSOR_TYPE" == "nvidia" ]]; then
echo 'Installing with NVIDIA CUDA...'
COMPOSE_FILE="docker-compose.cc-full-run-linux-nvidia.yml"
else
echo 'Installing...'
COMPOSE_FILE="docker-compose.cc-full-run-linux.yml"
fi
sudo -E docker-compose -f $COMPOSE_FILE up -d
if [[ $? -ne 0 ]]; then
echo "Error: Failed to start docker-compose with Callaba Cloud"
exit 1
fi
sudo -E docker-compose -f webrtc/docker-compose.cc-webrtc.yml up -d
sudo -E docker exec callabacloud-api rm /opt/installation-unfinished
sudo -E docker restart callabacloud-api
if [[ $? -ne 0 ]]; then
echo "Error: Failed to start docker-compose with Callaba Cloud"
exit 1
else
echo ' ######################################################################
########### Callaba Cloud has been installed successfully ###########
######################################################################'
else
echo "Callaba on-premise $STACK_VERSION has installed successfully"
fi
}
set_iptables() {
# Ensure the /etc/iptables directory exists
if [ ! -d /etc/iptables/ ]; then
sudo mkdir /etc/iptables/
sudo mkdir -p /etc/iptables/
fi
sudo chmod 666 /etc/iptables/rules.v4
# Create the rules.v4 file if it doesn't exist
if [ ! -f /etc/iptables/rules.v4 ]; then
sudo touch /etc/iptables/rules.v4
fi
# Set permissions for the rules.v4 file
sudo chmod 600 /etc/iptables/rules.v4
# Add iptables rules
sudo iptables -I INPUT -i lo -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 3000 -j DROP
sudo iptables -A INPUT -p tcp --dport 3021 -j DROP
sudo iptables -A INPUT -p tcp --dport 3031 -j DROP
sudo iptables -A INPUT -p tcp --dport 27017 -j DROP
sudo iptables -A INPUT -p tcp --dport 27019 -j DROP
sudo iptables -A INPUT -p tcp --dport 6379 -j DROP
# Check if iptables rules were set successfully
if [[ $? -ne 0 ]]; then
echo "Error: Failed to set iptables"
echo "Error: Failed to set iptables rules"
exit 1
fi
sudo iptables-save > /etc/iptables/rules.v4
# Save iptables rules
sudo iptables-legacy-save >/etc/iptables/rules.v4
if [[ $? -ne 0 ]]; then
echo "Error: Failed to save iptables rules"
exit 1
fi
echo "iptables rules set and saved successfully."
}
main() {
get_stack_version
start_docker_compose
set_iptables
echo "Are you sure you want to install Callaba $STACK_VERSION ? (y/yes to confirm)"
read -r confirmation
if [[ "$confirmation" == "y" || "$confirmation" == "yes" ]]; then
get_stack_version
start_docker_compose
echo -e "Within 2-3 minutes, Callaba Dashboard will be available at \033[4;34mhttp://public-ip\033[0m, for example, \033[4;34mhttp://127.0.0.1\033[0m."
echo -e "For the first login, use the username \033[1madmin\033[0m and the password \033[1mpassword\033[0m."
echo -e "Don't forget to change it to a new password."
#set_iptables
else
echo "Operation cancelled."
fi
}
main

31
remove-containers-and-data.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/bash
echo "This will stop and remove all Docker containers, volumes, plugins, prune the system, and delete STACK_VERSION.txt."
read -p "Are you sure you want to proceed? Type 'yes' or 'y' to confirm: " confirm
if [[ "$confirm" == "yes" || "$confirm" == "y" ]]; then
echo "Stopping all containers..."
docker stop $(docker ps -a -q)
echo "Removing all containers..."
docker rm $(docker ps -a -q)
echo "Removing all volumes..."
docker volume rm $(docker volume ls -q)
echo "Removing all plugins..."
docker plugin rm $(docker plugin ls -q)
echo "Pruning all volumes..."
docker volume prune -f
echo "Pruning the system..."
docker system prune -f
echo "Deleting STACK_VERSION.txt..."
rm -f STACK_VERSION.txt
echo "All operations completed."
else
echo "Operation canceled."
fi

View File

@@ -31,7 +31,8 @@ remove_containers() {
}
remove_images() {
local images=$(sudo docker images -q --filter=reference="registry.callabacloud.com/*/*:*")
OLD_STACK_VERSION=$(cat STACK_VERSION.txt)
local images=$(sudo docker images -q --filter=reference="registry.callabacloud.com/*/*:$OLD_STACK_VERSION")
if [[ -n "$images" ]]; then
if sudo docker rmi -f $images; then
@@ -70,8 +71,8 @@ prune_network() {
}
delete_rules() {
local ports=(3000 3021 3031 27017)
local ports=(3000 3021 3031 27017, 27019, 6379)
sudo chmod 600 /etc/iptables/rules.v4
for port in ${ports[@]}; do
if sudo iptables -D INPUT -p tcp --dport $port -j DROP; then
echo "Rule for port $port deleted successfully"
@@ -80,7 +81,7 @@ delete_rules() {
fi
done
if sudo iptables-save > /etc/iptables/rules.v4; then
if sudo iptables-legacy-save >/etc/iptables/rules.v4 ; then
echo "Iptables rules saved successfully"
else
echo "Error: Unable to save iptables rules" >&2
@@ -88,11 +89,23 @@ delete_rules() {
fi
}
echo "Uninstalling Callaba Cloud has been started. Please don't stop this process. It may take about 2 minutes."
echo "Uninstalling... It may take some time."
stop_containers
remove_containers
remove_images
remove_volumes
prune_network
delete_rules
main() {
echo "Are you sure you want to remove Callaba $STACK_VERSION ? (y/yes to confirm)"
read -r confirmation
if [[ "$confirmation" == "y" || "$confirmation" == "yes" ]]; then
echo "Uninstalling... It may take some time."
rm -f STACK_VERSION.txt
stop_containers
remove_containers
remove_images
remove_volumes
prune_network
delete_rules
else
echo "Operation cancelled."
fi
}
main

19
reset-password.sh Normal file → Executable file
View File

@@ -1,8 +1,19 @@
#!/bin/bash
# Prompt for confirmation
echo "Are you sure you want to reset the admin password? (y/yes to confirm)"
read -r confirmation
source /var/lib/docker/volumes/callabacloud-pass/_data/pass.txt
if [[ "$confirmation" == "y" || "$confirmation" == "yes" ]]; then
echo "Proceeding with password reset..."
source /var/lib/docker/volumes/callabacloud-pass/_data/pass.txt
# Set the default password
NEW_PASSWORD='$2b$10$gJFKDTOstLTSF4wJF.uGbeBUhm0vBm7KlDraOkAFcdsq1YrEvk.ca'
NEW_PASSWORD='$2b$10$gJFKDTOstLTSF4wJF.uGbeBUhm0vBm7KlDraOkAFcdsq1YrEvk.ca'
MONGO_COMMAND="db.usermodel.updateOne({ email : 'admin' }, { \$set: { password : '${NEW_PASSWORD}' } });"
# Update the password in MongoDB
MONGO_COMMAND="db.usermodel.updateOne({ email : 'admin' }, { \$set: { password : '${NEW_PASSWORD}' } });"
docker exec callabacloud-mongo mongo peers -u peersUser -p "$PEERSPASS" --eval "${MONGO_COMMAND}"
docker exec callabacloud-mongo mongo peers -u peersUser -p "$PEERSPASS" --eval "${MONGO_COMMAND}"
echo "Password has been reset to the default: 'password'."
else
echo "Operation cancelled."
fi

View File

@@ -1,31 +0,0 @@
#!/bin/bash
export_variable() {
export $(cut -d= -f1 last_ver.txt)
source last_ver.txt
if [[ $? -ne 0 ]]; then
echo "Error: Failed to get previous version"
exit 1
fi
echo "STACK_VERSION=$STACK_VERSION"
}
start_docker_compose() {
sudo -E docker-compose -f docker-compose.cc-full-run-linux.yml up -d
if [[ $? -ne 0 ]]; then
echo "Error: Failed to start docker-compose"
exit 1
else
echo " ######################################################################
############# Callaba Cloud has been restored to version $STACK_VERSION
######################################################################"
fi
}
main() {
export_variable
start_docker_compose
}
main

6
test.md Normal file
View File

@@ -0,0 +1,6 @@
# WITHOUT NVIDIA CUDA [DEV ONLY]
# 1. Stop & remove containers
./clean-containers
# Install
./install.sh 8.1.pre-selfhosted

122
update.sh
View File

@@ -1,55 +1,113 @@
#!/bin/bash
STACK_VERSION=$1
PROCESSOR_TYPE=$2
$COMPOSE_FILE
write_stack_version() {
STACK_VERSION=$(curl -X 'POST' 'http://127.0.0.1/api/application/getAppInfo' -H 'accept: application/json' | jq -r '.stack_version')
if [[ $? -ne 0 ]]; then
echo "Error: Failed to get stack version from the application"
exit 1
fi
echo "STACK_VERSION=${STACK_VERSION}" > last_ver.txt
}
export_stack_version() {
if [ $# -gt 0 ]; then
STACK_VERSION="$1"
get_stack_version() {
if [[ -n "$STACK_VERSION" ]]; then
echo 'use provided version'
echo $STACK_VERSION
else
STACK_VERSION=$(curl -X 'GET' 'https://api.callabacloud.com/getCallabaCloudVersion' --header "Content-Type: application/json" -d '{"version_name":"parrot"}' | jq -r '.[].version_number')
STACK_VERSION=$(curl -X 'GET' 'https://api.callabacloud.com/getCallabaCloudVersion' \
--header "Content-Type: application/json" \
-d '{"version_name":"parrot"}' | jq -r '.[].version_number')
echo 'use version by default'
echo $STACK_VERSION
fi
if [[ $? -ne 0 ]]; then
echo "Error: Failed to get stack version from Callaba Cloud"
if [[ $? -ne 0 || -z "$STACK_VERSION" ]]; then
echo "Error: Failed to get stack version"
exit 1
fi
export STACK_VERSION
}
pull_images() {
sudo -E docker pull registry.callabacloud.com/callaba-selfhosted/cc-api-prod:${STACK_VERSION}-selfhosted
sudo -E docker pull registry.callabacloud.com/callaba-selfhosted/cc-front-prod:${STACK_VERSION}-selfhosted
sudo -E docker pull registry.callabacloud.com/callaba-selfhosted/cc-nginx-prod:${STACK_VERSION}-selfhosted
sudo -E docker pull registry.callabacloud.com/callaba-selfhosted/cc-mongo:${STACK_VERSION}-selfhosted
if [[ $? -ne 0 ]]; then
echo "Error: Failed to pull docker-compose image"
exit 1
stop_containers() {
local containers=$(sudo docker ps -q --filter='name=callabacloud-*')
if [[ -n "$containers" ]]; then
if sudo docker stop --time 60 $containers; then
echo "Stopped successfully"
else
echo "Error: Unable to stop containers" >&2
return 1
fi
else
echo "No containers to stop"
fi
}
remove_containers() {
local containers=$(sudo docker ps -a -q --filter='name=callabacloud-*')
if [[ -n "$containers" ]]; then
if sudo docker rm $containers; then
echo "Removed successfully"
else
echo "Error: Unable to remove containers" >&2
return 1
fi
else
echo "No containers to remove"
fi
}
remove_old_images() {
OLD_STACK_VERSION=$(cat STACK_VERSION.txt)
local images=$(sudo docker images -q --filter=reference="registry.callabacloud.com/*/*:$OLD_STACK_VERSION")
if [[ -n "$images" ]]; then
if sudo docker rmi -f $images; then
echo "Images are removed successfully"
else
echo "Error: Unable to remove images" >&2
return 1
fi
else
echo "No images to remove"
fi
}
start_docker_compose() {
sudo -E docker-compose -f docker-compose.cc-full-run-linux.yml up -d
echo $STACK_VERSION
if [[ "$PROCESSOR_TYPE" == "nvidia" ]]; then
echo 'Installing with NVIDIA CUDA...'
COMPOSE_FILE="docker-compose.cc-full-run-linux-nvidia.yml"
else
echo 'Installing...'
COMPOSE_FILE="docker-compose.cc-full-run-linux.yml"
fi
sudo -E docker-compose -f $COMPOSE_FILE up -d
if [[ $? -ne 0 ]]; then
echo "Error: Failed to start docker-compose"
echo "Error: Failed to start docker-compose with Callaba Cloud"
exit 1
fi
sudo -E docker-compose -f webrtc/docker-compose.cc-webrtc.yml up -d
sudo -E docker exec callabacloud-api rm /opt/installation-unfinished
sudo -E docker restart callabacloud-api
if [[ $? -ne 0 ]]; then
echo "Error: Failed to start docker-compose with Callaba Cloud"
exit 1
else
echo " ######################################################################
###### Callaba Cloud has been upgraded to version $STACK_VERSION
######################################################################"
echo "Callaba on-premise $STACK_VERSION has deployed successfully"
fi
}
main() {
write_stack_version
export_stack_version
pull_images
start_docker_compose
echo "Are you sure you want to update/downgrade Callaba $STACK_VERSION ? (y/yes to confirm)"
read -r confirmation
if [[ "$confirmation" == "y" || "$confirmation" == "yes" ]]; then
get_stack_version
stop_containers
remove_containers
start_docker_compose
remove_old_images
echo $STACK_VERSION >STACK_VERSION.txt
echo -e "Within 2-3 minutes, Callaba Dashboard will be available at \033[4;34mhttp://public-ip\033[0m, for example, \033[4;34mhttp://127.0.0.1\033[0m."
else
echo "Operation cancelled."
fi
}
main

View File

@@ -19,6 +19,7 @@ services:
network_mode: "host"
volumes:
- ./redis.conf:/etc/redis.conf
- redis-data:/data
ingress:
container_name: callabacloud-ingress
restart: always
@@ -57,4 +58,4 @@ services:
volumes:
certs:
name: callabacloud-certs
redis-data: