Files
jambonz-infrastructure/packer/jambonz-feature-server/template.json
2021-09-03 13:55:35 -04:00

110 lines
3.7 KiB
JSON

{
"variables": {
"region": "us-east-1",
"ssh_username": "admin",
"ami_description": "jambonz feature server",
"instance_type": "t2.xlarge",
"drachtio_version": "v0.8.10",
"jambonz_version": "v0.5-branch",
"install_telegraf": "yes",
"install_datadog": "no"
},
"builders": [{
"type": "amazon-ebs",
"region": "{{user `region`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "debian-10-amd64-*",
"root-device-type": "ebs"
},
"owners": ["136693071363"],
"most_recent": true
},
"instance_type": "{{user `instance_type`}}",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "jambonz-feature-server-{{user `jambonz_version`}}-{{isotime |clean_resource_name }}",
"ami_description": "{{user `ami_description`}}",
"launch_block_device_mappings": [
{
"device_name": "/dev/xvda",
"volume_size": 60,
"volume_type": "gp2",
"delete_on_termination": true
}
],
"security_group_filter": {
"filters": {
"tag:Class": "packer"
}
},
"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",
"sudo apt-get update",
"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 \\",
"iptables-dev 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 \\",
"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 \\",
"libopus-dev libsndfile-dev libshout3-dev libmpg123-dev libmp3lame-dev libopusfile-dev",
"sudo chmod a+w /usr/local/src",
"ssh-keyscan github.com >> ~/.ssh/known_hosts",
"mkdir ~/apps",
"cd ~/apps",
"git clone git@github.com:jambonz/jambonz-feature-server.git -b {{user `jambonz_version`}}",
"git clone git@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",
"script": "scripts/install_chrony.sh"
},
{
"type": "shell",
"script": "scripts/install_freeswitch.sh"
},
{
"type": "shell",
"script": "scripts/install_nodejs.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_datadog`}}",
"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 `drachtio_version`}}",
"script": "scripts/install_drachtio.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `jambonz_version`}}",
"script": "scripts/install_app.sh"
}
]
}