Optimize installation scripts. Update README

This commit is contained in:
dev
2024-12-12 00:44:50 +02:00
parent 21d028f3a9
commit 19fead483b
4 changed files with 115 additions and 120 deletions

View File

@@ -5,9 +5,9 @@
- Ubuntu 22.04
- Docker
## Step 1. Preparation
## Step 1. Download installation files
- Clone the repository:
- Open terminal and clone the repository:
```console
git clone https://gitlab.callabacloud.com/callaba-8/linux-8.1.git
```
@@ -17,11 +17,6 @@
cd linux-8.1/
```
- Update packages and install requirements. If the machine is clean, you can simply run:
```console
sudo bash prepare.sh
```
## 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:
@@ -50,11 +45,11 @@ After installation, please wait 2-3 minutes for the dashboard to initialize. It
![Image Description](./assets/dashboard.png)
## Step 4. Login to Callaba Dashboard
## Step 4. Login & subscribe 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
## Update or deploy a custom build version
To update Callaba, run the following command:
```console
@@ -83,7 +78,7 @@ sudo bash remove.sh
```bash
bash remove.sh
3. Clone this repository to install version 8.1.
4. Run the installation command based on your preferred hardware acceleration. The prepare step is optional and can be skipped.
4. Run the installation command based on your preferred hardware acceleration.
## Contact support

104
install-callaba.sh Executable file
View File

@@ -0,0 +1,104 @@
#!/bin/bash
STACK_VERSION=$1
PROCESSOR_TYPE=$2
$COMPOSE_FILE
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')
echo 'use version by default'
fi
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
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 on-premise $STACK_VERSION has installed successfully"
fi
}
set_iptables() {
# Ensure the /etc/iptables directory exists
if [ ! -d /etc/iptables/ ]; then
sudo mkdir -p /etc/iptables/
fi
# 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 rules"
exit 1
fi
# 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() {
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

View File

@@ -1,104 +1,8 @@
#!/bin/bash
STACK_VERSION=$1
PROCESSOR_TYPE=$2
$COMPOSE_FILE
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')
echo 'use version by default'
fi
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
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 on-premise $STACK_VERSION has installed successfully"
fi
}
set_iptables() {
# Ensure the /etc/iptables directory exists
if [ ! -d /etc/iptables/ ]; then
sudo mkdir -p /etc/iptables/
fi
# 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 rules"
exit 1
fi
# 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() {
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
sudo apt-get update -qq >/dev/null && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl jq iptables iptables-persistent
sudo mkdir /etc/iptables
sudo wget -qO- https://get.docker.com/ | sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo bash install-callaba.sh "$@"

View File

@@ -1,8 +0,0 @@
#!/bin/bash
sudo apt-get update -qq >/dev/null && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y curl jq iptables iptables-persistent
sudo mkdir /etc/iptables
sudo wget -qO- https://get.docker.com/ | sh
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo bash install.sh