Skip to content

Commit

Permalink
varsion 1
Browse files Browse the repository at this point in the history
  • Loading branch information
alenas committed Dec 30, 2020
1 parent f95d0a7 commit 81790f3
Show file tree
Hide file tree
Showing 3 changed files with 106 additions and 61 deletions.
35 changes: 6 additions & 29 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
FROM tiredofit/nodejs:10-debian-latest
LABEL maintainer="Dave Conroy (dave at tiredofit dot ca)"
LABEL maintainer="Alenas Kisonas"

### Set defaults
ENV ASTERISK_VERSION=17.6.0 \
ENV ASTERISK_VERSION=17.9.0 \
BCG729_VERSION=1.0.4 \
DONGLE_VERSION=20200610 \
G72X_CPUHOST=penryn \
G72X_VERSION=0.1 \
MONGODB_VERSION=4.2 \
PHP_VERSION=5.6 \
PHP_VERSION=7.3 \
SPANDSP_VERSION=20180108 \
RTP_START=18000 \
RTP_FINISH=20000
RTP_FINISH=18200

### Pin libxml2 packages to Debian repositories
RUN echo "Package: libxml2*" > /etc/apt/preferences.d/libxml2 && \
Expand All @@ -23,8 +21,6 @@ RUN echo "Package: libxml2*" > /etc/apt/preferences.d/libxml2 && \
set -x && \
curl https://packages.sury.org/php/apt.gpg | apt-key add - && \
echo "deb https://packages.sury.org/php/ buster main" > /etc/apt/sources.list.d/deb.sury.org.list && \
curl https://www.mongodb.org/static/pgp/server-${MONGODB_VERSION}.asc | apt-key add - && \
echo "deb https://repo.mongodb.org/apt/debian buster/mongodb-org/${MONGODB_VERSION} main" > /etc/apt/sources.list.d/mongodb-org.list && \
echo "deb https://ftp.us.debian.org/debian/ buster-backports main" > /etc/apt/sources.list.d/backports.list && \
echo "deb-src https://ftp.us.debian.org/debian/ buster-backports main" >> /etc/apt/sources.list.d/backports.list && \
apt-get update && \
Expand Down Expand Up @@ -129,8 +125,6 @@ RUN echo "Package: libxml2*" > /etc/apt/preferences.d/libxml2 && \
locales-all \
make \
mariadb-client \
mariadb-server \
mongodb-org \
mpg123 \
odbc-mariadb \
php${PHP_VERSION} \
Expand Down Expand Up @@ -183,7 +177,7 @@ RUN echo "Package: libxml2*" > /etc/apt/preferences.d/libxml2 && \
./configure \
--with-jansson-bundled \
--with-pjproject-bundled \
--with-bluetooth \
#--with-bluetooth \
--with-codec2 \
--with-crypto \
--with-gmime \
Expand Down Expand Up @@ -245,15 +239,6 @@ RUN echo "Package: libxml2*" > /etc/apt/preferences.d/libxml2 && \
make && \
make install && \
\
#### Add USB Dongle support
git clone https://github.com/rusxakep/asterisk-chan-dongle /usr/src/asterisk-chan-dongle && \
cd /usr/src/asterisk-chan-dongle && \
git checkout tags/$DONGLE_VERSION && \
./bootstrap && \
./configure --with-astversion=$ASTERISK_VERSION && \
make && \
make install && \
\
ldconfig && \
\
### Cleanup
Expand All @@ -276,33 +261,25 @@ RUN echo "Package: libxml2*" > /etc/apt/preferences.d/libxml2 && \
mkdir -p /var/log/apache2 && \
mkdir -p /var/log/httpd && \
\
### Zabbix setup
echo '%zabbix ALL=(asterisk) NOPASSWD:/usr/sbin/asterisk' >> /etc/sudoers && \
\
### Setup for data persistence
mkdir -p /assets/config/var/lib/ /assets/config/home/ && \
mv /home/asterisk /assets/config/home/ && \
ln -s /data/home/asterisk /home/asterisk && \
mv /var/lib/asterisk /assets/config/var/lib/ && \
ln -s /data/var/lib/asterisk /var/lib/asterisk && \
ln -s /data/usr/local/fop2 /usr/local/fop2 && \
mkdir -p /assets/config/var/run/ && \
mv /var/run/asterisk /assets/config/var/run/ && \
mv /var/lib/mysql /assets/config/var/lib/ && \
mkdir -p /assets/config/var/spool && \
mv /var/spool/cron /assets/config/var/spool/ && \
ln -s /data/var/spool/cron /var/spool/cron && \
mkdir -p /var/run/mongodb && \
rm -rf /var/lib/mongodb && \
ln -s /data/var/lib/mongodb /var/lib/mongodb && \
ln -s /data/var/run/asterisk /var/run/asterisk && \
rm -rf /var/spool/asterisk && \
ln -s /data/var/spool/asterisk /var/spool/asterisk && \
rm -rf /etc/asterisk && \
ln -s /data/etc/asterisk /etc/asterisk

