diff --git a/.github/actions/deploy-debian-11/action.yml b/.github/actions/deploy-debian-11/action.yml new file mode 100644 index 00000000..7b00c9d8 --- /dev/null +++ b/.github/actions/deploy-debian-11/action.yml @@ -0,0 +1,19 @@ +name: Deploy on Debian 11 +runs: + using: composite + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Ant Media Server + shell: bash + run: | + apt-get update + apt-get -y install wget findutils unzip curl + curl -L -o ant-media-server-community.zip $(curl -s https://api.github.com/repos/ant-media/Ant-Media-Server/releases/latest | grep "browser_download_url" | cut -d '"' -f 4) + bash ./install_ant-media-server.sh -i ant-media-server-community.zip -s false + /usr/local/antmedia/antmedia start + sleep 40 + if [ $(cat /usr/local/antmedia/log/ant-media-server.log | grep "LiveApp started" | wc -l | xargs) -eq 0 ]; then + echo "LiveApp started log does not exist. Check the logs above" + exit 1; + fi; diff --git a/.github/actions/deploy-debian-12/action.yml b/.github/actions/deploy-debian-12/action.yml new file mode 100644 index 00000000..66f24c80 --- /dev/null +++ b/.github/actions/deploy-debian-12/action.yml @@ -0,0 +1,19 @@ +name: Deploy on Debian 12 +runs: + using: composite + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Install Ant Media Server + shell: bash + run: | + apt-get update + apt-get -y install wget findutils unzip curl + curl -L -o ant-media-server-community.zip $(curl -s https://api.github.com/repos/ant-media/Ant-Media-Server/releases/latest | grep "browser_download_url" | cut -d '"' -f 4) + bash ./install_ant-media-server.sh -i ant-media-server-community.zip -s false + /usr/local/antmedia/antmedia start + sleep 40 + if [ $(cat /usr/local/antmedia/log/ant-media-server.log | grep "LiveApp started" | wc -l | xargs) -eq 0 ]; then + echo "LiveApp started log does not exist. Check the logs above" + exit 1; + fi; diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml new file mode 100644 index 00000000..2ad4b940 --- /dev/null +++ b/.github/workflows/debian.yml @@ -0,0 +1,16 @@ +name: Debian +on: [push] + +jobs: + Debian11: + runs-on: ubuntu-24.04 + container: debian:11 + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/deploy-debian-11 + Debian12: + runs-on: ubuntu-24.04 + container: debian:12 + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/deploy-debian-12 diff --git a/install_ant-media-server.sh b/install_ant-media-server.sh index 37e94b4b..638e58f5 100755 --- a/install_ant-media-server.sh +++ b/install_ant-media-server.sh @@ -176,13 +176,13 @@ distro () { $SUDO apt-get update && $SUDO apt-get install coreutils CUSTOM_JVM=$DEFAULT_JAVA fi - elif [ "$ID" == "ubuntu" ] || [ "$ID" == "centos" ] || [ "$ID" == "rocky" ] || [ "$ID" == "almalinux" ] || [ "$ID" == "rhel" ]; then + elif [ "$ID" == "ubuntu" ] || [ "$ID" == "centos" ] || [ "$ID" == "rocky" ] || [ "$ID" == "almalinux" ] || [ "$ID" == "rhel" ] || [ "$ID" == "debian" ]; then if [ "$VERSION_ID" == "18.04" ] && [ "aarch64" == $ARCH ]; then echo -e "ARM architecture is supported on Ubuntu 20.04. For 18.04 installation, use the link below to install.\nhttps://github.com/ant-media/Ant-Media-Server/wiki/Frequently-Asked-Questions#how-can-i-install-the-ant-media-server-on-ubuntu-1804-with-arm64" exit 1 fi - if [[ $VERSION_ID != 18.04 ]] && [[ $VERSION_ID != 20.04 ]] && [[ $VERSION_ID != 22.04 ]] && [[ $VERSION_ID != 24.04 ]] && [[ $VERSION_ID != 8* ]] && [[ $VERSION_ID != 9* ]]; then + if [[ $VERSION_ID != 18.04 ]] && [[ $VERSION_ID != 20.04 ]] && [[ $VERSION_ID != 22.04 ]] && [[ $VERSION_ID != 24.04 ]] && [[ $VERSION_ID != 8* ]] && [[ $VERSION_ID != 9* ]] && [[ $VERSION_ID != 12 ]] && [[ $VERSION_ID != 11 ]]; then echo $msg exit 1 fi @@ -262,7 +262,7 @@ if [ "$UPDATE" == "true" ]; then fi if [ -z "$ANT_MEDIA_SERVER_ZIP_FILE" ]; then - if [ "$ID" == "ubuntu" ]; then + if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then #Added curl package for the minimal OS installations. $SUDO apt-get update $SUDO apt-get install jq curl -y @@ -312,7 +312,7 @@ fi REQUIRED_VERSION="2.6" -if [ "$ID" == "ubuntu" ]; then +if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then $SUDO apt-get update -y $SUDO apt-get install unzip zip libva-drm2 libva-x11-2 libvdpau-dev -y $SUDO unzip -o $ANT_MEDIA_SERVER_ZIP_FILE "ant-media-server/ant-media-server.jar" -d /tmp/ @@ -359,7 +359,7 @@ check if [[ $VERSION == 2.1\.+.* || $VERSION == 2.0* || $VERSION == 1.* ]]; then - if [ "$ID" == "ubuntu" ]; then + if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then $SUDO apt-get install openjdk-8-jre -y $SUDO apt purge openjfx libopenjfx-java libopenjfx-jni -y $SUDO apt install openjfx=8u161-b12-1ubuntu2 libopenjfx-java=8u161-b12-1ubuntu2 libopenjfx-jni=8u161-b12-1ubuntu2 -y @@ -377,14 +377,14 @@ if [[ $VERSION == 2.1\.+.* || $VERSION == 2.0* || $VERSION == 1.* ]]; then elif [[ $VERSION == 2.4* || $VERSION == 2.3* || $VERSION == 2.2* ]]; then - if [ "$ID" == "ubuntu" ]; then + if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-11-jdk -y check fi elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7* ]]; then - if [ "$ID" == "ubuntu" ]; then + if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-11-jre-headless -y check @@ -400,7 +400,7 @@ elif [[ $VERSION == 2.5* || $VERSION == 2.6* || $VERSION == 2.7* ]]; then else # with 2.8 we start to use java17 - if [ "$ID" == "ubuntu" ]; then + if [[ "$ID" == "ubuntu" || "$ID" == "debian" ]]; then $SUDO apt-get update -y $SUDO apt-get install openjdk-17-jre-headless -y check diff --git a/nginx/install_and_configure_nginx.sh b/nginx/install_and_configure_nginx.sh index 03281788..cd11eef2 100644 --- a/nginx/install_and_configure_nginx.sh +++ b/nginx/install_and_configure_nginx.sh @@ -66,8 +66,10 @@ update_nginx_config() { # Generate the server blocks configuration based on the IP addresses origin_server_blocks="" + origin_server_blocks_backup="" for ip in "${origin_server_ips[@]}"; do origin_server_blocks+="\n server $ip:$HTTP_PORT;\n" + origin_server_blocks_backup+="\n server $ip:$HTTP_PORT backup;\n" done rtmp_origin_server_blocks="" @@ -81,14 +83,21 @@ update_nginx_config() { done edge_server_blocks="" + edge_server_blocks_backup="" for ip in "${edge_server_ips[@]}"; do edge_server_blocks+="\n server $ip:$HTTP_PORT;\n" + edge_server_blocks_backup+="\n server $ip:$HTTP_PORT backup;\n" done + sudo sed -i "s/{{ORIGIN_SERVER_BLOCKS}}/$origin_server_blocks/g" $nginx_config + sudo sed -i "s/{{ORIGIN_SERVER_BLOCKS_BACKUP}}/$edge_server_blocks_backup/g" $nginx_config #put edge servers as backup for origin servers + sudo sed -i "s/{{RTMP_SERVER_BLOCKS}}/$rtmp_origin_server_blocks/g" $nginx_config sudo sed -i "s/{{ORIGIN_SRT_SERVER_BLOCKS}}/$srt_origin_server_blocks/g" $nginx_config sudo sed -i "s/{{EDGE_SERVER_BLOCKS}}/$edge_server_blocks/g" $nginx_config + sudo sed -i "s/{{EDGE_SERVER_BLOCKS_BACKUP}}/$origin_server_blocks_backup/g" $nginx_config #put origin servers as backup for edge servers + sudo sed -i "s/{{YOUR_DOMAIN}}/$domain/g" $nginx_config # Check if a ssl enabled name is provided diff --git a/nginx/nginx.conf b/nginx/nginx.conf index 5aae833e..31c8cc70 100644 --- a/nginx/nginx.conf +++ b/nginx/nginx.conf @@ -54,6 +54,7 @@ http { upstream antmedia_origin { least_conn; {{ORIGIN_SERVER_BLOCKS}} + {{ORIGIN_SERVER_BLOCKS_BACKUP}} #server {AMS_ORIGIN1_IP}:5080; } @@ -62,6 +63,7 @@ http { upstream antmedia_edge { least_conn; {{EDGE_SERVER_BLOCKS}} + {{EDGE_SERVER_BLOCKS_BACKUP}} #server {AMS_EDGE1_IP}:5080; }