diff --git a/cloudformation/jambonz-mini.yaml b/cloudformation/jambonz-mini.yaml index 4ca4042..3bca05f 100644 --- a/cloudformation/jambonz-mini.yaml +++ b/cloudformation/jambonz-mini.yaml @@ -95,9 +95,9 @@ Conditions: Mappings: AWSRegion2AMI: us-east-1: - Ami: ami-0525a66f4301a6e6d + Ami: ami-0c9308fe579edc67b us-east-2: - Ami: ami-0e45caebe3e25580c + Ami: ami-09a790787540f5772 Resources: IamCloudwatchRole: @@ -172,6 +172,18 @@ Resources: - | #!/bin/bash -xe + echo install rtpengine kernel module and iptables rule + if lsmod | grep -q xt_RTPENGINE; then + echo "xt_RTPENGINE module is already loaded." + else + echo "loading xt_RTPENGINE module." + modprobe xt_RTPENGINE + echo 'add 42' > /proc/rtpengine/control + iptables -I INPUT -p udp --dport 40000:60000 -j RTPENGINE --id 42 + fi + echo "rtpengine module and iptables rule installed. Restarting rtpengine service." + systemctl restart rtpengine + # Detecting the Linux distribution if grep -q 'ID="rhel"' /etc/os-release; then USER=ec2-user @@ -185,8 +197,6 @@ Resources: echo disabling firewalld sudo systemctl stop firewalld sudo systemctl disable firewalld - - sudo systemctl restart rtpengine else USER=admin HOME=/home/admin diff --git a/packer/jambonz-feature-server/aws/scripts/install_freeswitch.sh b/packer/jambonz-feature-server/aws/scripts/install_freeswitch.sh index 7d924b8..fe89b1f 100644 --- a/packer/jambonz-feature-server/aws/scripts/install_freeswitch.sh +++ b/packer/jambonz-feature-server/aws/scripts/install_freeswitch.sh @@ -1,25 +1,13 @@ #!/bin/bash -DISTRO=$1 - FREESWITCH_VERSION=v1.10.10 SPAN_DSP_VERSION=0d2e6ac GRPC_VERSION=v1.57.0 GOOGLE_API_VERSION=29374574304f3356e64423acc9ad059fe43f09b5 -#AWS_SDK_VERSION=1.11.143 # newer but buggy with s2n_init crashes and weird slowdown on voice playout in FS AWS_SDK_VERSION=1.8.129 LWS_VERSION=v4.3.2 MODULES_VERSION=v0.8.11 -if [[ "$DISTRO" == rhel* ]]; then - if [ "$EUID" -ne 0 ]; then - echo "Switching to root user..." - bash "$0" --as-root - exit - fi -fi - -# Your script continues here, as root echo "freeswitch version to install is ${FREESWITCH_VERSION}" echo "drachtio modules version to install is ${MODULES_VERSION}" echo "GRPC version to install is ${GRPC_VERSION}" @@ -27,6 +15,17 @@ echo "GOOGLE_API_VERSION version to install is ${GOOGLE_API_VERSION}" echo "AWS_SDK_VERSION version to install is ${AWS_SDK_VERSION}" echo "LWS_VERSION version to install is ${LWS_VERSION}" echo "DISTRO is ${DISTRO}" +echo "ARCH is ${ARCH}" + +if [[ "$DISTRO" == rhel* ]]; then + if [ "$EUID" -ne 0 ]; then + echo "Switching to root user..." + sudo ARCH="$ARCH" MEDIA_SERVER_NAME="$MEDIA_SERVER_NAME" PREFERRED_CODEC_LIST="$PREFERRED_CODEC_LIST" DISTRO="$DISTRO" bash "$0" --as-root + exit + fi +fi + +# Your script continues here, as root export PATH=/usr/local/bin:$PATH export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH @@ -48,6 +47,7 @@ if [ "$ARCH" == "arm64" ]; then echo done fi if [ "$ARCH" == "amd64" ]; then + PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH echo installing Microsoft x64 libs... sudo cp /usr/local/lib/MicrosoftSpeechSDK/x64/libMicrosoft.*.so /usr/local/lib/ echo done @@ -136,6 +136,7 @@ autoreconf -i && ./configure && make -j 4 && sudo make install # build spandsp echo building spandsp +mv /usr/lib64/pkgconfig/spandsp.pc /usr/lib64/pkgconfig/spandsp.pc.bak # move old spandsp.pc out of the way cd /usr/local/src/freeswitch/libs/spandsp ./bootstrap.sh && ./configure && make -j 4 && sudo make install @@ -214,7 +215,7 @@ LANGUAGE=cpp make echo "building freeswitch" cd /usr/local/src/freeswitch ./bootstrap.sh -j -./configure --enable-tcmalloc=yes --with-lws=yes --with-extra=yes --with-aws=yes +./configure --enable-tcmalloc=yes --with-lws=yes --with-extra=yes make -j 8 sudo make install sudo make cd-sounds-install cd-moh-install diff --git a/packer/jambonz-feature-server/aws/template-rhel-8.json b/packer/jambonz-feature-server/aws/template-rhel-8.json index 78c67ca..010df0f 100644 --- a/packer/jambonz-feature-server/aws/template-rhel-8.json +++ b/packer/jambonz-feature-server/aws/template-rhel-8.json @@ -5,7 +5,7 @@ "ami_description": "jambonz feature server", "instance_type": "c6in.2xlarge", "drachtio_version": "v0.8.24-rc1", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "309956199498", "install_telegraf": "yes", @@ -17,7 +17,7 @@ "distro": "rhel-8", "redhat_username": "your-redhat_username-here", "redhat_password": "your-redhat_password-here", - "leave_source": "no" + "leave_source": "yes" }, "builders": [{ "type": "amazon-ebs", @@ -61,29 +61,23 @@ "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH", "sudo setenforce 0", "sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config", - "echo registering", "sudo subscription-manager register --username={{user `redhat_username`}} --password={{user `redhat_password`}}", "sudo dnf upgrade -y", "sudo sed -i 's/manage_repos = 0/manage_repos = 1/' /etc/rhsm/rhsm.conf", - "cat /etc/rhsm/rhsm.conf", - "echo installing codeready repos", "sudo subscription-manager repos --enable=codeready-builder-for-rhel-8-x86_64-rpms", - "echo installing epel repo", "sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm", - "sudo dnf upgrade -y", - "echo running /usr/bin/crb", - "sudo /usr/bin/crb enable", - "echo installing rpmfusion repo", "sudo dnf install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm", - "echo installing Development tools", "sudo dnf groupinstall -y 'RPM Development Tools'", "sudo dnf groupinstall -y 'Development Tools'", - "echo installing needed packages", - "sudo dnf install -y iptables-devel htop lsof redis pandoc wget yasm cmake ffmpeg ffmpeg-devel perl-ExtUtils-Embed perl-IPC-Cmd pcre-devel iptables-devel \\", - "google-perftools-devel libcurl-devel jq telnet libevent-devel xmlrpc-c-devel gperf libpcap-devel libmpg123-devel libshout-devel systemd-devel \\", - "glib2-devel json-glib-devel hiredis-devel mariadb-devel dnsutils speex speex-devel speexdsp-devel re2-devel libedit-devel opus-devel opusfile-devel \\", - "glib2-devel json-glib-devel hiredis-devel libtiff-devel libevent-devel xmlrpc-c-devel perl-IPC-Cmd mariadb-devel snapd \\", - "libjpeg-devel libsndfile-devel lua-devel sqlite-devel libuuid-devel lame-devel libyuv-devel protobuf-compiler", + "sudo dnf install -y iptables-devel htop pandoc wget cmake ffmpeg ffmpeg-devel fail2ban \\", + "perl-IPC-Cmd pcre-devel google-perftools-devel libcurl-devel curl jq telnet \\", + "libevent-devel xmlrpc-c-devel gperf libpcap-devel glib2-devel json-glib-devel \\", + "hiredis-devel spandsp-devel mariadb-devel dnsutils speex libedit-devel \\", + "opus-devel lsof redis yasm perl-ExtUtils-Embed libmpg123-devel libshout-devel \\", + "systemd-devel speex-devel speexdsp-devel re2-devel opusfile-devel libtiff-devel \\", + "snapd libjpeg-devel libsndfile-devel lua-devel sqlite-devel libuuid-devel \\", + "lame-devel libyuv-devel protobuf-compiler tcpdump kernel-devel-4.18.0-513.9.1.el8_9", + "sudo dnf debuginfo-install -y binutils", "sudo dnf debuginfo-install -y binutils", "sudo chmod a+w /usr/local/src", "ssh-keyscan github.com >> ~/.ssh/known_hosts", @@ -110,9 +104,9 @@ "environment_vars": [ "ARCH={{user `ami_base_image_arch`}}", "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", - "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}", + "DISTRO={{user `distro`}}" ], - "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", "script": "scripts/install_freeswitch.sh" }, { diff --git a/packer/jambonz-feature-server/aws/template-rhel-9.json b/packer/jambonz-feature-server/aws/template-rhel-9.json index e7b7347..422c362 100644 --- a/packer/jambonz-feature-server/aws/template-rhel-9.json +++ b/packer/jambonz-feature-server/aws/template-rhel-9.json @@ -5,7 +5,7 @@ "ami_description": "jambonz feature server", "instance_type": "c6in.2xlarge", "drachtio_version": "v0.8.24-rc1", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "309956199498", "install_telegraf": "yes", @@ -110,9 +110,9 @@ "environment_vars": [ "ARCH={{user `ami_base_image_arch`}}", "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", - "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}", + "DISTRO={{user `distro`}}" ], - "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", "script": "scripts/install_freeswitch.sh" }, { diff --git a/packer/jambonz-feature-server/aws/template.json b/packer/jambonz-feature-server/aws/template.json index a985d9f..7655ee3 100644 --- a/packer/jambonz-feature-server/aws/template.json +++ b/packer/jambonz-feature-server/aws/template.json @@ -5,7 +5,7 @@ "ami_description": "jambonz feature server", "instance_type": "c6in.xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "136693071363", "install_telegraf": "yes", @@ -94,7 +94,8 @@ "environment_vars": [ "ARCH={{user `ami_base_image_arch`}}", "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", - "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}", + "DISTRO={{user `distro`}}" ], "script": "scripts/install_freeswitch.sh" }, diff --git a/packer/jambonz-mini/aws/scripts/install_freeswitch.sh b/packer/jambonz-mini/aws/scripts/install_freeswitch.sh index 7d924b8..fe89b1f 100644 --- a/packer/jambonz-mini/aws/scripts/install_freeswitch.sh +++ b/packer/jambonz-mini/aws/scripts/install_freeswitch.sh @@ -1,25 +1,13 @@ #!/bin/bash -DISTRO=$1 - FREESWITCH_VERSION=v1.10.10 SPAN_DSP_VERSION=0d2e6ac GRPC_VERSION=v1.57.0 GOOGLE_API_VERSION=29374574304f3356e64423acc9ad059fe43f09b5 -#AWS_SDK_VERSION=1.11.143 # newer but buggy with s2n_init crashes and weird slowdown on voice playout in FS AWS_SDK_VERSION=1.8.129 LWS_VERSION=v4.3.2 MODULES_VERSION=v0.8.11 -if [[ "$DISTRO" == rhel* ]]; then - if [ "$EUID" -ne 0 ]; then - echo "Switching to root user..." - bash "$0" --as-root - exit - fi -fi - -# Your script continues here, as root echo "freeswitch version to install is ${FREESWITCH_VERSION}" echo "drachtio modules version to install is ${MODULES_VERSION}" echo "GRPC version to install is ${GRPC_VERSION}" @@ -27,6 +15,17 @@ echo "GOOGLE_API_VERSION version to install is ${GOOGLE_API_VERSION}" echo "AWS_SDK_VERSION version to install is ${AWS_SDK_VERSION}" echo "LWS_VERSION version to install is ${LWS_VERSION}" echo "DISTRO is ${DISTRO}" +echo "ARCH is ${ARCH}" + +if [[ "$DISTRO" == rhel* ]]; then + if [ "$EUID" -ne 0 ]; then + echo "Switching to root user..." + sudo ARCH="$ARCH" MEDIA_SERVER_NAME="$MEDIA_SERVER_NAME" PREFERRED_CODEC_LIST="$PREFERRED_CODEC_LIST" DISTRO="$DISTRO" bash "$0" --as-root + exit + fi +fi + +# Your script continues here, as root export PATH=/usr/local/bin:$PATH export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64:$LD_LIBRARY_PATH @@ -48,6 +47,7 @@ if [ "$ARCH" == "arm64" ]; then echo done fi if [ "$ARCH" == "amd64" ]; then + PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:$PKG_CONFIG_PATH echo installing Microsoft x64 libs... sudo cp /usr/local/lib/MicrosoftSpeechSDK/x64/libMicrosoft.*.so /usr/local/lib/ echo done @@ -136,6 +136,7 @@ autoreconf -i && ./configure && make -j 4 && sudo make install # build spandsp echo building spandsp +mv /usr/lib64/pkgconfig/spandsp.pc /usr/lib64/pkgconfig/spandsp.pc.bak # move old spandsp.pc out of the way cd /usr/local/src/freeswitch/libs/spandsp ./bootstrap.sh && ./configure && make -j 4 && sudo make install @@ -214,7 +215,7 @@ LANGUAGE=cpp make echo "building freeswitch" cd /usr/local/src/freeswitch ./bootstrap.sh -j -./configure --enable-tcmalloc=yes --with-lws=yes --with-extra=yes --with-aws=yes +./configure --enable-tcmalloc=yes --with-lws=yes --with-extra=yes make -j 8 sudo make install sudo make cd-sounds-install cd-moh-install diff --git a/packer/jambonz-mini/aws/scripts/install_rtpengine.sh b/packer/jambonz-mini/aws/scripts/install_rtpengine.sh index 595021f..0398435 100644 --- a/packer/jambonz-mini/aws/scripts/install_rtpengine.sh +++ b/packer/jambonz-mini/aws/scripts/install_rtpengine.sh @@ -32,6 +32,7 @@ cd /usr/local/src git clone https://github.com/warmcat/libwebsockets.git -b v4.3.2 cd /usr/local/src/libwebsockets mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -j 8 && sudo make install +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cd /usr/local/src git clone https://github.com/sipwise/rtpengine.git -b ${VERSION} @@ -46,27 +47,28 @@ if [[ "$DISTRO" == rhel* ]] && [[ "$RHEL_RELEASE" == "9" ]]; then systemctl enable rtpengine systemctl start rtpengine else + + if [[ "$DISTRO" == rhel* ]] && [[ "$RHEL_RELEASE" == "8" ]]; then + kernel_version="4.18.0-513.9.1.el8_9.x86_64" + else + kernel_version=$(uname -r) + fi + + echo "build rtpengine with kernel version ${kernel_version}" echo make with_transcoding=yes with_iptables_option=yes with-kernel - make with_transcoding=yes with_iptables_option=yes with-kernel + make KSRC=/lib/modules/${kernel_version}/build with_transcoding=yes with_iptables_option=yes with-kernel # copy iptables extension into place echo "copying iptables extension into ${pkg-config xtables --variable=xtlibdir}" cp ./iptables-extension/libxt_RTPENGINE.so `pkg-config xtables --variable=xtlibdir` - echo "creating directory /lib/modules/$(uname -r)/updates/" - mkdir -p /lib/modules/`uname -r`/updates/ - echo "copying kernel module into /lib/modules/$(uname -r)/updates" - cp ./kernel-module/xt_RTPENGINE.ko /lib/modules/`uname -r`/updates - depmod -a - modprobe xt_RTPENGINE + echo "copying kernel module into /lib/modules/${kernel_version}/updates" + cp ./kernel-module/xt_RTPENGINE.ko /lib/modules/${kernel_version}/updates + depmod -a ${kernel_version} + echo "xt_RTPENGINE" >> /etc/modules-load.d/rtpengine.conf cat << EOF >> /etc/modules xt_RTPENGINE EOF - echo "creating file 42 in /proc/rtpengine/control" - echo 'add 42' > /proc/rtpengine/control - echo "installing iptables rule" - iptables -I INPUT -p udp --dport 40000:60000 -j RTPENGINE --id 42 - cp /usr/local/src/rtpengine/daemon/rtpengine /usr/local/bin cp /usr/local/src/rtpengine/recording-daemon/rtpengine-recording /usr/local/bin/ @@ -76,8 +78,8 @@ EOF sudo mv /tmp/rtpengine.service /etc/systemd/system fi sudo chmod 644 /etc/systemd/system/rtpengine.service - sudo systemctl enable rtpengine - sudo systemctl start rtpengine + #sudo systemctl enable rtpengine + #sudo systemctl start rtpengine fi diff --git a/packer/jambonz-mini/aws/template-rhel-8.json b/packer/jambonz-mini/aws/template-rhel-8.json index 38aef0a..a1414dc 100644 --- a/packer/jambonz-mini/aws/template-rhel-8.json +++ b/packer/jambonz-mini/aws/template-rhel-8.json @@ -5,7 +5,7 @@ "ami_description": "jambonz all-in-one AMI", "instance_type": "c6in.2xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "jambonz_user": "admin", "jambonz_password": "JambonzR0ck$", "ami_base_image_owner": "309956199498", @@ -27,7 +27,7 @@ "distro": "rhel-8", "redhat_username": "your-redhat_username-here", "redhat_password": "your-redhat_password-here", - "leave_source": "no" + "leave_source": "yes" }, "builders": [{ "type": "amazon-ebs", @@ -35,7 +35,7 @@ "source_ami_filter": { "filters": { "virtualization-type": "hvm", - "name": "RHEL-8.8*", + "name": "RHEL-8.8.0*", "root-device-type": "ebs", "architecture": "x86_64" }, @@ -86,7 +86,7 @@ "opus-devel lsof redis yasm perl-ExtUtils-Embed libmpg123-devel libshout-devel \\", "systemd-devel speex-devel speexdsp-devel re2-devel opusfile-devel libtiff-devel \\", "snapd libjpeg-devel libsndfile-devel lua-devel sqlite-devel libuuid-devel \\", - "lame-devel libyuv-devel protobuf-compiler tcpdump kernel-devel-$(uname -r)", + "lame-devel libyuv-devel protobuf-compiler tcpdump kernel-devel-4.18.0-513.9.1.el8_9", "sudo dnf debuginfo-install -y binutils", "sudo chmod a+w /usr/local/src", "mkdir ~/apps", @@ -109,6 +109,16 @@ "source": "files/", "destination": "/tmp" }, + { + "type": "shell", + "environment_vars": [ + "ARCH=amd64", + "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}", + "DISTRO={{user `distro`}}" + ], + "script": "scripts/install_freeswitch.sh" + }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", @@ -189,16 +199,6 @@ "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", "script": "scripts/install_nodejs.sh" }, - { - "type": "shell", - "environment_vars": [ - "ARCH=amd64", - "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", - "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" - ], - "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", - "script": "scripts/install_freeswitch.sh" - }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `jambonz_version`}} {{user `jambonz_user`}} {{user `jambonz_password`}}", diff --git a/packer/jambonz-mini/aws/template-rhel-9.json b/packer/jambonz-mini/aws/template-rhel-9.json index fabeb7e..bae4494 100644 --- a/packer/jambonz-mini/aws/template-rhel-9.json +++ b/packer/jambonz-mini/aws/template-rhel-9.json @@ -5,7 +5,7 @@ "ami_description": "jambonz all-in-one AMI", "instance_type": "c6in.2xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "jambonz_user": "admin", "jambonz_password": "JambonzR0ck$", "ami_base_image_owner": "309956199498", @@ -195,7 +195,8 @@ "environment_vars": [ "ARCH=amd64", "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", - "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}", + "DISTRO={{user `distro`}}" ], "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", "script": "scripts/install_freeswitch.sh" diff --git a/packer/jambonz-mini/gcp/template.json b/packer/jambonz-mini/gcp/template.json index 95054d0..af33f70 100644 --- a/packer/jambonz-mini/gcp/template.json +++ b/packer/jambonz-mini/gcp/template.json @@ -9,7 +9,7 @@ "ami_description": "jambonz-mini (all-in-one server)", "instance_type": "c2-standard-4", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "jambonz_user": "admin", "jambonz_password": "JambonzR0ck$", "install_telegraf": "yes", diff --git a/packer/jambonz-mini/proxmox/template.json b/packer/jambonz-mini/proxmox/template.json index 6b11597..81d585c 100644 --- a/packer/jambonz-mini/proxmox/template.json +++ b/packer/jambonz-mini/proxmox/template.json @@ -16,7 +16,7 @@ "proxmox_ip_private": "{{user `proxmox_ip_private`}}", "proxmox_gateway": "{{user `proxmox_gateway`}}", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "jambonz_user": "admin", "jambonz_password": "JambonzR0ck$", "install_telegraf": "yes", diff --git a/packer/jambonz-monitoring/aws/template.json b/packer/jambonz-monitoring/aws/template.json index 6e028d2..219d9c0 100644 --- a/packer/jambonz-monitoring/aws/template.json +++ b/packer/jambonz-monitoring/aws/template.json @@ -4,7 +4,7 @@ "ssh_username": "admin", "ami_description": "jambonz monitoring server", "instance_type": "t2.xlarge", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "homer_user": "homer_user", "homer_password": "XcapJTqy11LnsYRtxXGPTYQkAnI", "install_influxdb": "yes", diff --git a/packer/jambonz-sbc-rtp/aws/template.json b/packer/jambonz-sbc-rtp/aws/template.json index 9ca96e3..501f625 100644 --- a/packer/jambonz-sbc-rtp/aws/template.json +++ b/packer/jambonz-sbc-rtp/aws/template.json @@ -4,7 +4,7 @@ "ssh_username": "admin", "ami_description": "jambonz SBC RTP server", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "136693071363", "instance_type": "t3.xlarge", diff --git a/packer/jambonz-sbc-sip-rtp/aws/scripts/install_rtpengine.sh b/packer/jambonz-sbc-sip-rtp/aws/scripts/install_rtpengine.sh index 595021f..10c7665 100644 --- a/packer/jambonz-sbc-sip-rtp/aws/scripts/install_rtpengine.sh +++ b/packer/jambonz-sbc-sip-rtp/aws/scripts/install_rtpengine.sh @@ -32,6 +32,7 @@ cd /usr/local/src git clone https://github.com/warmcat/libwebsockets.git -b v4.3.2 cd /usr/local/src/libwebsockets mkdir -p build && cd build && cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && make -j 8 && sudo make install +export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig cd /usr/local/src git clone https://github.com/sipwise/rtpengine.git -b ${VERSION} @@ -46,16 +47,29 @@ if [[ "$DISTRO" == rhel* ]] && [[ "$RHEL_RELEASE" == "9" ]]; then systemctl enable rtpengine systemctl start rtpengine else + + if [[ "$DISTRO" == rhel* ]] && [[ "$RHEL_RELEASE" == "8" ]]; then + kernel_version="4.18.0-513.9.1.el8_9.x86_64" + else + kernel_version=$(uname -r) + fi + + echo "building rtpengine with kernel version ${kernel_version}" echo make with_transcoding=yes with_iptables_option=yes with-kernel - make with_transcoding=yes with_iptables_option=yes with-kernel + make KSRC=/lib/modules/${kernel_version}/build with_transcoding=yes with_iptables_option=yes with-kernel # copy iptables extension into place echo "copying iptables extension into ${pkg-config xtables --variable=xtlibdir}" cp ./iptables-extension/libxt_RTPENGINE.so `pkg-config xtables --variable=xtlibdir` - echo "creating directory /lib/modules/$(uname -r)/updates/" - mkdir -p /lib/modules/`uname -r`/updates/ - echo "copying kernel module into /lib/modules/$(uname -r)/updates" - cp ./kernel-module/xt_RTPENGINE.ko /lib/modules/`uname -r`/updates + echo "copying kernel module into /lib/modules/${kernel_version}/updates" + cp ./kernel-module/xt_RTPENGINE.ko /lib/modules/${kernel_version}/updates + depmod -a -b /lib/modules/${kernel_version} + modprobe xt_RTPENGINE + cat << EOF >> /etc/modules-load.d/rtpengine.conf + echo "creating directory /lib/modules/${kernel_version}/updates/" + mkdir -p /lib/modules/${kernel_version}/updates/ + echo "copying kernel module into /lib/modules/${kernel_version}/updates" + cp ./kernel-module/xt_RTPENGINE.ko /lib/modules/${kernel_version}/updates depmod -a modprobe xt_RTPENGINE cat << EOF >> /etc/modules diff --git a/packer/jambonz-sbc-sip-rtp/aws/template-rhel-8.json b/packer/jambonz-sbc-sip-rtp/aws/template-rhel-8.json index cb85115..c67b3e9 100644 --- a/packer/jambonz-sbc-sip-rtp/aws/template-rhel-8.json +++ b/packer/jambonz-sbc-sip-rtp/aws/template-rhel-8.json @@ -6,7 +6,7 @@ "ami_description": "jambonz SBC SIP+RTP", "instance_type": "c6in.xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "309956199498", "rtp_engine_version": "mr11.5.1.1", @@ -19,7 +19,7 @@ "distro": "rhel-8", "redhat_username": "your-redhat_username-here", "redhat_password": "your-redhat_password-here", - "leave_source": "no" + "leave_source": "yes" }, "builders": [{ "type": "amazon-ebs", @@ -27,7 +27,7 @@ "source_ami_filter": { "filters": { "virtualization-type": "hvm", - "name": "RHEL-8.8*", + "name": "RHEL-8.8.0*", "root-device-type": "ebs", "architecture": "x86_64" }, @@ -63,28 +63,22 @@ "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH", "sudo setenforce 0", "sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config", - "echo registering", "sudo subscription-manager register --username={{user `redhat_username`}} --password={{user `redhat_password`}}", "sudo dnf upgrade -y", "sudo sed -i 's/manage_repos = 0/manage_repos = 1/' /etc/rhsm/rhsm.conf", - "cat /etc/rhsm/rhsm.conf", - "echo installing codeready repos", "sudo subscription-manager repos --enable=codeready-builder-for-rhel-8-x86_64-rpms", - "echo installing epel repo", "sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm", - "sudo dnf upgrade -y", - "echo running /usr/bin/crb", - "sudo /usr/bin/crb enable", - "echo installing rpmfusion repo", - "sudo dnf install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm", - "echo installing Development tools", + "sudo dnf install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm", "sudo dnf groupinstall -y 'RPM Development Tools'", "sudo dnf groupinstall -y 'Development Tools'", - "echo installing needed packages", - "sudo dnf install -y iptables-devel htop pandoc wget cmake ffmpeg ffmpeg-devel perl-IPC-Cmd pcre-devel iptables-devel \\", - "google-perftools-devel libcurl-devel jq telnet libevent-devel xmlrpc-c-devel gperf libpcap-devel \\", - "glib2-devel json-glib-devel hiredis-devel spandsp-devel mariadb-devel dnsutils speex libedit-devel opus-devel \\", - "glib2-devel json-glib-devel spandsp-devel hiredis-devel libevent-devel xmlrpc-c-devel perl-IPC-Cmd mariadb-devel snapd", + "sudo dnf install -y iptables-devel htop pandoc wget cmake ffmpeg ffmpeg-devel fail2ban \\", + "perl-IPC-Cmd pcre-devel google-perftools-devel libcurl-devel curl jq telnet \\", + "libevent-devel xmlrpc-c-devel gperf libpcap-devel glib2-devel json-glib-devel \\", + "hiredis-devel spandsp-devel mariadb-devel dnsutils speex libedit-devel \\", + "opus-devel lsof redis yasm perl-ExtUtils-Embed libmpg123-devel libshout-devel \\", + "systemd-devel speex-devel speexdsp-devel re2-devel opusfile-devel libtiff-devel \\", + "snapd libjpeg-devel libsndfile-devel lua-devel sqlite-devel libuuid-devel \\", + "lame-devel libyuv-devel protobuf-compiler tcpdump kernel-devel-4.18.0-513.9.1.el8_9", "sudo dnf debuginfo-install -y binutils", "sudo chmod a+w /usr/local/src", "ssh-keyscan github.com >> ~/.ssh/known_hosts", @@ -110,6 +104,11 @@ "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", "script": "scripts/install_os_tuning.sh" }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `rtp_engine_version`}}", + "script": "scripts/install_rtpengine.sh" + }, { "type": "shell", "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{build `ID`}}", @@ -125,11 +124,6 @@ "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", "script": "scripts/install_nodejs.sh" }, - { - "type": "shell", - "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `rtp_engine_version`}}", - "script": "scripts/install_rtpengine.sh" - }, { "type": "shell", "environment_vars": [ diff --git a/packer/jambonz-sbc-sip-rtp/aws/template-rhel-9.json b/packer/jambonz-sbc-sip-rtp/aws/template-rhel-9.json index 0fbc2c6..742ca4c 100644 --- a/packer/jambonz-sbc-sip-rtp/aws/template-rhel-9.json +++ b/packer/jambonz-sbc-sip-rtp/aws/template-rhel-9.json @@ -6,7 +6,7 @@ "ami_description": "jambonz SBC SIP+RTP", "instance_type": "c6in.xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "309956199498", "rtp_engine_version": "mr11.5.1.1", diff --git a/packer/jambonz-sbc-sip-rtp/aws/template.json b/packer/jambonz-sbc-sip-rtp/aws/template.json index 28f8fbd..634917b 100644 --- a/packer/jambonz-sbc-sip-rtp/aws/template.json +++ b/packer/jambonz-sbc-sip-rtp/aws/template.json @@ -5,7 +5,7 @@ "ami_description": "jambonz SBC SIP+RTP", "instance_type": "c6in.2xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "136693071363", "rtp_engine_version": "mr11.5.1.1", diff --git a/packer/jambonz-sbc-sip/aws/template-rhel.json b/packer/jambonz-sbc-sip/aws/template-rhel.json index 34aeb14..c40a73d 100644 --- a/packer/jambonz-sbc-sip/aws/template-rhel.json +++ b/packer/jambonz-sbc-sip/aws/template-rhel.json @@ -5,7 +5,7 @@ "ami_description": "jambonz SBC SIP", "instance_type": "t3.xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "309956199498", "install_datadog": "no", diff --git a/packer/jambonz-sbc-sip/aws/template.json b/packer/jambonz-sbc-sip/aws/template.json index 8b52931..f7be283 100644 --- a/packer/jambonz-sbc-sip/aws/template.json +++ b/packer/jambonz-sbc-sip/aws/template.json @@ -5,7 +5,7 @@ "ami_description": "jambonz SBC SIP", "instance_type": "t3.xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "136693071363", "install_datadog": "no", diff --git a/packer/jambonz-web-server-and-monitoring-server/aws/template-rhel-8.json b/packer/jambonz-web-server-and-monitoring-server/aws/template-rhel-8.json new file mode 100644 index 0000000..a5c11e4 --- /dev/null +++ b/packer/jambonz-web-server-and-monitoring-server/aws/template-rhel-8.json @@ -0,0 +1,214 @@ +{ + "variables": { + "region": "us-east-1", + "ssh_username": "ec2-user", + "ami_description": "jambonz all-in-one AMI", + "instance_type": "c6in.2xlarge", + "drachtio_version": "v0.8.24", + "jambonz_version": "v0.8.5-6", + "jambonz_user": "admin", + "jambonz_password": "JambonzR0ck$", + "ami_base_image_owner": "309956199498", + "install_telegraf": "yes", + "homer_user": "homer_user", + "homer_password": "XcapJTqy11LnsYRtxXGPTYQkAnI", + "install_influxdb": "yes", + "install_grafana": "yes", + "install_homer": "yes", + "install_jaeger": "yes", + "install_cloudwatch": "yes", + "install_nodered": "no", + "influxdb_ip": "127.0.0.1", + "rtp_engine_version": "mr11.4.1.4", + "rtp_engine_min_port": "40000", + "rtp_engine_max_port": "60000", + "mediaserver_name" : "jambonz", + "preferred_codec_list" : "PCMU,PCMA,OPUS,G722", + "distro": "rhel-8", + "redhat_username": "your-redhat_username-here", + "redhat_password": "your-redhat_password-here", + "leave_source": "yes" + }, + "builders": [{ + "type": "amazon-ebs", + "region": "{{user `region`}}", + "source_ami_filter": { + "filters": { + "virtualization-type": "hvm", + "name": "RHEL-8.8*", + "root-device-type": "ebs", + "architecture": "x86_64" + }, + "owners": ["{{user `ami_base_image_owner`}}"], + "most_recent": true + }, + "instance_type": "{{user `instance_type`}}", + "ssh_username": "{{user `ssh_username`}}", + "ami_name": "jambonz-mini-{{user `jambonz_version`}}-{{user `distro`}}-{{isotime |clean_resource_name }}", + "ami_description": "{{user `ami_description`}}", + "launch_block_device_mappings": [ + { + "device_name": "/dev/sda1", + "volume_size": 100, + "volume_type": "gp3", + "delete_on_termination": true + } + ], + "tags": { + "Name": "jambonz-mini" + }, + "run_tags": { + "Name": "jambonz-mini-build" + } + }], + "provisioners": [ + { + "type": "shell", + "inline": [ + "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done", + "export PATH=/usr/local/bin:$PATH", + "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH", + "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH", + "sudo setenforce 0", + "sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config", + "sudo subscription-manager register --username={{user `redhat_username`}} --password={{user `redhat_password`}}", + "sudo dnf upgrade -y", + "sudo sed -i 's/manage_repos = 0/manage_repos = 1/' /etc/rhsm/rhsm.conf", + "sudo subscription-manager repos --enable=codeready-builder-for-rhel-8-x86_64-rpms", + "sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm", + "sudo dnf install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm", + "sudo dnf groupinstall -y 'RPM Development Tools'", + "sudo dnf groupinstall -y 'Development Tools'", + "sudo dnf install -y iptables-devel htop pandoc wget cmake ffmpeg ffmpeg-devel fail2ban \\", + "perl-IPC-Cmd pcre-devel google-perftools-devel libcurl-devel curl jq telnet \\", + "libevent-devel xmlrpc-c-devel gperf libpcap-devel glib2-devel json-glib-devel \\", + "hiredis-devel spandsp-devel mariadb-devel dnsutils speex libedit-devel \\", + "opus-devel lsof redis yasm perl-ExtUtils-Embed libmpg123-devel libshout-devel \\", + "systemd-devel speex-devel speexdsp-devel re2-devel opusfile-devel libtiff-devel \\", + "snapd libjpeg-devel libsndfile-devel lua-devel sqlite-devel libuuid-devel \\", + "lame-devel libyuv-devel protobuf-compiler tcpdump kernel-devel-$(uname -r)", + "sudo dnf debuginfo-install -y binutils", + "sudo chmod a+w /usr/local/src", + "mkdir ~/apps", + "cd ~/apps", + "git config --global advice.detachedHead false", + "git clone https://github.com/jambonz/sbc-call-router.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/fsw-clear-old-calls.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-outbound.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-inbound.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-sip-sidecar.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-feature-server.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-api-server.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-webapp.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-smpp-esme.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-rtpengine-sidecar.git -b {{user `jambonz_version`}}" + ] + }, + { + "type": "file", + "source": "files/", + "destination": "/tmp" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_os_tuning.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `rtp_engine_version`}}", + "script": "scripts/install_rtpengine.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `jambonz_user`}} {{user `jambonz_password`}}", + "script": "scripts/install_mysql.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_homer`}} {{user `homer_user`}} {{user `homer_password`}}", + "script": "scripts/install_postgresql.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `drachtio_version`}}", + "script": "scripts/install_drachtio.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_fail2ban.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_redis.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_influxdb`}}", + "script": "scripts/install_influxdb.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_telegraf`}} {{user `influxdb_ip`}}", + "script": "scripts/install_telegraf.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_grafana`}}", + "script": "scripts/install_grafana.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_jaeger`}}", + "script": "scripts/install_jaeger.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_homer`}} {{user `homer_user`}} {{user `homer_password`}}", + "script": "scripts/install_homer.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_nginx.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_cloudwatch`}}", + "script": "scripts/install_cloudwatch.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{build `ID`}}", + "script": "scripts/install_apiban.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_nodejs.sh" + }, + { + "type": "shell", + "environment_vars": [ + "ARCH=amd64", + "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_freeswitch.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `jambonz_version`}} {{user `jambonz_user`}} {{user `jambonz_password`}}", + "script": "scripts/install_app.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `leave_source`}}", + "script": "scripts/cleanup.sh" + } + ] +} + diff --git a/packer/jambonz-web-server-and-monitoring-server/aws/template-rhel-9.json b/packer/jambonz-web-server-and-monitoring-server/aws/template-rhel-9.json new file mode 100644 index 0000000..49fd619 --- /dev/null +++ b/packer/jambonz-web-server-and-monitoring-server/aws/template-rhel-9.json @@ -0,0 +1,214 @@ +{ + "variables": { + "region": "us-east-1", + "ssh_username": "ec2-user", + "ami_description": "jambonz all-in-one AMI", + "instance_type": "c6in.2xlarge", + "drachtio_version": "v0.8.24", + "jambonz_version": "v0.8.5-6", + "jambonz_user": "admin", + "jambonz_password": "JambonzR0ck$", + "ami_base_image_owner": "309956199498", + "install_telegraf": "yes", + "homer_user": "homer_user", + "homer_password": "XcapJTqy11LnsYRtxXGPTYQkAnI", + "install_influxdb": "yes", + "install_grafana": "yes", + "install_homer": "yes", + "install_jaeger": "yes", + "install_cloudwatch": "yes", + "install_nodered": "no", + "influxdb_ip": "127.0.0.1", + "rtp_engine_version": "mr11.4.1.4", + "rtp_engine_min_port": "40000", + "rtp_engine_max_port": "60000", + "mediaserver_name" : "jambonz", + "preferred_codec_list" : "PCMU,PCMA,OPUS,G722", + "distro": "rhel-9", + "redhat_username": "your-redhat_username-here", + "redhat_password": "your-redhat_password-here", + "leave_source": "no" + }, + "builders": [{ + "type": "amazon-ebs", + "region": "{{user `region`}}", + "source_ami_filter": { + "filters": { + "virtualization-type": "hvm", + "name": "RHEL-9.2*", + "root-device-type": "ebs", + "architecture": "x86_64" + }, + "owners": ["{{user `ami_base_image_owner`}}"], + "most_recent": true + }, + "instance_type": "{{user `instance_type`}}", + "ssh_username": "{{user `ssh_username`}}", + "ami_name": "jambonz-mini-{{user `jambonz_version`}}-{{user `distro`}}-{{isotime |clean_resource_name }}", + "ami_description": "{{user `ami_description`}}", + "launch_block_device_mappings": [ + { + "device_name": "/dev/sda1", + "volume_size": 100, + "volume_type": "gp3", + "delete_on_termination": true + } + ], + "tags": { + "Name": "jambonz-mini" + }, + "run_tags": { + "Name": "jambonz-mini-build" + } + }], + "provisioners": [ + { + "type": "shell", + "inline": [ + "while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done", + "export PATH=/usr/local/bin:$PATH", + "export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH", + "export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH", + "sudo setenforce 0", + "sudo sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config", + "sudo subscription-manager register --username={{user `redhat_username`}} --password={{user `redhat_password`}}", + "sudo dnf upgrade -y", + "sudo sed -i 's/manage_repos = 0/manage_repos = 1/' /etc/rhsm/rhsm.conf", + "sudo subscription-manager repos --enable=codeready-builder-for-rhel-9-x86_64-rpms", + "sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm", + "sudo /usr/bin/crb enable || true", + "sudo dnf install -y https://download1.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm", + "sudo dnf groupinstall -y 'RPM Development Tools'", + "sudo dnf groupinstall -y 'Development Tools'", + "sudo dnf install -y iptables-devel htop pandoc wget cmake ffmpeg ffmpeg-devel fail2ban \\", + "perl-IPC-Cmd pcre-devel google-perftools-devel libcurl-devel curl jq telnet \\", + "libevent-devel xmlrpc-c-devel gperf libpcap-devel glib2-devel json-glib-devel \\", + "hiredis-devel spandsp-devel mariadb-devel dnsutils speex libedit-devel \\", + "opus-devel lsof redis yasm perl-ExtUtils-Embed libmpg123-devel libshout-devel \\", + "systemd-devel speex-devel speexdsp-devel re2-devel opusfile-devel libtiff-devel \\", + "snapd libjpeg-devel libsndfile-devel lua-devel sqlite-devel libuuid-devel \\", + "lame-devel libyuv-devel protobuf-compiler tcpdump", + "sudo dnf debuginfo-install -y binutils", + "sudo chmod a+w /usr/local/src", + "mkdir ~/apps", + "cd ~/apps", + "git config --global advice.detachedHead false", + "git clone https://github.com/jambonz/sbc-call-router.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/fsw-clear-old-calls.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-outbound.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-inbound.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-sip-sidecar.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-feature-server.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-api-server.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-webapp.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/jambonz-smpp-esme.git -b {{user `jambonz_version`}}", + "git clone https://github.com/jambonz/sbc-rtpengine-sidecar.git -b {{user `jambonz_version`}}" + ] + }, + { + "type": "file", + "source": "files/", + "destination": "/tmp" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_os_tuning.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `drachtio_version`}}", + "script": "scripts/install_drachtio.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_fail2ban.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_redis.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `jambonz_user`}} {{user `jambonz_password`}}", + "script": "scripts/install_mysql.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_influxdb`}}", + "script": "scripts/install_influxdb.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_homer`}} {{user `homer_user`}} {{user `homer_password`}}", + "script": "scripts/install_postgresql.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_telegraf`}} {{user `influxdb_ip`}}", + "script": "scripts/install_telegraf.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_grafana`}}", + "script": "scripts/install_grafana.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_jaeger`}}", + "script": "scripts/install_jaeger.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_homer`}} {{user `homer_user`}} {{user `homer_password`}}", + "script": "scripts/install_homer.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_nginx.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `install_cloudwatch`}}", + "script": "scripts/install_cloudwatch.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{build `ID`}}", + "script": "scripts/install_apiban.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `rtp_engine_version`}}", + "script": "scripts/install_rtpengine.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_nodejs.sh" + }, + { + "type": "shell", + "environment_vars": [ + "ARCH=amd64", + "MEDIA_SERVER_NAME={{user `mediaserver_name`}}", + "PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}" + ], + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}", + "script": "scripts/install_freeswitch.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `jambonz_version`}} {{user `jambonz_user`}} {{user `jambonz_password`}}", + "script": "scripts/install_app.sh" + }, + { + "type": "shell", + "execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `leave_source`}}", + "script": "scripts/cleanup.sh" + } + ] +} diff --git a/packer/jambonz-web-server-and-monitoring-server/aws/template.json b/packer/jambonz-web-server-and-monitoring-server/aws/template.json index 9a64ba7..1185a8d 100644 --- a/packer/jambonz-web-server-and-monitoring-server/aws/template.json +++ b/packer/jambonz-web-server-and-monitoring-server/aws/template.json @@ -4,7 +4,7 @@ "ssh_username": "admin", "ami_description": "jambonz web+monitoring server", "instance_type": "t3.xlarge", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_arch": "amd64", "ami_base_image_owner": "136693071363", "install_datadog": "no", diff --git a/packer/jambonz-web-server/aws/template.json b/packer/jambonz-web-server/aws/template.json index eacb1dc..a4e0557 100644 --- a/packer/jambonz-web-server/aws/template.json +++ b/packer/jambonz-web-server/aws/template.json @@ -5,7 +5,7 @@ "ami_description": "jambonz webserver", "instance_type": "t3.xlarge", "drachtio_version": "v0.8.24", - "jambonz_version": "v0.8.5-5", + "jambonz_version": "v0.8.5-6", "ami_base_image_owner": "136693071363", "install_datadog": "no", "install_cloudwatch": "yes",