Feature/proxmox (#50)

* initial changes for proxmox support

* proxmox packer updates

* terraform template for Proxmox jambonz-mini

* update jambonz-mini to 0.8.3-3
This commit is contained in:
Dave Horton
2023-05-31 10:05:42 -04:00
committed by GitHub
parent 28ff526716
commit 80ec4a45da
286 changed files with 49674 additions and 4 deletions

4
.gitignore vendored
View File

@@ -8,4 +8,6 @@ data_volume/
tmpAudio/
.idea
*.iml
*.iml
variables.json

View File

@@ -95,7 +95,7 @@ Conditions:
Mappings:
AWSRegion2AMI:
us-east-1:
Ami: ami-07ae487129ffcf70c
Ami: ami-00d771ac0ee2a4774
Resources:
IamCloudwatchRole:
@@ -181,7 +181,7 @@ Resources:
INSTANCE_ID="$(curl -s http://169.254.169.254/latest/meta-data/instance-id)"
AWS_REGION_NAME="$(curl -s http://169.254.169.254/latest/meta-data/placement/region)"
# change the database password to the instance id
# change the database password to a random id
NEW_DB_PASSWD="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)"
echo "alter user 'admin'@'%' identified by '$NEW_DB_PASSWD'" | mysql -h localhost -u admin -D jambones -pJambonzR0ck$
sudo sed -i -e "s/\(.*\)JAMBONES_MYSQL_PASSWORD.*/\1JAMBONES_MYSQL_PASSWORD: '$NEW_DB_PASSWD',/g" /home/admin/apps/ecosystem.config.js

View File

@@ -0,0 +1,48 @@
#!/bin/bash
VERSION=$1
DB_USER=$2
DB_PASS=$3
cd /home/admin
cp /tmp/ecosystem.config.js apps
echo "building jambonz-feature-server.."
cd /home/admin/apps/jambonz-feature-server && npm ci --unsafe-perm
echo "building fsw-clear-old-calls.."
cd /home/admin/apps/fsw-clear-old-calls && npm ci --unsafe-perm && sudo npm install -g .
echo "building jambonz-api-server.."
cd /home/admin/apps/jambonz-api-server && npm ci --unsafe-perm
echo "building jambonz-webapp.."
cd /home/admin/apps/jambonz-webapp && npm ci --unsafe-perm && npm run build
echo "building sbc-sip-sidecar.."
cd /home/admin/apps/sbc-sip-sidecar && npm ci --unsafe-perm
echo "building sbc-inbound.."
cd /home/admin/apps/sbc-inbound && npm ci --unsafe-perm
echo "building sbc-outbound.."
cd /home/admin/apps/sbc-outbound && npm ci --unsafe-perm
echo "building sbc-call-router.."
cd /home/admin/apps/sbc-call-router && npm ci --unsafe-perm
echo "building jambonz-smpp-esme.."
cd /home/admin/apps/jambonz-smpp-esme && npm ci --unsafe-perm
echo "building sbc-rtpengine-sidecar.."
cd /home/admin/apps/sbc-rtpengine-sidecar && npm ci --unsafe-perm
sudo npm install -g pino-pretty pm2 pm2-logrotate gulp grunt
sudo pm2 install pm2-logrotate
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"
sudo chown -R admin:admin /home/admin/apps
sudo rm /home/admin/apps/jambonz-webapp/.env
sudo snap install core
sudo snap install --classic certbot
sudo rm /usr/bin/certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot

View File

@@ -5,7 +5,7 @@
"ami_description": "jambonz all-in-one AMI",
"instance_type": "c6in.xlarge",
"drachtio_version": "v0.8.22",
"jambonz_version": "v0.8.3",
"jambonz_version": "v0.8.3-3",
"jambonz_user": "admin",
"jambonz_password": "JambonzR0ck$",
"install_telegraf": "yes",

View File

@@ -0,0 +1,102 @@
# packer-jambonz-mini
A [packer](https://www.packer.io/) template to build an AMI containing everything needed to run jambonz on a single EC2 instance. The base linux distro is Debian 11 (bullseye).
## Installing
```
$ packer build -color=false template.json
```
### variables
There are many variables that can be specified on the `packer build` command line; however defaults (which are shown below) are appropriate for building an "all in one" jambonz server, so you generally should not need to specify values.
```
"region": "us-east-1"
```
The region to create the AMI in
```
"ami_description": "EC2 AMI jambonz mini"
```
AMI description.
```
"instance_type": "t2.medium"
```
EC2 Instance type to use when building the AMI.
```
"install_drachtio": "true"
```
whether to install drachtio
```
"install_nodejs": "false",
```
whether to install Node.js
```
"install_rtpengine": "true",
```
whether to install rtpengine
```
"install_freeswitch": "true",
```
whether to install freeswitch
```
"install_drachtio_fail2ban": "true",
```
whether to install fail2ban with drachtio filter
```
"install_redis": "true",
```
whether to install redis
```
"drachtio_version": "v0.8.3"
```
drachtio tag or branch to build
```
"nodejs_version": "v10.16.2",
```
Node.js version to install
```
"freeswitch_bind_cloud_ip": "true"
```
If freeswitch is enabled, and cloud_provider is not none then this variable dictates whether freeswitch should bind its sip and rtp ports to the cloud public address (versus the local ipv4 address).
```
"mod_audio_fork_subprotocol": "audio.jambonz.org"
```
websocket subprotocol name used by freeswitch module mod_audio_fork
```
"mod_audio_fork_service_threads": "3",
```
number of libwebsocket service threads used by freeswitch module mod_audio_fork
``
"mod_audio_fork_buffer_secs": "2",
```
max number of seconds of audio to buffer by freeswitch module mod_audio_fork
```
"freeswitch_build_with_grpc:: "true"
```
whether to build support for google speech and text-to-speech services
```
"remove_source": "true"
```
whether to remove source build directories, or leave them on the instance
```
"cloud_provider": "aws"
```
Cloud provider the AMI will be built on.

View File

@@ -0,0 +1,2 @@
APT::Periodic::Update-Package-Lists "0";
APT::Periodic::Unattended-Upgrade "0";

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More