Skip to content

Commit

Permalink
Release 4.0.6 - See CHANGELOG.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tiredofit committed Jun 9, 2020
1 parent 3ec8d9e commit 2b9252d
Show file tree
Hide file tree
Showing 10 changed files with 57 additions and 50 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 4.0.6 2020-06-08 <dave at tiredofit dot ca>

### Added
- Support changes to tiredofit/debian base image


## 4.0.5.1 2020-05-08 <dave at tiredofit dot ca>

### Changed
Expand Down
14 changes: 14 additions & 0 deletions install/assets/defaults/10-freepbx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/with-contenv bash

ADMIN_DIRECTORY=${ADMIN_DIRECTORY:-"/admin"}
DB_PORT=${DB_PORT:-3306}
ENABLE_FAIL2BAN=${ENABLE_FAIL2BAN:-"TRUE"}
ENABLE_FOP=${ENABLE_FOP:-"TRUE"}
ENABLE_XMPP=${ENABLE_XMPP:-"FALSE"}
FOP_DIRECTORY=${FOP_DIRECTORY:-"/fop"}
HTTP_PORT=${HTTP_PORT:-80}
HTTPS_PORT=${HTTPS_PORT:-443}
RTP_FINISH=${RTP_FINISH:-20000}
RTP_START=${RTP_START:-18000}
UCP_FIRST=${UCP_FIRST:-"TRUE"}
WEBROOT=${WEBROOT:-"/var/www/html"}
13 changes: 0 additions & 13 deletions install/assets/functions/10-freepbx
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
#!/usr/bin/with-contenv bash

ADMIN_DIRECTORY=${ADMIN_DIRECTORY:-"/admin"}
DB_PORT=${DB_PORT:-3306}
ENABLE_FAIL2BAN=${ENABLE_FAIL2BAN:-"TRUE"}
ENABLE_FOP=${ENABLE_FOP:-"TRUE"}
ENABLE_XMPP=${ENABLE_XMPP:-"FALSE"}
FOP_DIRECTORY=${FOP_DIRECTORY:-"/fop"}
HTTP_PORT=${HTTP_PORT:-80}
HTTPS_PORT=${HTTPS_PORT:-443}
RTP_FINISH=${RTP_FINISH:-20000}
RTP_START=${RTP_START:-18000}
UCP_FIRST=${UCP_FIRST:-"TRUE"}
WEBROOT=${WEBROOT:-"/var/www/html"}