### Networking configuration
EXPOSE 80 443 4445 4569 5060/udp 5160/udp 5061 5161 8001 8003 8008 8009 8025 ${RTP_START}-${RTP_FINISH}/udp
EXPOSE 80 443 4445 4569 5060/udp 5160/udp 5061 5161 8001 8003 8088 8089 8025 ${RTP_START}-${RTP_FINISH}/udp

### Files add
ADD install /
98 changes: 98 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
version: '3'

# First set up docker network on a host !!!
services:
freepbx:
container_name: freepbx-app
image: al3nas/freepbx:1
ports:
- 80:80
- 443:443
- 4569:4569/udp
- 5060:5060/udp
#- 5160:5160/udp
#- 8008:8008/tcp
- 8089:8089/tcp
- 18000-18200:18000-18200/udp
volumes:
#- /sys/fs/cgroup:/sys/fs/cgroup:ro
# Apache certs
#- ~/certs:/certs
# Asterisk certs
- ~/data:/data
- ~/logs:/var/log
- ~/html:/var/www/html

### Only Enable this option below if you set DB_EMBEDDED=TRUE
#- ./db:/var/lib/mysql
### You can drop custom files overtop of the image if you have made modifications to modules/css/whatever - Use with care
#- ./assets/custom:/assets/custom

environment:
- HOSTNAME=voip.pir.lt
- VIRTUAL_HOST=voip.pir.lt
#- VIRTUAL_NETWORK=nginx-proxy
### If you want to connect to the SSL Enabled Container
- VIRTUAL_PORT=443
- VIRTUAL_PROTO=https
- VIRTUAL_PORT=80

- RTP_START=18000
- RTP_FINISH=18200

- ENABLE_FAIL2BAN=TRUE
- ENABLE_SSL=TRUE
- ENABLE_ZABBIX=FALSE
- ENABLE_XMPP=FALSE
- UCP_FIRST=FALSE
# - ZABBIX_HOSTNAME=freepbx-app

- INSTALL_ADDITIONAL_MODULES=webrtc

## Use for External MySQL Server
- DB_EMBEDDED=FALSE
### These are only necessary if DB_EMBEDDED=FALSE
- DB_HOST=freepbx-db
- DB_PORT=3306
- DB_NAME=asterisk
- DB_USER=asterisk
- DB_PASS=adkfjaHGFYTEUIB7235

### These final lines are for Fail2ban. If you don't want, comment and also add ENABLE_FAIL2BAN=FALSE to your environment
cap_add:
- NET_ADMIN
privileged: true
restart: always

freepbx-db:
container_name: freepbx-db
image: tiredofit/mariadb
volumes:
- ~/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=jdhTRDvn636RYDg
- MYSQL_DATABASE=asterisk
- MYSQL_USER=asterisk
- MYSQL_PASSWORD=adkfjaHGFYTEUIB7235
restart: always

# freepbx-db-backup:
# container_name: freepbx-db-backup
# image: tiredofit/db-backup
# links:
# - freepbx-db
# volumes:
# - ~/dbbackup:/backup
# environment:
# - ZABBIX_HOSTNAME=freepbx-db-backup
# - DB_HOST=freepbx-db
# - DB_TYPE=mariadb
# - DB_NAME=asterisk
# - DB_USER=asterisk
# - DB_PASS=adkfjaHGFYTEUIB7235
# - DB_DUMP_FREQ=1440
# - DB_DUMP_BEGIN=0000
# - DB_CLEANUP_TIME=8640
# - MD5=FALSE
# restart: always

34 changes: 2 additions & 32 deletions install/etc/cont-init.d/10-freepbx
Original file line number Diff line number Diff line change
Expand Up @@ -458,42 +458,12 @@ if [ "$VIRTUAL_PROTO" = "https" ] || var_true "$ENABLE_SSL" ; then
print_notice "Enabling SSL"
mkdir -p /certs

if [ ! -f /certs/"${TLS_CERT}" ] && [ ! -f /certs/"${TLS_KEY}" ]; then
print_warn "No SSL certs found, autogenerating self-signed - WebRTC will not work with a self-signed certificate!"
cat <<EOF > /tmp/openssl.cnf
[ req ]
default_bits = 2048
encrypt_key = yes
distinguished_name = req_dn
x509_extensions = cert_type
prompt = no

[ req_dn ]
C=XX
ST=XX
L=Self Signed
O=Freepbx
OU=Freepbx
CN=*
emailAddress=hostmaster@local

[ cert_type ]
nsCertType = server
EOF

silent openssl req -new -x509 -nodes -days 365 -config /tmp/openssl.cnf -out /certs/cert.pem -keyout /certs/key.pem
chmod 0600 /certs/key.pem
rm -f /tmp/openssl.cnf
TLS_CERT="cert.pem"
TLS_KEY="key.pem"
fi

silent a2enmod ssl
cat >> /etc/apache2/sites-enabled/000-default.conf << EOF
<VirtualHost *:$HTTPS_PORT>
SSLEngine on
SSLCertificateFile "/certs/$TLS_CERT"
SSLCertificateKeyFile "/certs/$TLS_KEY"
SSLCertificateFile "/etc/asterisk/keys/integration/certificate.pem"
SSLCertificateKeyFile "/etc/asterisk/keys/integration/webserver.key"
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log common
EOF
Expand Down

0 comments on commit 81790f3

Please sign in to comment.