mirror of
https://github.com/jambonz/jambonz-infrastructure.git
synced 2026-10-04 05:03:59 +00:00
latest updates
This commit is contained in:
@@ -7,7 +7,9 @@ After=syslog.target network.target local-fs.target
|
||||
; service
|
||||
Type=forking
|
||||
ExecStartPre=/bin/sh -c 'systemctl set-environment LOCAL_IP=`curl -s http://169.254.169.254/latest/meta-data/local-ipv4`'
|
||||
ExecStart=/usr/local/bin/drachtio --daemon --contact sip:${LOCAL_IP};transport=udp,tcp --address 0.0.0.0 --port 9022
|
||||
ExecStart=/usr/local/bin/drachtio --daemon --contact sip:${LOCAL_IP};transport=udp,tcp \
|
||||
--address 0.0.0.0 --port 9022 \
|
||||
--prometheus-scrape-port 9090
|
||||
TimeoutSec=15s
|
||||
Restart=always
|
||||
; exec
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz feature server",
|
||||
"instance_type": "t2.xlarge",
|
||||
"drachtio_version": "v0.8.11-rc1",
|
||||
"drachtio_version": "v0.8.11-rc2",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"install_telegraf": "yes",
|
||||
"install_datadog": "no"
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
</file>
|
||||
|
||||
<sofia-loglevel>3</sofia-loglevel>
|
||||
|
||||
|
||||
<loglevel>info</loglevel>
|
||||
</logging>
|
||||
|
||||
</drachtio>
|
||||
|
||||
</drachtio>
|
||||
@@ -10,7 +10,7 @@ ExecStartPre=/bin/sh -c 'systemctl set-environment LOCAL_IP=`curl -s http://169.
|
||||
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 \
|
||||
--address 0.0.0.0 --port 9022
|
||||
--address 0.0.0.0 --port 9022 --homer 127.0.0.1:9060 --homer-id 10
|
||||
TimeoutSec=15s
|
||||
Restart=always
|
||||
; exec
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
module.exports = {
|
||||
apps : [
|
||||
{
|
||||
name: 'jambonz-webapp',
|
||||
script: 'npm',
|
||||
cwd: '/home/admin/apps/jambonz-webapp',
|
||||
args: 'run serve'
|
||||
},
|
||||
{
|
||||
name: 'jambonz-api-server',
|
||||
cwd: '/home/admin/apps/jambonz-api-server',
|
||||
@@ -15,18 +21,54 @@ module.exports = {
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_MYSQL_HOST: '$${JAMBONES_MYSQL_HOST}',
|
||||
JAMBONES_MYSQL_USER: '$${JAMBONES_MYSQL_USER}',
|
||||
JAMBONES_MYSQL_PASSWORD: '$${JAMBONES_MYSQL_PASSWORD}',
|
||||
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: '$${JAMBONES_REDIS_HOST}',
|
||||
JAMBONES_REDIS_HOST: '127.0.0.1',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
JAMBONE_API_VERSION: 'v1',
|
||||
JAMBONES_CREATE_CALL_URL: 'http://127.0.0.1:4001/v1/createCall',
|
||||
HTTP_PORT: 3000
|
||||
},
|
||||
JAMBONES_TIME_SERIES_HOST: '127.0.0.1',
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1,
|
||||
HTTP_PORT: 3002,
|
||||
HOMER_BASE_URL: 'http://127.0.0.1:9080',
|
||||
HOMER_USERNAME: 'admin',
|
||||
HOMER_PASSWORD: 'sipcapture'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'sbc-options-handler',
|
||||
cwd: '/home/admin/apps/sbc-options-handler',
|
||||
script: 'app.js',
|
||||
instance_var: 'INSTANCE_ID',
|
||||
out_file: '/home/admin/.pm2/logs/jambonz-sbc-options-handler.log',
|
||||
err_file: '/home/admin/.pm2/logs/jambonz-sbc-options-handler.log',
|
||||
exec_mode: 'fork',
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
DRACHTIO_SECRET: 'cymru',
|
||||
JAMBONES_REDIS_HOST: '127.0.0.1',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1,
|
||||
JAMBONES_NETWORK_CIDR: 'PRIVATE_IP/32'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'sbc-call-router',
|
||||
@@ -46,45 +88,12 @@ module.exports = {
|
||||
JAMBONES_INBOUND_ROUTE: '127.0.0.1:4002',
|
||||
JAMBONES_OUTBOUND_ROUTE: '127.0.0.1:4003',
|
||||
JAMBONZ_TAGGED_INBOUND: 1,
|
||||
JAMBONES_NETWORK_CIDR: '172.31.32.0/24'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'jambonz-feature-server',
|
||||
cwd: '/home/admin/apps/jambonz-feature-server',
|
||||
script: 'app.js',
|
||||
instance_var: 'INSTANCE_ID',
|
||||
out_file: '/home/admin/.pm2/logs/jambonz-feature-server.log',
|
||||
err_file: '/home/admin/.pm2/logs/jambonz-feature-server.log',
|
||||
exec_mode: 'fork',
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
GOOGLE_APPLICATION_CREDENTIALS: '/home/admin/credentials/$${GOOGLE_APPLICATION_CREDENTIALS}',
|
||||
AWS_ACCESS_KEY_ID: '$${AWS_ACCESS_KEY_ID}',
|
||||
AWS_SECRET_ACCESS_KEY: '${{AWS_SECRET_ACCESS_KEY}',
|
||||
AWS_REGION: '$${AWS_REGION}',
|
||||
ENABLE_DATADOG_METRICS: 0,
|
||||
ENABLE_DATADOG_METRICS: 0,
|
||||
JAMBONES_NETWORK_CIDR: '172.31.32.0/24',
|
||||
JAMBONES_MYSQL_HOST: '$${JAMBONES_MYSQL_HOST}',
|
||||
JAMBONES_MYSQL_USER: '$${JAMBONES_MYSQL_USER}',
|
||||
JAMBONES_MYSQL_PASSWORD: '$${JAMBONES_MYSQL_PASSWORD}',
|
||||
JAMBONES_MYSQL_DATABASE: 'jambones',
|
||||
JAMBONES_MYSQL_CONNECTION_LIMIT: 10,
|
||||
JAMBONES_REDIS_HOST: '$${JAMBONES_REDIS_HOST}',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
JAMBONES_LOGLEVEL: 'debug',
|
||||
HTTP_PORT: 4001,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9023,
|
||||
DRACHTIO_SECRET: 'cymru',
|
||||
JAMBONES_SBCS: '172.31.32.100:5060',
|
||||
JAMBONES_FEATURE_SERVERS: '127.0.0.1:9023:cymru',
|
||||
JAMBONES_FREESWITCH: '127.0.0.1:8021:JambonzR0ck$'
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1,
|
||||
JAMBONES_NETWORK_CIDR: 'PRIVATE_IP/32'
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -101,18 +110,24 @@ module.exports = {
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
ENABLE_DATADOG_METRICS: 0,
|
||||
JAMBONES_LOGLEVEL: 'debug',
|
||||
RTPENGINE_PING_INTERVAL: 30000,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
DRACHTIO_SECRET: 'cymru',
|
||||
JAMBONES_MYSQL_HOST: '$${JAMBONES_MYSQL_HOST}',
|
||||
JAMBONES_MYSQL_USER: '$${JAMBONES_MYSQL_USER}',
|
||||
JAMBONES_MYSQL_PASSWORD: '$${JAMBONES_MYSQL_PASSWORD}',
|
||||
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: '$${JAMBONES_REDIS_HOST}',
|
||||
JAMBONES_REDIS_HOST: '127.0.0.1',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
JAMBONES_TIME_SERIES_HOST: '127.0.0.1',
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -129,19 +144,27 @@ module.exports = {
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_LOGLEVEL: 'debug',
|
||||
ENABLE_DATADOG_METRICS: 0,
|
||||
JAMBONES_LOGLEVEL: 'info',
|
||||
MIN_CALL_LIMIT: 9999,
|
||||
RTPENGINE_PING_INTERVAL: 30000,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
DRACHTIO_SECRET: 'cymru',
|
||||
JAMBONES_RTPENGINES: '127.0.0.1:22222',
|
||||
JAMBONES_MYSQL_HOST: '$${JAMBONES_MYSQL_HOST}',
|
||||
JAMBONES_MYSQL_USER: '$${JAMBONES_MYSQL_USER}',
|
||||
JAMBONES_MYSQL_PASSWORD: '$${JAMBONES_MYSQL_PASSWORD}',
|
||||
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: '$${JAMBONES_REDIS_HOST}',
|
||||
JAMBONES_REDIS_HOST: '127.0.0.1',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
JAMBONES_TIME_SERIES_HOST: '127.0.0.1',
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1,
|
||||
MS_TEAMS_FQDN: ''
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -158,20 +181,66 @@ module.exports = {
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
JAMBONES_NETWORK_CIDR: 'PRIVATE_IP/32',
|
||||
JAMBONES_LOGLEVEL: 'debug',
|
||||
ENABLE_DATADOG_METRICS: 0,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9022,
|
||||
DRACHTIO_SECRET: 'cymru',
|
||||
JAMBONES_FEATURE_SERVERS: '172.31.3.33:5070',
|
||||
JAMBONES_RTPENGINES: '127.0.0.1:22222',
|
||||
JAMBONES_MYSQL_HOST: '$${JAMBONES_MYSQL_HOST}',
|
||||
JAMBONES_MYSQL_USER: '$${JAMBONES_MYSQL_USER}',
|
||||
JAMBONES_MYSQL_PASSWORD: '$${JAMBONES_MYSQL_PASSWORD}',
|
||||
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: '$${JAMBONES_REDIS_HOST}',
|
||||
JAMBONES_REDIS_HOST: '127.0.0.1',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
JAMBONES_TIME_SERIES_HOST: '127.0.0.1',
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1,
|
||||
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: 'jambonz-feature-server',
|
||||
cwd: '/home/admin/apps/jambonz-feature-server',
|
||||
script: 'app.js',
|
||||
instance_var: 'INSTANCE_ID',
|
||||
out_file: '/home/admin/.pm2/logs/jambonz-feature-server.log',
|
||||
err_file: '/home/admin/.pm2/logs/jambonz-feature-server.log',
|
||||
exec_mode: 'fork',
|
||||
instances: 1,
|
||||
autorestart: true,
|
||||
watch: false,
|
||||
max_memory_restart: '1G',
|
||||
env: {
|
||||
NODE_ENV: 'production',
|
||||
GOOGLE_APPLICATION_CREDENTIALS: '/home/admin/credentials/gcp.json',
|
||||
AWS_REGION: 'AWS_REGION_HERE',
|
||||
ENABLE_METRICS: 1,
|
||||
STATS_HOST: '127.0.0.1',
|
||||
STATS_PORT: 8125,
|
||||
STATS_PROTOCOL: 'tcp',
|
||||
STATS_TELEGRAF: 1,
|
||||
JAMBONES_NETWORK_CIDR: 'PRIVATE_IP/32',
|
||||
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',
|
||||
JAMBONES_TIME_SERIES_HOST: '127.0.0.1',
|
||||
HTTP_PORT: 3000,
|
||||
DRACHTIO_HOST: '127.0.0.1',
|
||||
DRACHTIO_PORT: 9023,
|
||||
DRACHTIO_SECRET: 'cymru',
|
||||
JAMBONES_SBCS: 'PRIVATE_IP',
|
||||
JAMBONES_FREESWITCH: '127.0.0.1:8021:JambonzR0ck$'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -12,6 +12,7 @@ Environment="MOD_AUDIO_FORK_SUBPROTOCOL_NAME=audio.jambonz.org"
|
||||
Environment="MOD_AUDIO_FORK_SERVICE_THREADS=1"
|
||||
Environment="MOD_AUDIO_FORK_BUFFER_SECS=3"
|
||||
Environment="LD_LIBRARY_PATH=/usr/local/lib"
|
||||
Environment="GOOGLE_APPLICATION_CREDENTIALS=/home/admin/credentials/gcp.json"
|
||||
ExecStart=/usr/local/freeswitch/bin/freeswitch -nc -nonat
|
||||
TimeoutSec=45s
|
||||
Restart=always
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
# <param name="rollover" value="0"/>
|
||||
|
||||
#number of days of logs to keep
|
||||
NUMBERDAYS=30
|
||||
NUMBERDAYS=5
|
||||
FSPATH=/usr/local/freeswitch/
|
||||
|
||||
$FSPATH/bin/fs_cli -x "fsctl send_sighup" |grep '+OK' >/tmp/rotateFSlogs
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
<param name="sip-trace" value="no"/>
|
||||
<param name="rfc2833-pt" value="101"/>
|
||||
|
||||
<!-- should be able to be removed in v1.6.8 or later (ref: https://freeswitch.org/jira/browse/FS-9051) -->
|
||||
<param name="dtmf-type" value="rfc2833"/>
|
||||
|
||||
<param name="inbound-late-negotiation" value="true"/>
|
||||
@@ -33,13 +32,13 @@
|
||||
<param name="enable-3pcc" value="true"/>
|
||||
|
||||
<!-- TLS: enabled by default, set to "false" to disable -->
|
||||
<param name="tls" value="true"/>
|
||||
<param name="tls" value="false"/>
|
||||
<!-- Set to true to not bind on the normal sip-port but only on the TLS port -->
|
||||
<param name="tls-only" value="false"/>
|
||||
<!-- additional bind parameters for TLS -->
|
||||
<param name="tls-bind-params" value="transport=tls"/>
|
||||
<!-- Port to listen on for TLS requests. (5061 will be used if unspecified) -->
|
||||
<param name="tls-sip-port" value="5081"/>
|
||||
<param name="tls-sip-port" value="5061"/>
|
||||
<!-- Location of the agent.pem and cafile.pem ssl certificates (needed for TLS server) -->
|
||||
<!--<param name="tls-cert-dir" value="/usr/local/freeswitch/certs"/>-->
|
||||
<!-- Optionally set the passphrase password used by openSSL to encrypt/decrypt TLS private key files -->
|
||||
|
||||
@@ -6,10 +6,14 @@ After=syslog.target network.target local-fs.target
|
||||
[Service]
|
||||
; service
|
||||
Type=forking
|
||||
Environment="LD_LIBRARY_PATH=/usr/local/lib/"
|
||||
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/rtpengine --interface ${LOCAL_IP}!${PUBLIC_IP} \
|
||||
ExecStart=/usr/local/bin/rtpengine \
|
||||
--interface private/${LOCAL_IP} \
|
||||
--interface public/${LOCAL_IP}!${PUBLIC_IP} \
|
||||
--listen-ng=22222 \
|
||||
--listen-http=8080 \
|
||||
--listen-udp=12222 \
|
||||
--listen-cli=127.0.0.1:9900 \
|
||||
--pidfile /var/run/rtpengine.pid \
|
||||
|
||||
@@ -1,23 +1,36 @@
|
||||
#!/bin/bash
|
||||
VERSION=$1
|
||||
DB_USER=$2
|
||||
DB_PASS=$3
|
||||
|
||||
cd /home/admin
|
||||
mkdir apps credentials
|
||||
cp /tmp/ecosystem.config.js apps
|
||||
cd apps
|
||||
|
||||
git clone https://github.com/jambonz/sbc-outbound.git
|
||||
git clone https://github.com/jambonz/sbc-inbound.git
|
||||
git clone https://github.com/jambonz/sbc-registrar.git
|
||||
git clone https://github.com/jambonz/sbc-call-router.git
|
||||
git clone https://github.com/jambonz/jambonz-api-server.git
|
||||
git clone https://github.com/jambonz/jambonz-feature-server.git
|
||||
cd /home/admin/apps/jambonz-feature-server && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/fsw-clear-old-calls && npm install && sudo npm install -g .
|
||||
cd /home/admin/apps/jambonz-api-server && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/jambonz-webapp && sudo npm install --unsafe-perm && npm run build
|
||||
cd /home/admin/apps/sbc-options-handler && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/sbc-inbound && sudo npm install --unsafe-perm
|
||||
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/sbc-inbound && npm install
|
||||
cd /home/admin/apps/sbc-outbound && npm install
|
||||
cd /home/admin/apps/sbc-registrar && npm install
|
||||
cd /home/admin/apps/sbc-call-router && npm install
|
||||
cd /home/admin/apps/jambonz-api-server && npm install
|
||||
cd /home/admin/apps/jambonz-feature-server && npm install
|
||||
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
|
||||
|
||||
# add entries to /etc/crontab to start everything on reboot
|
||||
echo "@reboot admin /usr/bin/pm2 start /home/admin/apps/ecosystem.config.js" | sudo tee -a /etc/crontab
|
||||
echo "@reboot admin sudo env PATH=$PATH:/usr/bin pm2 logrotate -u admin" | sudo tee -a /etc/crontab
|
||||
echo "0 * * * * root fsw-clear-old-calls --password JambonzR0ck$ >> /var/log/fsw-clear-old-calls.log 2>&1" | sudo tee -a /etc/crontab
|
||||
echo "0 1 * * * root find /tmp -name \"*.mp3\" -mtime +2 -exec rm {} \; > /dev/null 2>&1" | sudo tee -a /etc/crontab
|
||||
|
||||
sudo -u admin bash -c "pm2 install pm2-logrotate"
|
||||
sudo -u admin bash -c "pm2 set pm2-logrotate:max_size 1G"
|
||||
sudo -u admin bash -c "pm2 set pm2-logrotate:retain 5"
|
||||
sudo -u admin bash -c "pm2 set pm2-logrotate:compress true"
|
||||
|
||||
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
|
||||
@@ -5,20 +5,21 @@ echo "drachtio version to install is ${VERSION}"
|
||||
|
||||
chmod 0777 /usr/local/src
|
||||
cd /usr/local/src
|
||||
git clone https://github.com/davehorton/drachtio-server.git -b ${VERSION}
|
||||
git clone https://github.com/drachtio/drachtio-server.git -b ${VERSION}
|
||||
cd drachtio-server
|
||||
git submodule update --init --recursive
|
||||
./autogen.sh && mkdir -p build && cd $_ && ../configure CPPFLAGS='-DNDEBUG' && make && sudo make install
|
||||
./autogen.sh && mkdir -p build && cd $_ && ../configure CPPFLAGS='-DNDEBUG -g -O0' && make -j 4 && sudo make install
|
||||
|
||||
sudo mv /tmp/drachtio.conf.xml /etc
|
||||
sudo mv /tmp/drachtio-5070.conf.xml /etc
|
||||
sudo mv /tmp/drachtio.service /etc/systemd/system
|
||||
sudo mv /tmp/drachtio-5070.service /etc/systemd/system
|
||||
sudo mv /tmp/vimrc.local /etc/vim/vimrc.local
|
||||
sudo chmod 644 /etc/drachtio.conf.xml
|
||||
sudo chmod 644 /etc/drachtio-5070.conf.xml
|
||||
sudo chmod 644 /etc/systemd/system/drachtio.service
|
||||
sudo chmod 644 /etc/systemd/system/drachtio-5070.service
|
||||
sudo chmod 644 /etc/vim/vimrc.local
|
||||
sudo chown root:root /etc/drachtio.conf.xml /etc/systemd/system/drachtio.service /etc/drachtio-5070.conf.xml /etc/systemd/system/drachtio-5070.service /etc/vim/vimrc.local
|
||||
sudo systemctl enable drachtio
|
||||
sudo systemctl restart drachtio
|
||||
|
||||
sudo mv /tmp/drachtio-5070.conf.xml /etc
|
||||
sudo mv /tmp/drachtio-5070.service /etc/systemd/system
|
||||
sudo chmod 644 /etc/drachtio-5070.conf.xml
|
||||
sudo chmod 644 /etc/systemd/system/drachtio-5070.service
|
||||
sudo systemctl enable drachtio-5070
|
||||
sudo systemctl restart drachtio-5070
|
||||
|
||||
@@ -1,16 +1,43 @@
|
||||
#!/bin/bash
|
||||
VERSION=v1.10.1
|
||||
GRPC_VERSION=v1.24.2
|
||||
FREESWITCH_VERSION=v1.10.5
|
||||
GRPC_VERSION=c66d2cc
|
||||
#GRPC_VERSION=v1.39.1
|
||||
#GOOGLE_API_VERSION=v1p1beta1-speech
|
||||
GOOGLE_API_VERSION=e9da6f8b469c52b83f900e820be30762e9e05c57
|
||||
AWS_SDK_VERSION=1.8.129
|
||||
LWS_VERSION=v3.2.3
|
||||
MODULES_VERSION=v0.4.0
|
||||
|
||||
echo "freeswitch version to install is ${VERSION}"
|
||||
echo "freeswitch version to install is ${FREESWITCH_VERSION}"
|
||||
echo "drachtio modules version to install is ${MODULES_VERSION}"
|
||||
echo "GRPC version to install is ${GRPC_VERSION}"
|
||||
echo "GOOGLE_API_VERSION version to install is ${GOOGLE_API_VERSION}"
|
||||
echo "AWS_SDK_VERSION version to install is ${AWS_SDK_VERSION}"
|
||||
echo "LWS_VERSION version to install is ${LWS_VERSION}"
|
||||
|
||||
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
|
||||
|
||||
git config --global pull.rebase true
|
||||
cd /usr/local/src
|
||||
git clone https://github.com/davehorton/freeswitch.git -b ${VERSION}
|
||||
git clone https://github.com/warmcat/libwebsockets.git -b v3.2.0
|
||||
git clone https://github.com/davehorton/drachtio-freeswitch-modules.git -b master
|
||||
git clone https://github.com/signalwire/freeswitch.git -b ${FREESWITCH_VERSION}
|
||||
git clone https://github.com/warmcat/libwebsockets.git -b ${LWS_VERSION}
|
||||
git clone https://github.com/drachtio/drachtio-freeswitch-modules.git -b ${MODULES_VERSION}
|
||||
git clone https://github.com/grpc/grpc -b master
|
||||
cd grpc && git checkout ${GRPC_VERSION} && cd ..
|
||||
|
||||
cd freeswitch/libs
|
||||
|
||||
git clone https://github.com/freeswitch/spandsp.git -b master
|
||||
git clone https://github.com/freeswitch/sofia-sip.git -b master
|
||||
git clone https://github.com/dpirch/libfvad.git
|
||||
git clone https://github.com/aws/aws-sdk-cpp.git -b ${AWS_SDK_VERSION}
|
||||
git clone https://github.com/googleapis/googleapis -b master
|
||||
cd googleapis && git checkout ${GOOGLE_API_VERSION} && cd ..
|
||||
git clone https://github.com/awslabs/aws-c-common.git
|
||||
|
||||
sudo cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_audio_fork /usr/local/src/freeswitch/src/mod/applications/mod_audio_fork
|
||||
sudo cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_aws_transcribe /usr/local/src/freeswitch/src/mod/applications/mod_aws_transcribe
|
||||
sudo cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_aws_lex /usr/local/src/freeswitch/src/mod/applications/mod_aws_lex
|
||||
sudo cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_google_transcribe /usr/local/src/freeswitch/src/mod/applications/mod_google_transcribe
|
||||
sudo cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_google_tts /usr/local/src/freeswitch/src/mod/applications/mod_google_tts
|
||||
sudo cp -r /usr/local/src/drachtio-freeswitch-modules/modules/mod_dialogflow /usr/local/src/freeswitch/src/mod/applications/mod_dialogflow
|
||||
@@ -24,63 +51,67 @@ sudo mkdir -p build && cd build && sudo cmake .. -DCMAKE_BUILD_TYPE=RelWithDebIn
|
||||
|
||||
# build libfvad
|
||||
cd /usr/local/src/libfvad
|
||||
sudo autoreconf -i && sudo ./configure && sudo make && sudo make install
|
||||
sudo autoreconf -i && sudo ./configure && sudo make -j 4 && sudo make install
|
||||
|
||||
# build spandsp
|
||||
cd /usr/local/src/freeswitch/libs/spandsp
|
||||
./bootstrap.sh && ./configure && make -j 4 && sudo make install
|
||||
|
||||
# build sofia
|
||||
cd /usr/local/src/freeswitch/libs/sofia-sip
|
||||
./bootstrap.sh && ./configure && make -j 4 && sudo make install
|
||||
|
||||
# build aws-c-common
|
||||
cd /usr/local/src/freeswitch/libs/aws-c-common
|
||||
mkdir -p build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS="-Wno-unused-parameter"
|
||||
make -j 4 && sudo make install
|
||||
|
||||
# build aws-sdk-cpp
|
||||
cd /usr/local/src/freeswitch/libs/aws-sdk-cpp
|
||||
mkdir -p build && cd build
|
||||
cmake .. -DBUILD_ONLY="lexv2-runtime;transcribestreaming" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=OFF -DCMAKE_CXX_FLAGS="-Wno-unused-parameter"
|
||||
make -j 4 && sudo make install
|
||||
|
||||
# build grpc
|
||||
cd /usr/local/src/grpc
|
||||
git submodule update --init --recursive
|
||||
mkdir -p cmake/build
|
||||
cd cmake/build
|
||||
cmake -DBUILD_SHARED_LIBS=ON -DgRPC_SSL_PROVIDER=package -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo ../..
|
||||
make -j 4
|
||||
sudo make install
|
||||
|
||||
# build googleapis
|
||||
cd /usr/local/src/freeswitch/libs/googleapis
|
||||
echo "Ref: https://github.com/GoogleCloudPlatform/cpp-samples/issues/113"
|
||||
sed -i 's/\$fields/fields/' google/maps/routes/v1/route_service.proto
|
||||
sed -i 's/\$fields/fields/' google/maps/routes/v1alpha/route_service.proto
|
||||
LANGUAGE=cpp make -j 4
|
||||
|
||||
# copy Makefiles into place
|
||||
cp /tmp/configure.ac.extra /usr/local/src/freeswitch/configure.ac
|
||||
cp /tmp/Makefile.am.extra /usr/local/src/freeswitch/Makefile.am
|
||||
cp /tmp/modules.conf.in.extra /usr/local/src/freeswitch/build/modules.conf.in
|
||||
cp /tmp/modules.conf.vanilla.xml.extra /usr/local/src/freeswitch/conf/vanilla/autoload_configs/modules.conf.xml
|
||||
cp /tmp/switch_rtp.c.patch /usr/local/src/freeswitch/src
|
||||
|
||||
# patch freeswitch
|
||||
# basic patches
|
||||
echo "patching freeswitch for lws and mod_audio_fork"
|
||||
cd /usr/local/src/freeswitch
|
||||
sudo cp /tmp/configure.ac.patch .
|
||||
sudo cp /tmp/Makefile.am.patch .
|
||||
sudo cp /tmp/modules.conf.in.patch ./build
|
||||
sudo cp /tmp/modules.conf.vanilla.xml.patch ./conf/vanilla/autoload_configs
|
||||
sudo cp /tmp/mod_opusfile.c.patch ./src/mod/formats/mod_opusfile
|
||||
sudo patch < configure.ac.patch
|
||||
sudo patch < Makefile.am.patch
|
||||
cd build && sudo patch < modules.conf.in.patch
|
||||
cd ../conf/vanilla/autoload_configs && patch < modules.conf.vanilla.xml.patch
|
||||
cd /usr/local/src/freeswitch/src/mod/formats/mod_opusfile && sudo patch < mod_opusfile.c.patch
|
||||
cd /usr/local/src/freeswitch
|
||||
#grpc patches
|
||||
echo "patching freeswitch for GRPC"
|
||||
sudo cp /tmp/configure.ac.grpc.patch .
|
||||
sudo cp /tmp/Makefile.am.grpc.patch .
|
||||
sudo cp /tmp/modules.conf.in.grpc.patch ./build
|
||||
sudo patch < configure.ac.grpc.patch
|
||||
sudo patch < Makefile.am.grpc.patch
|
||||
cd build && sudo patch < modules.conf.in.grpc.patch
|
||||
cd ..
|
||||
sudo cp /tmp/modules.conf.vanilla.xml.grpc ./conf/vanilla/autoload_configs/modules.conf.xml
|
||||
|
||||
# checkout and build grpc
|
||||
echo "building GRPC"
|
||||
cd /usr/local/src
|
||||
git clone https://github.com/grpc/grpc -b ${GRPC_VERSION}
|
||||
cd grpc
|
||||
git submodule update --init --recursive
|
||||
cd third_party/protobuf && ./autogen.sh && ./configure && sudo make install
|
||||
cd /usr/local/src/grpc
|
||||
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH && make && sudo make install
|
||||
|
||||
# checkout and build googleapis
|
||||
echo "building googleapis"
|
||||
cd /usr/local/src/freeswitch/libs
|
||||
git clone https://github.com/davehorton/googleapis -b dialogflow-v2-support
|
||||
cd googleapis
|
||||
git submodule update --init --recursive
|
||||
LANGUAGE=cpp make
|
||||
cd /usr/local/src/freeswitch/src
|
||||
patch < switch_rtp.c.patch
|
||||
|
||||
# build freeswitch
|
||||
echo "building freeswitch"
|
||||
cd /usr/local/src/freeswitch
|
||||
sudo ./bootstrap.sh -j
|
||||
sudo ./configure --with-lws=yes --with-grpc=yes
|
||||
sudo make
|
||||
sudo ./configure --with-lws=yes --with-extra=yes
|
||||
sudo make -j 4
|
||||
sudo make install
|
||||
sudo make cd-sounds-install cd-moh-install
|
||||
sudo cp /tmp/acl.conf.xml /usr/local/freeswitch/conf/autoload_configs
|
||||
sudo cp /tmp/event_socket.conf.xml /usr/local/freeswitch/conf/autoload_configs
|
||||
sudo cp /tmp/switch.conf.xml /usr/local/freeswitch/conf/autoload_configs
|
||||
sudo cp /tmp/conference.conf.xml /usr/local/freeswitch/conf/autoload_configs
|
||||
sudo rm -Rf /usr/local/freeswitch/conf/dialplan/*
|
||||
sudo rm -Rf /usr/local/freeswitch/conf/sip_profiles/*
|
||||
sudo cp /tmp/mrf_dialplan.xml /usr/local/freeswitch/conf/dialplan
|
||||
@@ -89,14 +120,9 @@ sudo cp /usr/local/src/freeswitch/conf/vanilla/autoload_configs/modules.conf.xml
|
||||
sudo cp /tmp/freeswitch.service /etc/systemd/system
|
||||
sudo chown root:root -R /usr/local/freeswitch
|
||||
sudo chmod 644 /etc/systemd/system/freeswitch.service
|
||||
sudo sed -i -e 's/global_codec_prefs=OPUS,G722,PCMU,PCMA,VP8/global_codec_prefs=PCMU,PCMA,OPUS,G722/g' /usr/local/freeswitch/conf/vars.xml
|
||||
sudo sed -i -e 's/outbound_codec_prefs=OPUS,G722,PCMU,PCMA,VP8/outbound_codec_prefs=PCMU,PCMA,OPUS,G722/g' /usr/local/freeswitch/conf/vars.xml
|
||||
sudo sed -i -e 's/global_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8/global_codec_prefs=PCMU,PCMA,OPUS,G722/g' /usr/local/freeswitch/conf/vars.xml
|
||||
sudo sed -i -e 's/outbound_codec_prefs=OPUS,G722,PCMU,PCMA,H264,VP8/outbound_codec_prefs=PCMU,PCMA,OPUS,G722/g' /usr/local/freeswitch/conf/vars.xml
|
||||
sudo systemctl enable freeswitch
|
||||
sudo cp /tmp/freeswitch_log_rotation /etc/cron.daily/freeswitch_log_rotation
|
||||
sudo chown root:root /etc/cron.daily/freeswitch_log_rotation
|
||||
sudo chmod a+x /etc/cron.daily/freeswitch_log_rotation
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - && sudo apt-get install -y nodejs
|
||||
curl -sL https://deb.nodesource.com/setup_14.x | sudo bash - && sudo apt-get install -y nodejs
|
||||
sudo npm install -g pino-pretty pm2 pm2-logrotate
|
||||
sudo pm2 install pm2-logrotate
|
||||
|
||||
@@ -7,6 +7,12 @@ cd /usr/local/src
|
||||
git clone https://github.com/BelledonneCommunications/bcg729.git
|
||||
cd bcg729
|
||||
cmake . -DCMAKE_INSTALL_PREFIX=/usr && make && sudo make install chdir=/usr/local/src/bcg729
|
||||
cd /usr/local/src
|
||||
|
||||
git clone https://github.com/warmcat/libwebsockets.git -b v3.2.3
|
||||
cd /usr/local/src/libwebsockets
|
||||
sudo mkdir -p build && cd build && sudo cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo && sudo make && sudo make install
|
||||
|
||||
cd /usr/local/src
|
||||
git clone https://github.com/sipwise/rtpengine.git -b ${VERSION}
|
||||
cd rtpengine/daemon
|
||||
@@ -15,3 +21,4 @@ cp /usr/local/src/rtpengine/daemon/rtpengine /usr/local/bin
|
||||
sudo mv /tmp/rtpengine.service /etc/systemd/system
|
||||
sudo chmod 644 /etc/systemd/system/rtpengine.service
|
||||
sudo systemctl enable rtpengine
|
||||
sudo systemctl start rtpengine
|
||||
|
||||
@@ -2,10 +2,20 @@
|
||||
"variables": {
|
||||
"region": "us-east-1",
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "EC2 AMI jambonz mini",
|
||||
"instance_type": "t2.medium",
|
||||
"drachtio_version": "v0.8.4",
|
||||
"rtp_engine_version": "mr7.4.1.5",
|
||||
"ami_description": "jambonz all-in-one AMI",
|
||||
"instance_type": "t2.xlarge",
|
||||
"drachtio_version": "v0.8.10",
|
||||
"jambonz_version": "v0.6.5",
|
||||
"jambonz_user": "admin",
|
||||
"jambonz_password": "JambonzR0ck$",
|
||||
"install_telegraf": "yes",
|
||||
"homer_user": "homer_user",
|
||||
"homer_password": "XcapJTqy11LnsYRtxXGPTYQkAnI",
|
||||
"install_influxdb": "yes",
|
||||
"install_homer": "yes",
|
||||
"install_nodered": "no",
|
||||
"influxdb_ip": "127.0.0.1",
|
||||
"rtp_engine_version": "mr9.3.1.8",
|
||||
"rtp_engine_min_port": "40000",
|
||||
"rtp_engine_max_port": "60000"
|
||||
},
|
||||
@@ -23,12 +33,12 @@
|
||||
},
|
||||
"instance_type": "{{user `instance_type`}}",
|
||||
"ssh_username": "{{user `ssh_username`}}",
|
||||
"ami_name": "jambonz-mini-{{user `drachtio_version`}}-{{isotime |clean_resource_name }}",
|
||||
"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": 40,
|
||||
"volume_size": 60,
|
||||
"volume_type": "gp2",
|
||||
"delete_on_termination": true
|
||||
}
|
||||
@@ -42,7 +52,7 @@
|
||||
"Name": "jambonz-mini"
|
||||
},
|
||||
"run_tags": {
|
||||
"Name": "jambonz-mini"
|
||||
"Name": "jambonz-mini-build"
|
||||
}
|
||||
}],
|
||||
"provisioners": [
|
||||
@@ -51,15 +61,27 @@
|
||||
"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 gcc g++ make cmake build-essential git autoconf automake mysql-client redis-tools \\",
|
||||
"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 \\",
|
||||
"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",
|
||||
"sudo chmod a+w /usr/local/src"
|
||||
"sudo chmod a+w /usr/local/src",
|
||||
"mkdir ~/credentials",
|
||||
"mkdir ~/apps",
|
||||
"cd ~/apps",
|
||||
"git clone https://github.com/jambonz/sbc-options-handler.git -b {{user `jambonz_version`}}",
|
||||
"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-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`}}"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -71,18 +93,61 @@
|
||||
"type": "shell",
|
||||
"script": "scripts/install_chrony.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`}}",
|
||||
"script": "scripts/install_apiban.sh"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/install_nginx.sh"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/install_nodejs.sh"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/install_freeswitch.sh"
|
||||
"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 `rtp_engine_version`}}",
|
||||
"script": "scripts/install_rtpengine.sh"
|
||||
"script": "scripts/install_redis.sh"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `install_nodered`}}",
|
||||
"script": "scripts/install_node_red.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_freeswitch.sh"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
@@ -91,7 +156,24 @@
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"execute_command": "chmod +x {{ .Path }}; sudo '{{ .Path }}' {{user `rtp_engine_version`}}",
|
||||
"script": "scripts/install_rtpengine.sh"
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"script": "scripts/install_fail2ban.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": [
|
||||
"sudo rm /root/.ssh/authorized_keys",
|
||||
"sudo rm /home/admin/.ssh/authorized_keys"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -14,6 +14,7 @@ sudo homer-app -populate-table-db-config
|
||||
sudo sed -i -e "s/DBUser\s*=\s*\"postgres\"/DBUser = \"$DB_USER\"/g" /etc/heplify-server.toml
|
||||
sudo sed -i -e "s/DBPass\s*=\s*\"\"/DBPass = \"$DB_PASS\"/g" /etc/heplify-server.toml
|
||||
sudo sed -i -e "s/PromAddr\s*=\s*\"\"/PromAddr = \"0.0.0.0:9096\"/g" /etc/heplify-server.toml
|
||||
sudo sed -i -e "s/^HEPWSAddr/#HEPWSAddr/g" /etc/heplify-server.toml
|
||||
sudo sed -i -e "s/AlegIDs\s*=\s*\[\]/AlegIDs = \[\"X-CID\"]/g" /etc/heplify-server.toml
|
||||
sudo sed -i -e "s/CustomHeader\s*=\s*\[\]/CustomHeader = \[\"X-Application-Sid\", \"X-Originating-Carrier\", \"X-MS-Teams-Tenant-FQDN\", \"X-Authenticated-User\"]/g" /etc/heplify-server.toml
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
# Global tags can be specified here in key="value" format.
|
||||
[global_tags]
|
||||
role = "sbc"
|
||||
role = "rtp"
|
||||
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
|
||||
# rack = "1a"
|
||||
## Environment variables can be used as tags, and throughout the config file
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"region": "us-east-1",
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz SBC media server",
|
||||
"drachtio_version": "v0.8.11-rc1",
|
||||
"drachtio_version": "v0.8.11-rc2",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"instance_type": "t2.medium",
|
||||
"rtp_engine_version": "mr9.3.1.8",
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
# Global tags can be specified here in key="value" format.
|
||||
[global_tags]
|
||||
role = "sbc"
|
||||
role = "rtp"
|
||||
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
|
||||
# rack = "1a"
|
||||
## Environment variables can be used as tags, and throughout the config file
|
||||
|
||||
@@ -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 "$@"
|
||||
@@ -10,7 +10,8 @@ ExecStartPre=/bin/sh -c 'systemctl set-environment LOCAL_IP=`curl -s http://169.
|
||||
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 \
|
||||
--address 0.0.0.0 --port 9022
|
||||
--address 0.0.0.0 --port 9022 \
|
||||
--prometheus-scrape-port 9090
|
||||
TimeoutSec=15s
|
||||
Restart=always
|
||||
; exec
|
||||
|
||||
@@ -1,5 +1,33 @@
|
||||
module.exports = {
|
||||
apps : [
|
||||
{
|
||||
name: 'jambonz-smpp-esme',
|
||||
cwd: '/home/admin/apps/jambonz-smpp-esme',
|
||||
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',
|
||||
AVOID_UDH: true,
|
||||
JAMBONES_MYSQL_HOST: '${JAMBONES_MYSQL_HOST}',
|
||||
JAMBONES_MYSQL_USER: '${JAMBONES_MYSQL_USER}',
|
||||
JAMBONES_MYSQL_PASSWORD: '${JAMBONES_MYSQL_PASSWORD}',
|
||||
JAMBONES_MYSQL_DATABASE: 'jambones',
|
||||
JAMBONES_MYSQL_CONNECTION_LIMIT: 10,
|
||||
JAMBONES_REDIS_HOST: '${JAMBONES_REDIS_HOST}',
|
||||
JAMBONES_REDIS_PORT: 6379,
|
||||
JAMBONES_LOGLEVEL: 'debug',
|
||||
JAMBONES_CLUSTER_ID: '${JAMBONES_CLUSTER_ID}',
|
||||
HTTP_PORT: 3020
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'sbc-options-handler',
|
||||
cwd: '/home/admin/apps/sbc-options-handler',
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
source /usr/share/vim/vim80/defaults.vim
|
||||
let skip_defaults_vim = 1
|
||||
if has('mouse')
|
||||
set mouse=r
|
||||
endif
|
||||
@@ -12,4 +12,4 @@ sudo cp /tmp/apiban.logrotate /etc/logrotate.d/apiban-client
|
||||
sudo chmod 0644 /etc/logrotate.d/apiban-client
|
||||
cd /usr/local/bin/apiban/
|
||||
sudo ./apiban-iptables-client FULL
|
||||
echo "*/4 * * * * root cd /usr/local/bin/apiban && ./apiban-iptables-client >/dev/null 2>&1" | sudo tee -a /etc/crontab
|
||||
echo "*/4 * * * * root cd /usr/local/bin/apiban && ./apiban-iptables-client >/dev/null 2>&1" | sudo tee -a /etc/crontab
|
||||
@@ -6,17 +6,12 @@ mkdir apps
|
||||
cp /tmp/ecosystem.config.js apps
|
||||
cd apps
|
||||
|
||||
git clone https://github.com/jambonz/sbc-outbound.git -b ${VERSION}
|
||||
git clone https://github.com/jambonz/sbc-inbound.git -b ${VERSION}
|
||||
git clone https://github.com/jambonz/sbc-registrar.git -b ${VERSION}
|
||||
git clone https://github.com/jambonz/sbc-call-router.git -b ${VERSION}
|
||||
git clone https://github.com/jambonz/sbc-options-handler.git -b ${VERSION}
|
||||
|
||||
cd /home/admin/apps/sbc-inbound && sudo npm install --unsafe-perm
|
||||
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/sbc-options-handler && sudo npm install --unsafe-perm
|
||||
cd /home/admin/apps/jambonz-smpp-esme && sudo npm install --unsafe-perm
|
||||
|
||||
sudo -u admin bash -c "pm2 install pm2-logrotate"
|
||||
sudo -u admin bash -c "pm2 set pm2-logrotate:max_size 1G"
|
||||
|
||||
@@ -14,3 +14,7 @@ sudo mv /tmp/drachtio.service /etc/systemd/system
|
||||
sudo chmod 644 /etc/drachtio.conf.xml
|
||||
sudo chmod 644 /etc/systemd/system/drachtio.service
|
||||
sudo systemctl enable drachtio
|
||||
|
||||
|
||||
sudo cp /tmp/auto-assign-elastic-ip.sh /usr/local/bin
|
||||
sudo chmod +x /usr/local/bin/auto-assign-elastic-ip.sh
|
||||
@@ -4,7 +4,7 @@
|
||||
"ssh_username": "admin",
|
||||
"ami_description": "jambonz SBC SIP",
|
||||
"instance_type": "t2.medium",
|
||||
"drachtio_version": "v0.8.11-rc1",
|
||||
"drachtio_version": "v0.8.11-rc2",
|
||||
"jambonz_version": "v0.6.6",
|
||||
"install_datadog": "no",
|
||||
"install_telegraf": "yes"
|
||||
@@ -67,6 +67,7 @@
|
||||
"git clone git@github.com:jambonz/sbc-outbound.git -b {{user `jambonz_version`}}",
|
||||
"git clone git@github.com:jambonz/sbc-inbound.git -b {{user `jambonz_version`}}",
|
||||
"git clone git@github.com:jambonz/sbc-registrar.git -b {{user `jambonz_version`}}",
|
||||
"git clone git@github.com:jambonz/jambonz-smpp-esme.git -b {{user `jambonz_version`}}",
|
||||
"git clone git@github.com:jambonz/sbc-call-router.git"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
# Global tags can be specified here in key="value" format.
|
||||
[global_tags]
|
||||
role = "webserver"
|
||||
role = "web"
|
||||
# dc = "us-east-1" # will tag all metrics with dc=us-east-1
|
||||
# rack = "1a"
|
||||
## Environment variables can be used as tags, and throughout the config file
|
||||
|
||||
Reference in New Issue
Block a user