check_process() {
while [ true ]; do
pid=`pgrep php | wc -l`
Expand Down
9 changes: 4 additions & 5 deletions install/etc/cont-finish.d/10-freepbx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/with-contenv bash

## Embedded DB Variance
if [[ "$DB_EMBEDDED" = "TRUE" ]] || [[ "$DB_EMBEDDED" = "true" ]]; then
if var_true $DB_EMBEDDED ; then
DB_EMBEDDED=TRUE
else
DB_EMBEDDED=FALSE
Expand All @@ -10,13 +10,12 @@
fwconsole stop
service apache2 stop

if [[ "$DB_EMBEDDED" = "TRUE" ]] || [[ "$DB_EMBEDDED" = "true" ]]; then
if var_true $DB_EMBEDDED ; then
service mysql stop
fi

if [[ "$ENABLE_XMPP" = "TRUE" ]] || [[ "$ENABLE_XMPP" = "true" ]]; then
if var_true $ENABLE_XMPP ; then
mongod --unixSocketPrefix=/var/run/mongodb --config /etc/mongodb.conf --shutdown
fi

mkdir -p /tmp/state
touch /tmp/state/10-freepbx-finish

4 changes: 2 additions & 2 deletions install/etc/cont-init.d/03-cron
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/with-contenv bash

for s in /assets/functions/*; do source $s; done
PROCESS_NAME="cron"
source /assets/functions/00-container
prepare_service single

### Set Defaults
ENABLE_CRON=${ENABLE_CRON:-"TRUE"}
Expand Down
6 changes: 4 additions & 2 deletions install/etc/cont-init.d/05-fail2ban
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/with-contenv bash

for s in /assets/functions/*; do source $s; done
source /assets/functions/00-container
prepare_service single

PROCESS_NAME="fail2ban"

if [[ "$ENABLE_FAIL2BAN" = "TRUE" ]] || [[ "$ENABLE_FAIL2BAN" = "true" ]]; then
if var_true $ENABLE_FAIL2BAN ; then
sed -i -e "s/logtarget = \/var\/log\/fail2ban.log/logtarget = \/var\/log\/fail2ban\/fail2ban.log/g" /etc/fail2ban/fail2ban.conf
rm -rf /etc/fail2ban/jail.d/*
mkdir -p /var/log/asterisk/
Expand Down
6 changes: 4 additions & 2 deletions install/etc/cont-init.d/08-mongodb
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/with-contenv bash

for s in /assets/functions/*; do source $s; done
source /assets/functions/00-container
prepare_service single

PROCESS_NAME="mongo"

if [[ "$ENABLE_XMPP" = "TRUE" ]] || [[ "$ENABLE_XMPP" = "true" ]]; then
if var_true $ENABLE_XMPP ; then
print_notice "Enabling MongoDB for XMPP support"
mkdir -p /var/log/mongodb
touch /var/log/mongodb/mongodb.log
Expand Down
9 changes: 5 additions & 4 deletions install/etc/cont-init.d/09-mariadb
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
#!/usr/bin/with-contenv bash

for s in /assets/functions/*; do source $s; done
source /assets/functions/00-container
prepare_service
PROCESS_NAME="mariadb"

## Embedded DB Variance
if [[ "$DB_EMBEDDED" = "TRUE" ]] || [[ "$DB_EMBEDDED" = "true" ]]; then
if var_true $DB_EMBEDDED ; then
DB_EMBEDDED=TRUE
else
DB_EMBEDDED=FALSE
fi
fi

if [[ "$DB_EMBEDDED" = "TRUE" ]] || [[ "$DB_EMBEDDED" = "true" ]]; then
if var_true $DB_EMBEDDED ; then
silent service mysql stop
mkdir -p /var/lib/mysql

Expand Down
37 changes: 16 additions & 21 deletions install/etc/cont-init.d/10-freepbx
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
#!/usr/bin/with-contenv bash

for s in /assets/functions/*; do source $s; done
source /assets/functions/00-container
prepare_service
PROCESS_NAME="freepbx"

## Embedded DB Variance
if [[ "$DB_EMBEDDED" = "TRUE" ]] || [[ "$DB_EMBEDDED" = "true" ]]; then
DB_EMBEDDED=TRUE
else
DB_EMBEDDED=FALSE
fi

if [[ "$DB_EMBEDDED" = "FALSE" ]] || [[ "$DB_EMBEDDED" = "false" ]]; then
sanity_db
fi

if [[ "$DB_EMBEDDED" = "FALSE" ]] || [[ "$DB_EMBEDDED" = "false" ]]; then
db_ready mariadb
sanity_db
db_ready mariadb
fi

### Startup
Expand Down Expand Up @@ -154,7 +149,7 @@ EOF
sleep 3
fwconsole ma download cdr

if [[ "$DB_EMBEDDED" = "FALSE" ]] || [[ "$DB_EMBEDDED" = "false" ]]; then
if var_false $DB_EMBEDDED ; then
# CDR Hack
mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT $DB_NAME < /usr/src/freepbx/installlib/SQL/cdr.sql
mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'USE '$DB_NAME'; UPDATE freepbx_settings SET `value` = "'$DB_HOST'" WHERE keyword = "CDRDBHOST"; UPDATE freepbx_settings SET `value` = "'$DB_NAME'" WHERE keyword = "CDRDBNAME"; UPDATE freepbx_settings SET `value` = "'$DB_PASS'" WHERE keyword = "CDRDBPASS"; UPDATE freepbx_settings SET `value` = "'$DB_USER'" WHERE keyword = "CDRDBUSER"; UPDATE freepbx_settings SET `value` = "mysql" WHERE keyword = "CDRDBTYPE"; UPDATE freepbx_settings SET `value` = "'$DB_PORT'" WHERE keyword = "CDRDBPORT"; UPDATE freepbx_settings SET `value` = "cdr" WHERE keyword = "CDRDBTABLENAME";'
Expand Down Expand Up @@ -217,7 +212,7 @@ EOF
cd /
rm -rf /usr/src/freepbx

if [ "$ENABLE_FOP" = "TRUE" ] || [ "$ENABLE_FOP" = "true" ]; then
if var_true $ENABLE_FOP ; then
### FOP2 Installation
print_info "Starting Installation of Flash Operator Panel 2"
silent fwconsole start
Expand Down Expand Up @@ -260,7 +255,7 @@ fi
touch /data/etc/amportal.conf
fi

if [[ "$DB_EMBEDDED" = "TRUE" ]] || [[ "$DB_EMBEDDED" = "true" ]]; then
if var_true $DB_EMBEDDED ; then
if [ ! -f /data/etc/freepbx.conf ]; then
mkdir -p /data/etc/
cp -R /etc/freepbx.conf /data/etc/
Expand All @@ -274,7 +269,7 @@ fi
fi
fi

if [ "$DB_EMBEDDED" = "FALSE" ]; then
if var_false $DB_EMBEDDED ; then
### Setup Dynamic Configuration
print_notice "Setting Configuration"
cat <<EOF > /etc/freepbx.conf
Expand Down Expand Up @@ -330,7 +325,7 @@ fi

chown asterisk:asterisk /etc/freepbx.conf

if [[ "$DB_EMBEDDED" = "FALSE" ]] || [[ "$DB_EMBEDDED" = "false" ]]; then
if var_false $DB_EMBEDDED ; then
### Set RTP Ports
print_notice "Setting RTP Ports - Start: '${RTP_START}' Finish: '${RTP_FINISH}'"
mysql -u$DB_USER -p$DB_PASS -h$DB_HOST -P$DB_PORT -e 'USE '$DB_NAME'; INSERT INTO sipsettings (keyword, data, seq, type) VALUES ("rtpstart","'$RTP_START'",1,0) ON DUPLICATE KEY UPDATE data="'$RTP_START'";INSERT INTO sipsettings (keyword, data, seq, type) VALUES ("rtpend","'$RTP_FINISH'",1,0) ON DUPLICATE KEY UPDATE data="'$RTP_FINISH'";'
Expand Down Expand Up @@ -361,7 +356,7 @@ chown -R asterisk:asterisk /etc/amportal.conf
fi

### Check to see if FOP Enabled and exists (Upgrade Catcher)
if [ "$ENABLE_FOP" = "TRUE" ] || [ "$ENABLE_FOP" = "true" ]; then
if var_true $ENABLE_FOP ; then
if [ ! -f /usr/local/fop2/fop2_server ] ; then
print_info "Installing Operator Panel"

Expand Down Expand Up @@ -435,7 +430,7 @@ cat >> /etc/apache2/sites-enabled/000-default.conf << EOF
</VirtualHost>
EOF

if [ "$VIRTUAL_PROTO" = "https" ] || [ "$ENABLE_SSL" = "true" ] || [ "$ENABLE_SSL" = "TRUE" ] ; then
if [ "$VIRTUAL_PROTO" = "https" ] || var_true $ENABLE_SSL ; then
print_notice "Enabling SSL"

if [ ! -f /certs/${TLS_CERT} ] && [ ! -f /certs/${TLS_KEY} ]; then
Expand Down Expand Up @@ -478,15 +473,15 @@ EOF
CustomLog /var/log/apache2/access.log common
EOF

if [ "$UCP_FIRST" = "TRUE" ] || [ "$UCP_FIRST" = "true" ] ; then
if var_true $UCP_FIRST ; then
echo " DocumentRoot "$WEBROOT"/ucp" >> /etc/apache2/sites-enabled/000-default.conf
echo ' Alias "'$ADMIN_DIRECTORY'" "'$WEBROOT'/admin"' >> /etc/apache2/sites-enabled/000-default.conf
echo ' Alias "/ucp" "'$WEBROOT'/ucp"' >> /etc/apache2/sites-enabled/000-default.conf
else
echo " DocumentRoot $WEBROOT" >> /etc/apache2/sites-enabled/000-default.conf
fi

if [ "$ENABLE_FOP" = "TRUE" ] || [ "$ENABLE_FOP" = "true" ]; then
if var_true $ENABLE_FOP ; then
echo ' Alias "'$FOP_DIRECTORY'" "'$WEBROOT'/fop2"' >>/etc/apache2/sites-enabled/000-default.conf
sed -i -e 's#ssl_certificate_file=.*#ssl_certificate_file=/certs/'$TLS_CERT'#g' /usr/local/fop2/fop2.cfg
sed -i -e 's#ssl_certificate_key_file=.*#ssl_certificate_key_file=/certs/'$TLS_KEY'#g' /usr/local/fop2/fop2.cfg
Expand Down Expand Up @@ -541,15 +536,15 @@ if [ "$WEBROOT" != "/var/www/html" ]; then
fi

### SMTP Config
if [ "$ENABLE_SMTP" = "TRUE" ] || [ "$ENABLE_SMTP" = "true" ]; then
if var_true $ENABLE_SMTP ; then
echo 'sendmail_path="/usr/bin/msmtp -C /etc/msmtprc -t "' > /etc/php/5.6/apache2/conf.d/smtp.ini
echo 'sendmail_path="/usr/bin/msmtp -C /etc/msmtprc -t "' > /etc/php/5.6/cli/conf.d/smtp.ini
chown asterisk:asterisk /etc/msmtprc
chmod 600 /etc/msmtprc
fi

### FOP2 Setup
if [ "$ENABLE_FOP" = "TRUE" ] || [ "$ENABLE_FOP" = "true" ]; then
if var_true $ENABLE_FOP ; then
print_info "Starting Operator Panel"
rm -rf /var/run/fop2.*
mkdir -p /var/log/fop
Expand All @@ -560,7 +555,7 @@ fi

silent service apache2 restart

if [ "$UCP_FIRST" = "TRUE" ] ; then
if var_true $ENABLE_UCP ; then
print_info "Web Server Started - Container Initialization Complete - Visit your http(s):https://yoursite/${ADMIN_DIRECTORY} to administer"
else
print_info "Web Server Started - Container Initialization Complete - Visit your http(s):https://yoursite/ to administer"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/with-contenv bash

for s in /assets/functions/*; do source $s; done
source /assets/functions/00-container

PROCESS_NAME="mongo"
check_container_initialized
check_service_initialized init
Expand Down

0 comments on commit 2b9252d

Please sign in to comment.