diff --git a/README.md b/README.md index 1a78c99..cef0b00 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/install-callaba.sh b/install-callaba.sh new file mode 100755 index 0000000..a6af54a --- /dev/null +++ b/install-callaba.sh @@ -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 diff --git a/install.sh b/install.sh index a6af54a..8943ff3 100755 --- a/install.sh +++ b/install.sh @@ -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 "$@" diff --git a/prepare.sh b/prepare.sh deleted file mode 100644 index cf8470d..0000000 --- a/prepare.sh +++ /dev/null @@ -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