Files
jambonz-infrastructure/packer/jambonz-sbc-rtp/aws/template.json
Dave Horton 32f8b0a4be Feature/debian bookworm (#80)
updates to latest freeswitch (1.10.10), includes latest drachtio-freeswitch-modules with some fixes, updates to lws 4.3.2 (which has MIT License), and some fixes for debian bookworm though not working yet
2023-09-25 14:24:41 -04:00

141 lines
5.2 KiB
JSON

{
"variables": {
"region": "us-east-1",
"ssh_username": "admin",
"ami_description": "jambonz SBC RTP server",
"drachtio_version": "v0.8.24-rc1",
"jambonz_version": "v0.8.5-rc9",
"ami_base_image_arch": "amd64",
"ami_base_image_owner": "136693071363",
"instance_type": "t3.xlarge",
"rtp_engine_version": "mr11.5.1.1",
"rtp_engine_min_port": "40000",
"rtp_engine_max_port": "60000",
"install_datadog": "no",
"datadog_key" : "",
"install_cloudwatch": "yes",
"install_telegraf": "yes",
"distro": "debian-11",
"leave_source": "no"
},
"builders": [{
"type": "amazon-ebs",
"region": "{{user `region`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "jambonz-base-image-{{user `distro`}}",
"root-device-type": "ebs"
},
"owners": ["376029039784"],
"most_recent": true
},
"instance_type": "{{user `instance_type`}}",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "jambonz-sbc-rtp-{{user `jambonz_version`}}-{{user `ami_base_image_arch`}}-{{isotime |clean_resource_name }}",
"ami_description": "{{user `ami_description`}}",
"launch_block_device_mappings": [
{
"device_name": "/dev/xvda",
"volume_size": 50,
"volume_type": "gp2",
"delete_on_termination": true
}
],
"tags": {
"Name": "jambonz-sbc-rtp"
},
"run_tags": {
"Name": "jambonz-sbc-rtp-build"
}
}],
"provisioners": [
{
"type": "shell",
"inline": [
"while [ ! -f /var/lib/cloud/instance/boot-finished ]; do echo 'Waiting for cloud-init...'; sleep 1; done",
"sudo apt-get update",
"sudo apt-get remove --auto-remove nftables",
"sudo apt-get purge nftables",
"sudo apt-get -y install python lsof gcc g++ make cmake build-essential git autoconf automake default-mysql-client redis-tools \\",
"curl telnet libtool libtool-bin libssl-dev libcurl4-openssl-dev libz-dev systemd-coredump liblz4-tool \\",
"libxtables-dev libip6tc-dev libip4tc-dev libiptc-dev linux-headers-{{user `ami_base_image_arch`}} libavformat-dev liblua5.1-0-dev libavfilter-dev libavcodec-dev libswresample-dev \\",
"libevent-dev libpcap-dev libxmlrpc-core-c3-dev markdown libjson-glib-dev lsb-release \\",
"libhiredis-dev gperf libspandsp-dev default-libmysqlclient-dev htop dnsutils gdb libtcmalloc-minimal4 \\",
"gnupg2 wget pkg-config ca-certificates libjpeg-dev libsqlite3-dev libpcre3-dev libldns-dev \\",
"libspeex-dev libspeexdsp-dev libedit-dev libtiff-dev yasm valgrind libswscale-dev haveged pandoc \\",
"libopus-dev libsndfile-dev libshout3-dev libmpg123-dev libmp3lame-dev libopusfile-dev libgoogle-perftools-dev",
"sudo chmod a+w /usr/local/src",
"ssh-keyscan github.com >> ~/.ssh/known_hosts",
"mkdir ~/apps",
"cd ~/apps",
"git config --global advice.detachedHead false",
"git clone https://github.com/jambonz/sbc-rtpengine-sidecar.git -b {{user `jambonz_version`}}",
"sudo find / -name authorized_keys | sudo xargs -0 -r rm -Rf"
]
},
{
"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 `install_cloudwatch`}}",
"script": "scripts/install_cloudwatch.sh"
},
{
"type": "shell",
"environment_vars": [
"DD_KEY={{user `datadog_key`}}",
"DD_INSTALL={{user `install_datadog`}}"
],
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}'",
"script": "scripts/install_datadog.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_telegraf`}}",
"script": "scripts/install_telegraf.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `rtp_engine_version`}}",
"script": "scripts/install_rtpengine.sh"
},
{
"type": "shell",
"script": "scripts/install_nodejs.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `drachtio_version`}}",
"script": "scripts/install_drachtio.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `jambonz_version`}}",
"script": "scripts/install_app.sh"
},
{
"type": "shell",
"inline": [
"set -e",
"set -x",
"echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections",
"echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections",
"sudo apt-get -y install iptables-persistent",
"sudo rm -Rf /tmp/*",
"sudo rm /root/.ssh/authorized_keys",
"sudo rm /home/admin/.ssh/authorized_keys",
"if [ \"{{user `leave_source`}}\" = 'no' ]; then sudo rm -Rf /usr/local/src/*; fi"
]
}
]
}