mirror of
https://github.com/jambonz/jambonz-infrastructure.git
synced 2026-10-04 05:03:59 +00:00
packer updates
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz feature server",
|
||||
"instance_type": "t2.xlarge",
|
||||
"drachtio_version": "v0.8.11-rc2",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"drachtio_version": "v0.8.12",
|
||||
"jambonz_version": "v0.6.7-rc4",
|
||||
"install_telegraf": "yes",
|
||||
"install_datadog": "no"
|
||||
},
|
||||
@@ -55,7 +55,7 @@
|
||||
"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 \\",
|
||||
"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",
|
||||
|
||||
@@ -9,7 +9,7 @@ Type=forking
|
||||
ExecStartPre=/bin/sh -c 'systemctl set-environment LOCAL_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`'
|
||||
ExecStartPre=/bin/sh -c 'systemctl set-environment PUBLIC_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`'
|
||||
ExecStart=/usr/local/bin/drachtio --daemon --contact sip:${LOCAL_IP};transport=udp --external-ip ${PUBLIC_IP} \
|
||||
--contact sip:${LOCAL_IP};transport=tcp \
|
||||
--contact sip:${LOCAL_IP};transport=tcp \
|
||||
--address 0.0.0.0 --port 9022 --homer 127.0.0.1:9060 --homer-id 10
|
||||
TimeoutSec=15s
|
||||
Restart=always
|
||||
|
||||
@@ -6,6 +6,33 @@ module.exports = {
|
||||
cwd: '/home/admin/apps/jambonz-webapp',
|
||||
args: 'run serve'
|
||||
},
|
||||
{
|
||||
name: 'jambonz-smpp-esme',
|
||||
cwd: '/home/admin/apps/jambonz-webapp',
|
||||
script: 'app.js',
|
||||
out_file: '/home/admin/.pm2/logs/jambonz-smpp-esme.log',
|
||||
err_file: '/home/admin/.pm2/logs/jambonz-smpp-esme.log',
|
||||
combine_logs: true,
|
||||
instance_var: 'INSTANCE_ID',
|
||||
exec_mode: 'fork',
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
HTTP_PORT: 3020,
|
||||
AVOID_UDH: true,
|
||||
JAMBONES_MYSQL_HOST: '127.0.0.1',
|
||||
JAMBONES_MYSQL_USER: 'admin',
|
||||
JAMBONES_MYSQL_PASSWORD: 'JambonzR0ck$',
|
||||
JAMBONES_MYSQL_DATABASE: 'jambones',
|
||||
JAMBONES_MYSQL_CONNECTION_LIMIT: 10,
|
||||
JAMBONES_REDIS_HOST: '127.0.0.1',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
JAMBONES_LOGLEVEL: 'debug'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'jambonz-api-server',
|
||||
cwd: '/home/admin/apps/jambonz-api-server',
|
||||
@@ -145,6 +172,7 @@ module.exports = {
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
JAMBONES_NETWORK_CIDR: 'PRIVATE_IP/32',
|
||||
MIN_CALL_LIMIT: 9999,
|
||||
RTPENGINE_PING_INTERVAL: 30000,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
@@ -203,6 +231,30 @@ module.exports = {
|
||||
MS_TEAMS_SIP_PROXY_IPS: '52.114.148.0, 52.114.132.46, 52.114.75.24, 52.114.76.76, 52.114.7.24, 52.114.14.70'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'sbc-rtpengine-sidecar',
|
||||
cwd: '/home/admin/apps/sbc-rtpengine-sidecar',
|
||||
script: 'app.js',
|
||||
instance_var: 'INSTANCE_ID',
|
||||
out_file: '/home/admin/.pm2/logs/jambonz-sbc-rtpengine-sidecar.log',
|
||||
err_file: '/home/admin/.pm2/logs/jambonz-sbc-rtpengine-sidecar.log',
|
||||
exec_mode: 'fork',
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
LOGLEVEL: 'info',
|
||||
DTMF_ONLY: true,
|
||||
RTPENGINE_DTMF_LOG_PORT: 22223,
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'jambonz-feature-server',
|
||||
cwd: '/home/admin/apps/jambonz-feature-server',
|
||||
|
||||
@@ -15,6 +15,7 @@ ExecStart=/usr/local/bin/rtpengine \
|
||||
--listen-ng=22222 \
|
||||
--listen-http=8080 \
|
||||
--listen-udp=12222 \
|
||||
--dtmf-log-dest=127.0.0.1:22223 \
|
||||
--listen-cli=127.0.0.1:9900 \
|
||||
--pidfile /var/run/rtpengine.pid \
|
||||
--port-min 40000 \
|
||||
|
||||
@@ -17,6 +17,8 @@ cd /home/admin/apps/sbc-outbound && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/sbc-registrar && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/sbc-call-router && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/jambonz-api-server && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/jambonz-smpp-esme && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/sbc-rtpengine-sidecar && sudo npm install --unsafe-perm
|
||||
|
||||
JAMBONES_MYSQL_HOST=localhost JAMBONES_MYSQL_USER=${DB_USER} JAMBONES_MYSQL_PASSWORD=${DB_PASS} JAMBONES_MYSQL_DATABASE=jambones /home/admin/apps/jambonz-api-server/db/reset_admin_password.js
|
||||
|
||||
@@ -32,5 +34,3 @@ rm
|
||||
sudo chown -R admin:admin /home/admin/apps
|
||||
|
||||
sudo rm /home/admin/apps/jambonz-webapp/.env
|
||||
#sudo cp /tmp/initialize-webapp-userdata.sh /var/lib/cloud/scripts/per-instance
|
||||
#sudo chmod +x /var/lib/cloud/scripts/per-instance/initialize-webapp-userdata.sh
|
||||
@@ -4,8 +4,8 @@
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz all-in-one AMI",
|
||||
"instance_type": "t2.xlarge",
|
||||
"drachtio_version": "v0.8.10",
|
||||
"jambonz_version": "v0.6.5",
|
||||
"drachtio_version": "v0.8.12",
|
||||
"jambonz_version": "v0.6.7-rc4",
|
||||
"jambonz_user": "admin",
|
||||
"jambonz_password": "JambonzR0ck$",
|
||||
"install_telegraf": "yes",
|
||||
@@ -15,7 +15,7 @@
|
||||
"install_homer": "yes",
|
||||
"install_nodered": "no",
|
||||
"influxdb_ip": "127.0.0.1",
|
||||
"rtp_engine_version": "mr9.3.1.8",
|
||||
"rtp_engine_version": "mr10.0.1.4",
|
||||
"rtp_engine_min_port": "40000",
|
||||
"rtp_engine_max_port": "60000"
|
||||
},
|
||||
@@ -81,7 +81,9 @@
|
||||
"git clone https://github.com/jambonz/sbc-registrar.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-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`}}"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz monitoring server",
|
||||
"instance_type": "t2.medium",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"jambonz_version": "v0.6.7-rc4",
|
||||
"homer_user": "homer_user",
|
||||
"homer_password": "XcapJTqy11LnsYRtxXGPTYQkAnI",
|
||||
"install_influxdb": "yes",
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"region": "us-east-1",
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz SBC media server",
|
||||
"drachtio_version": "v0.8.11-rc2",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"drachtio_version": "v0.8.12",
|
||||
"jambonz_version": "v0.6.7-rc4",
|
||||
"instance_type": "t2.medium",
|
||||
"rtp_engine_version": "mr9.3.1.8",
|
||||
"rtp_engine_version": "mr10.0.1.4",
|
||||
"rtp_engine_min_port": "40000",
|
||||
"rtp_engine_max_port": "60000",
|
||||
"install_datadog": "no",
|
||||
@@ -58,7 +58,7 @@
|
||||
"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 \\",
|
||||
"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",
|
||||
|
||||
@@ -120,6 +120,7 @@ module.exports = {
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
JAMBONES_NETWORK_CIDR: '${VPC_CIDR}',
|
||||
ENABLE_METRICS: 0,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
@@ -150,6 +151,7 @@ module.exports = {
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
JAMBONES_NETWORK_CIDR: '${VPC_CIDR}',
|
||||
ENABLE_METRICS: 0,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
|
||||
@@ -3,14 +3,14 @@
|
||||
"region": "us-east-1",
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz SBC SIP+RTP+Webserver+monitoring",
|
||||
"drachtio_version": "v0.8.11-rc1",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"drachtio_version": "v0.8.11",
|
||||
"jambonz_version": "v0.6.7-rc3",
|
||||
"install_influxdb": "yes",
|
||||
"install_homer": "yes",
|
||||
"homer_user": "homer_user",
|
||||
"homer_password": "XcapJTqy11LnsYRtxXGPTYQkAnI",
|
||||
"instance_type": "t2.xlarge",
|
||||
"rtp_engine_version": "mr9.3.1.8",
|
||||
"rtp_engine_version": "mr10.0.1.4",
|
||||
"rtp_engine_min_port": "40000",
|
||||
"rtp_engine_max_port": "60000"
|
||||
},
|
||||
@@ -59,7 +59,7 @@
|
||||
"sudo apt-get -y install lsof python lsof gcc g++ make cmake build-essential git autoconf automake default-mysql-client redis-tools \\",
|
||||
"jq 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 \\",
|
||||
"libevent-dev libpcap-dev libxmlrpc-core-c3-dev markdown libjson-glib-dev lsb-release libtcmalloc-minimal4 \\",
|
||||
"libhiredis-dev gperf libspandsp-dev default-libmysqlclient-dev htop dnsutils gdb certbot python-certbot-nginx \\",
|
||||
"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 \\",
|
||||
|
||||
@@ -121,6 +121,7 @@ module.exports = {
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
JAMBONES_NETWORK_CIDR: '${VPC_CIDR}',
|
||||
ENABLE_DATADOG_METRICS: 0,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
@@ -150,6 +151,7 @@ module.exports = {
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
JAMBONES_NETWORK_CIDR: '${VPC_CIDR}',
|
||||
ENABLE_DATADOG_METRICS: 0,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz SBC SIP",
|
||||
"instance_type": "t2.medium",
|
||||
"drachtio_version": "v0.8.11-rc2",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"drachtio_version": "v0.8.12",
|
||||
"jambonz_version": "v0.6.7-rc4",
|
||||
"install_datadog": "no",
|
||||
"install_telegraf": "yes"
|
||||
},
|
||||
@@ -55,7 +55,7 @@
|
||||
"jq 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 \\",
|
||||
"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 fail2ban",
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
#!/bin/bash
|
||||
|
||||
TIMEOUT=20
|
||||
PAUSE=5
|
||||
|
||||
aws_get_instance_id() {
|
||||
instance_id=$( (curl http://169.254.169.254/latest/meta-data/instance-id) )
|
||||
if [ -n "$instance_id" ]; then return 0; else return 1; fi
|
||||
}
|
||||
|
||||
aws_get_instance_region() {
|
||||
instance_region=$(curl http://169.254.169.254/latest/meta-data/placement/availability-zone)
|
||||
# region here needs the last character removed to work
|
||||
instance_region=${instance_region::-1}
|
||||
if [ -n "$instance_region" ]; then return 0; else return 1; fi
|
||||
}
|
||||
|
||||
aws_get_instance_environment() {
|
||||
instance_environment=$(aws ec2 describe-tags --region $instance_region --filters "Name=resource-id,Values=$1" "Name=key,Values=Environment" --query "Tags[*].Value" --output text)
|
||||
if [ -n "$instance_environment" ]; then return 0; else return 1; fi
|
||||
}
|
||||
|
||||
aws_get_unassigned_eips() {
|
||||
local describe_addreses_response=$(aws ec2 describe-addresses --region $instance_region --filters "Name=tag:Environment,Values=$instance_environment" --query "Addresses[?AssociationId==null].AllocationId" --output text)
|
||||
eips=(${describe_addreses_response///})
|
||||
if [ -n "$describe_addreses_response" ]; then return 0; else return 1; fi
|
||||
}
|
||||
|
||||
aws_get_details() {
|
||||
if aws_get_instance_id; then
|
||||
echo "Instance ID: ${instance_id}."
|
||||
if aws_get_instance_region; then
|
||||
echo "Instance Region: ${instance_region}."
|
||||
if aws_get_instance_environment $instance_id; then
|
||||
echo "Instance Environment: ${instance_environment}."
|
||||
else
|
||||
echo "Failed to get Instance Environment. ${instance_environment}."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "Failed to get Instance Region. ${instance_region}."
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
echo "Failed to get Instance ID. ${instance_id}."
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
attempt_to_assign_eip() {
|
||||
local result;
|
||||
local exit_code;
|
||||
result=$( (aws ec2 associate-address --region $instance_region --instance-id $instance_id --allocation-id $1 --no-allow-reassociation) 2>&1 )
|
||||
exit_code=$?
|
||||
if [ "$exit_code" -ne 0 ]; then
|
||||
echo "Failed to assign Elastic IP [$1] to Instance [$instance_id]. ERROR: $result"
|
||||
fi
|
||||
return $exit_code
|
||||
}
|
||||
|
||||
try_to_assign() {
|
||||
local last_result;
|
||||
for eip_id in "${eips[@]}"; do
|
||||
echo "Attempting to assign Elastic IP to instance..."
|
||||
if attempt_to_assign_eip $eip_id; then
|
||||
echo "Elastic IP successfully assigned to instance."
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
main() {
|
||||
echo "Assigning Elastic IP..."
|
||||
local end_time=$((SECONDS+TIMEOUT))
|
||||
echo "Timeout: ${end_time}"
|
||||
|
||||
if ! aws_get_details; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while [ $SECONDS -lt $end_time ]; do
|
||||
if aws_get_unassigned_eips && try_to_assign ${eips}; then
|
||||
echo "Successfully assigned EIP."
|
||||
exit 0
|
||||
fi
|
||||
echo "Failed to assign EIP. Pausing for $PAUSE seconds before retrying..."
|
||||
sleep $PAUSE
|
||||
done
|
||||
|
||||
echo "Failed to assign Elastic IP after $TIMEOUT seconds. Exiting."
|
||||
exit 1
|
||||
}
|
||||
|
||||
declare instance_id
|
||||
declare instance_region
|
||||
declare instance_environment
|
||||
declare eips
|
||||
|
||||
main "$@"
|
||||
@@ -14,3 +14,6 @@ sudo -u admin bash -c "pm2 set pm2-logrotate:retain 5"
|
||||
sudo -u admin bash -c "pm2 set pm2-logrotate:compress true"
|
||||
|
||||
sudo chown -R admin:admin /home/admin/apps
|
||||
|
||||
sudo cp /tmp/auto-assign-elastic-ip.sh /usr/local/bin
|
||||
sudo chmod +x /usr/local/bin/auto-assign-elastic-ip.sh
|
||||
@@ -4,8 +4,7 @@
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz webserver",
|
||||
"instance_type": "t2.medium",
|
||||
"drachtio_version": "v0.8.11-rc1",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"jambonz_version": "v0.6.7-rc4",
|
||||
"install_datadog": "no",
|
||||
"install_telegraf": "yes"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user