mirror of
https://github.com/jambonz/jambonz-infrastructure.git
synced 2026-01-25 02:08:27 +00:00
153 lines
6.0 KiB
JSON
153 lines
6.0 KiB
JSON
{
|
|
"variables": {
|
|
"region": "us-east-1",
|
|
"ssh_username": "ec2-user",
|
|
"ami_description": "jambonz feature server",
|
|
"instance_type": "c6in.2xlarge",
|
|
"drachtio_version": "v0.8.24-rc1",
|
|
"jambonz_version": "v0.8.5-6",
|
|
"ami_base_image_arch": "amd64",
|
|
"ami_base_image_owner": "309956199498",
|
|
"install_telegraf": "yes",
|
|
"install_datadog": "no",
|
|
"datadog_key" : "",
|
|
"install_cloudwatch": "yes",
|
|
"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-feature-server-{{user `jambonz_version`}}-{{user `distro`}}-{{user `ami_base_image_arch`}}-{{isotime |clean_resource_name }}",
|
|
"ami_description": "{{user `ami_description`}}",
|
|
"launch_block_device_mappings": [
|
|
{
|
|
"device_name": "/dev/sda1",
|
|
"volume_size": 60,
|
|
"volume_type": "gp3",
|
|
"delete_on_termination": true
|
|
}
|
|
],
|
|
"tags": {
|
|
"Name": "jambonz-feature-server"
|
|
},
|
|
"run_tags": {
|
|
"Name": "jambonz-feature-server-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-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",
|
|
"mkdir ~/apps",
|
|
"cd ~/apps",
|
|
"git config --global advice.detachedHead false",
|
|
"git clone https://github.com/jambonz/jambonz-feature-server.git -b {{user `jambonz_version`}}",
|
|
"git clone https://github.com/jambonz/fsw-clear-old-calls.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",
|
|
"environment_vars": [
|
|
"ARCH={{user `ami_base_image_arch`}}",
|
|
"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`}} {{user `install_cloudwatch`}}",
|
|
"script": "scripts/install_cloudwatch.sh"
|
|
},
|
|
{
|
|
"type": "shell",
|
|
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}}",
|
|
"script": "scripts/install_nodejs.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 `distro`}} {{user `install_telegraf`}}",
|
|
"script": "scripts/install_telegraf.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`}} {{user `jambonz_version`}}",
|
|
"script": "scripts/install_app.sh"
|
|
},
|
|
{
|
|
"type": "shell",
|
|
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `distro`}} {{user `leave_source`}}",
|
|
"script": "scripts/cleanup.sh"
|
|
}
|
|
]
|
|
}
|