forked from creatorip1/jambonz-infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemplate.json
More file actions
124 lines (124 loc) · 4.13 KB
/
template.json
File metadata and controls
124 lines (124 loc) · 4.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
{
"variables": {
"region": "us-east-1",
"ssh_username": "admin",
"ami_description": "jambonz SBC media server",
"drachtio_version": "v0.8.13-rc1",
"jambonz_version": "v0.7.0",
"instance_type": "t2.medium",
"rtp_engine_version": "mr10.2.1.1",
"rtp_engine_min_port": "40000",
"rtp_engine_max_port": "60000",
"install_datadog": "no",
"datadog_key" : "",
"install_telegraf": "yes"
},
"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-sbc-rtp-{{user `jambonz_version`}}-{{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
}
],
"security_group_filter": {
"filters": {
"tag:Class": "packer"
}
},
"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 -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 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 \\",
"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 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",
"script": "scripts/install_chrony.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": [
"sudo rm /root/.ssh/authorized_keys",
"sudo rm /home/admin/.ssh/authorized_keys"
]
}
]
}