forked from jambonz/jambonz-infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.json
195 lines (195 loc) · 7.5 KB
/
template.json
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
{
"variables": {
"region": "us-east-1",
"ssh_username": "admin",
"ami_description": "jambonz all-in-one AMI",
"instance_type": "t2.xlarge",
"drachtio_version": "v0.8.21",
"jambonz_version": "v0.8.1",
"jambonz_user": "admin",
"jambonz_password": "JambonzR0ck$",
"install_telegraf": "yes",
"homer_user": "homer_user",
"homer_password": "XcapJTqy11LnsYRtxXGPTYQkAnI",
"install_influxdb": "yes",
"install_homer": "yes",
"install_jaeger": "yes",
"install_cloudwatch": "yes",
"install_nodered": "no",
"influxdb_ip": "127.0.0.1",
"rtp_engine_version": "mr11.2.1.2",
"rtp_engine_min_port": "40000",
"rtp_engine_max_port": "60000",
"mediaserver_name" : "jambonz",
"preferred_codec_list" : "PCMU,PCMA,OPUS,G722"
},
"builders": [{
"type": "amazon-ebs",
"region": "{{user `region`}}",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "debian-11-amd64-*",
"root-device-type": "ebs"
},
"owners": ["136693071363"],
"most_recent": true
},
"instance_type": "{{user `instance_type`}}",
"ssh_username": "{{user `ssh_username`}}",
"ami_name": "jambonz-mini-{{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
}
],
"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",
"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 argon2 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-$(uname -r) 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 libswscale-dev haveged jq fail2ban \\",
"libopus-dev libsndfile-dev libshout3-dev libmpg123-dev libmp3lame-dev libopusfile-dev libgoogle-perftools-dev",
"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",
"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": [
"ARCH=amd64",
"MEDIA_SERVER_NAME={{user `mediaserver_name`}}",
"PREFERRED_CODEC_LIST={{user `preferred_codec_list`}}"
],
"script": "scripts/install_freeswitch.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `rtp_engine_version`}}",
"script": "scripts/install_rtpengine.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `drachtio_version`}}",
"script": "scripts/install_drachtio.sh"
},
{
"type": "shell",
"script": "scripts/install_nodejs.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_influxdb`}}",
"script": "scripts/install_influxdb.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{build `ID`}} {{user `apiban_username`}} {{user `apiban_password`}}",
"script": "scripts/install_apiban.sh"
},
{
"type": "shell",
"script": "scripts/install_nginx.sh"
},
{
"type": "shell",
"script": "scripts/install_redis.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_homer`}} {{user `homer_user`}} {{user `homer_password`}}",
"script": "scripts/install_postgresql.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_homer`}} {{user `influxdb_ip`}}",
"script": "scripts/install_telegraf.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_homer`}} {{user `homer_user`}} {{user `homer_password`}}",
"script": "scripts/install_homer.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_influxdb`}}",
"script": "scripts/install_grafana.sh"
},
{
"type": "shell",
"script": "scripts/install_fail2ban.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_jaeger`}}",
"script": "scripts/install_jaeger.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `jambonz_user`}} {{user `jambonz_password`}}",
"script": "scripts/install_mysql.sh"
},
{
"type": "shell",
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `jambonz_version`}} {{user `jambonz_user`}} {{user `jambonz_password`}}",
"script": "scripts/install_app.sh"
},
{
"type": "shell",
"inline": [
"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"
]
}
]
}