ugoviti / izpbx

izPBX is a Turnkey Cloud Native Telephony System powered by Asterisk Engine and FreePBX Management GUI
GNU General Public License v3.0
168 stars 69 forks source link

Problems with install #36

Closed thisisbenwoo closed 1 year ago

thisisbenwoo commented 1 year ago

Hi @ugoviti

First, thank you for putting this together. I'm really struggling with the install. I keep getting the following error: throw new \Exception("Cron line added didn't remain in crontab on final check. Check /tmp/cron.error for reason.");

I'm not sure why.

I'm including my default.env and docker-compose.yaml. Note that I have another .env for all my other docker containers. I'm also using traefik. Perhaps you could help me with figuring out where I'm going wrong please.

default.env

## enable persistent data storage (comment if you want disable persistence of data) (default: /data)
APP_DATA=/data

### TimeZone configuration
## set the timezone based on your geographical location (default: TZ=UTC)
TZ=Europe/Paris

### Database
## WARNING: default izPBX security passwords. please change it according to your security defaults
## NOTE: to avoid writing the mysql root password here, the MYSQL_ROOT_PASSWORD variable can be disabled
##       if the MYSQL_USER can create the asterisk database or if it already exist
#MYSQL_PASSWORD=<hidden>
#MYSQL_ROOT_PASSWORD=<hidden>

## WARNING: enable the following vars only for testing
#MYSQL_RANDOM_ROOT_PASSWORD=true
#MYSQL_ALLOW_EMPTY_ROOT_PASSWORD=true

## WARNING: if docker-compose is configured with "network_mode: host" then use "MYSQL_SERVER=127.0.0.1" or the address of the remote database server
## WARNING: if docker-compose is not configured with "network_mode: host" then use "MYSQL_SERVER=db" or the address of the remote database server
#MYSQL_SERVER=db
#MYSQL_SERVER=127.0.0.1
#MYSQL_DATABASE=izpbx
#MYSQL_DATABASE_CDR=izpbx_cdr
##MYSQL_USER=<hidden>

### Email addreses and SMTP smarthost
## outgoing mails will set as From as: (default: izpbx@localhost.localdomain)
#SMTP_MAIL_FROM=izpbx@example.com

## outgoing mails will to send notifications, like cron, fail2ban, etc... (default: root@localhost.localdomain)
#SMTP_MAIL_TO=admin@example.com

## specify DNS name or IP address for the SMTP RelayHost (default: none)
#SMTP_RELAYHOST=[smtp.example.com]:587
#SMTP_RELAYHOST_USERNAME=yourusername
#SMTP_RELAYHOST_PASSWORD=yoursecurepassword
#SMTP_STARTTLS=true
#SMTP_ALLOWED_SENDER_DOMAINS=127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
#SMTP_MESSAGE_SIZE_LIMIT=67108864

### Webserver and HTTP/HTTPS
## enable if the pbx is exposed to internet and want autoconfigure virtualhosting based on the following FQDN (default: none)
#APP_FQDN=izpbx.example.com

## enable https protocols (default: false)
## by default izpbx will use a self-signed certificate generated on first run if missing
#HTTPD_HTTPS_ENABLED=true

# use custom ssl certificates (only used when LETSENCRYPT_ENABLED=false) place you certs into: /etc/asterisk/keys
# NOTE: if you want recreate the self-signed certificates after initial deploy, you must delete the certs and restart izpbx
#HTTPD_HTTPS_CERT_FILE=/etc/asterisk/keys/default.crt
#HTTPD_HTTPS_KEY_FILE=/etc/asterisk/keys/default.key
#HTTPD_HTTPS_CHAIN_FILE=/etc/asterisk/keys/default.chain.crt
HTTPD_HTTPS_CERT_FILE=/etc/asterisk/keys/asterisk.crt
HTTPD_HTTPS_KEY_FILE=/etc/asterisk/keys/asterisk.key
HTTPD_HTTPS_CHAIN_FILE=/etc/asterisk/keys/asterisk.pem

## redirect unencrypted http connetions to https (default: false)
#HTTPD_REDIRECT_HTTP_TO_HTTPS=true

## auto generate Let's Encrypt SSL certificates if the pbx is exposed to Internet and want enable https protocol (default: false)
## To use LETSENCRYPT make sure SMTP_MAIL_TO and APP_FQDN are set to correct values
#LETSENCRYPT_ENABLED=true
#LETSENCRYPT_COUNTRY_CODE=IT
#LETSENCRYPT_COUNTRY_STATE=Rome

## by default everyone can connect to HTTP/HTTPS WEB interface, comment out to restrict the access and enhance the security (default: 0.0.0.0/0)
#HTTPD_ALLOW_FROM=127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16

### phpMyAdmin
#PMA_ALIAS=/admin/pma
#PMA_ALLOW_FROM=127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16

### FOP2 configuration (https://www.fop2.com/docs/)
#FOP2_AUTOUPGRADE=true
#FOP2_LICENSE_NAME=<put here your corporation name>
#FOP2_LICENSE_CODE=<put here your license code>
#FOP2_LICENSE_IFACE=docker0

## the following variables are not mandatory, you can leave commented (FOP2_AMI_PASSWORD will be a random hash)
#FOP2_AMI_HOST=localhost
#FOP2_AMI_PORT=5038
#FOP2_AMI_USERNAME=admin
#FOP2_AMI_PASSWORD=amp111

### Zabbix Network Monitoring
## for automatic discovery of HOSTNAME leave ZABBIX_HOSTNAME commented
#ZABBIX_SERVER=zabbixserver.example.com
#ZABBIX_HOSTNAME=izpbx.example.com
#ZABBIX_HOSTMETADATA=izPBX CHANGEM3WithAS3cur3HA$H

### Fail2ban 
## format: FAIL2BAN_SECTION_KEY=VALUE
## by default izpbx will will use: FAIL2BAN_DEFAULT_SENDER=$SMTP_MAIL_FROM and FAIL2BAN_DEFAULT_DESTEMAIL=$SMTP_MAIL_TO, anyway you can override it bellow
FAIL2BAN_ENABLED=false
#FAIL2BAN_ASTERISK_ENABLED=false
#FAIL2BAN_ASTERISK_LOGPATH=/var/log/asterisk/security
#FAIL2BAN_DEFAULT_SENDER=fail2ban@example.com
#FAIL2BAN_DEFAULT_DESTEMAIL=security@example.com
#FAIL2BAN_DEFAULT_BANACTION=iptables-allports[blocktype=DROP]
FAIL2BAN_DEFAULT_IGNOREIP=127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16
FAIL2BAN_DEFAULT_BANTIME=300
FAIL2BAN_DEFAULT_FINDTIME=3600
FAIL2BAN_DEFAULT_MAXRETRY=10
#FAIL2BAN_RECIDIVE_ENABLED=true
FAIL2BAN_RECIDIVE_BANTIME=1814400
FAIL2BAN_RECIDIVE_FINDTIME=15552000
FAIL2BAN_RECIDIVE_MAXRETRY=10

### FreePBX Advanced Settings
## prefix every FreePBX internal variable with FREEPBX_
## modules enabled on first startup
FREEPBX_MODULES_EXTRA=soundlang callrecording cdr conferences customappsreg featurecodeadmin infoservices logfiles music manager arimanager filestore recordings announcement asteriskinfo backup callforward callwaiting daynight calendar certman cidlookup contactmanager donotdisturb fax findmefollow iaxsettings miscapps miscdests ivr parking phonebook presencestate printextensions queues cel timeconditions pm2
## enable automatic upgrading FreePBX on izpbx startup from previous version to a new major version (ex. from 15 to 16)
## WARNING: this is a dangerous task!!! be sure to have a backup before enabling core autoupgrade!
FREEPBX_AUTOUPGRADE_CORE=true
# enable automatic modules updates (NOTE: only on initial deploy)
FREEPBX_AUTOUPGRADE_MODULES=true
FREEPBX_FREEPBX_SYSTEM_IDENT=izPBX
FREEPBX_AS_DISPLAY_READONLY_SETTINGS=1
FREEPBX_AS_OVERRIDE_READONLY=1
FREEPBX_ENABLECW=0
FREEPBX_TONEZONE=it
FREEPBX_PHPTIMEZONE=Europe/Rome
#FREEPBX_BRAND_IMAGE_TANGO_LEFT=images/tango.png
#FREEPBX_BRAND_IMAGE_FREEPBX_FOOT=images/freepbx_small.png
#FREEPBX_BRAND_IMAGE_SPONSOR_FOOT=images/sangoma-horizontal_thumb.png
#FREEPBX_BRAND_FREEPBX_ALT_LEFT=FreePBX
#FREEPBX_BRAND_FREEPBX_ALT_FOOT=FreePBX®
#FREEPBX_BRAND_SPONSOR_ALT_FOOT=www.sangoma.com
#FREEPBX_BRAND_IMAGE_FREEPBX_LINK_LEFT=http://www.freepbx.org
#FREEPBX_BRAND_IMAGE_FREEPBX_LINK_FOOT=http://www.freepbx.org
#FREEPBX_BRAND_IMAGE_SPONSOR_LINK_FOOT=http://www.sangoma.com
#FREEPBX_RSSFEEDS=

## WORKAROUND @20200322 https://issues.freepbx.org/browse/FREEPBX-20559 : fwconsole setting SIGNATURECHECK 0
#FREEPBX_SIGNATURECHECK=0

### PhoneBook Settings
## PhoneBook server address used by VoiP Phones.
## You can specify IP or DNS name. If empty, by default will be used in order: 'http://$APP_FQDN' or 'http://PBXIP'
#PHONEBOOK_ADDRESS=https://izpbx.example.com

### DHCP/NTP/TFTP Server
#DHCP_DOMAIN=izpbx.local
#DHCP_POOL_START=10.1.1.10
#DHCP_POOL_END=10.1.1.250
#DHCP_POOL_LEASE=72h
## DHCP_DNS: leave commented to use docker container DNS ip address
#DHCP_DNS=10.1.1.1
#DHCP_GW=10.1.1.1
#DHCP_NTP=10.1.1.1

### NTP Server
#NTP_SERVERS=0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org
#NTP_ALLOW_FROM=127.0.0.0/8 10.0.0.0/8 172.16.0.0/12 192.168.0.0/16

### Container Network Ports
## webserver and freepbx ports
#APP_PORT_HTTP=80
#APP_PORT_HTTPS=443
# asterisk ports
#APP_PORT_IAX=4569
#APP_PORT_PJSIP=5060
#APP_PORT_SIP=5160
#APP_PORT_WEBRTC=8089
#APP_PORT_UCP_HTTP=8001
#APP_PORT_UCP_HTTPS=8003
#APP_PORT_AMI=8088
## WARNING: tune the APP_PORT_RTP_END to a lower value (ex. 10200) if 'network_mode: host' is not used
#APP_PORT_RTP_START=10000
#APP_PORT_RTP_END=20000
# database port
#APP_PORT_MYSQL=3306
# other services ports
#APP_PORT_DHCP=67
#APP_PORT_TFTP=69
#APP_PORT_NTP=123
#APP_PORT_FOP2=4445
#APP_PORT_ZABBIX=10050

### Container Services
#POSTFIX_ENABLED=true
CRON_ENABLED=true
HTTPD_ENABLED=true
IZPBX_ENABLED=true
FAIL2BAN_ENABLED=false
#DHCP_ENABLED=true
#TFTP_ENABLED=true
#NTP_ENABLED=true
#FOP2_ENABLED=true
#ZABBIX_ENABLED=true
#PMA_ENABLED=true
PHONEBOOK_ENABLED=true

docker-compose.yaml

services:

#################################################
# ?izPBX
#################################################
  pbx:
    image: izdock/izpbx-asterisk:latest
    container_name: izpbx
    restart: always
    networks:
      - traefik
      - db
    env_file:
      - $DOCKERDIR/izpbx/default.env
    environment: 
      - MYSQL_SERVER=$DB_HOST
      - MYSQL_DATABASE=izpbx
      - MYSQL_DATABASE_CDR=izpbx_cdr
      - MYSQL_USER=$asterisk_username
      - MYSQL_PASSWORD=$asterisk_PASSWORD
      - MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD
    volumes:
      - $DOCKERDIR/izpbx/data:/data

      # - ./db:/var/lib/mysql
    cap_add:
      - NET_ADMIN
    privileged: true
    security_opt:
      - no-new-privileges:true
    labels:
      - "traefik.enable=true"
        # Not required
      # - "traefik.docker.network=traefik"
      ## HTTP Routers
      - "traefik.http.routers.pbx-rtr.tls=true"
      - "traefik.http.routers.pbx-rtr.entrypoints=https"
      - "traefik.http.routers.pbx-rtr.rule=Host(`pbx.$mydomain`)"
      ## HTTP Services
      - "traefik.http.routers.pbx-rtr.service=pbx-svc"
      - "traefik.http.services.pbx-svc.loadbalancer.server.port=80"
      ## Middlewares
        # Use no authentication chain because it has to be fully exposed to the Internet
      - "traefik.http.routers.pbx-rtr.middlewares=chain-no-auth@file"

networks:
    # traefik netowrk into the Internet
  traefik:
    external: true
    # db internal network for the MariaDB database
  db:
    external: true

Thank you!

ben

ugoviti commented 1 year ago

Hi ben,

You getting the following error after the deploy?

throw new \Exception("Cron line added didn't remain in crontab on final check. Check /tmp/cron.error for reason.");

If you run izpbx using the distribuited docker-compose.yml and .env you get the same error?

this error is happen only with your default.env and docker-compose.yml ?

Thank you

thisisbenwoo commented 1 year ago

OK, I stopped and removed all my containers, and ran with just your parameters. It got further, but then I saw some sort of "Ajax" error, and the whole system hung. Couldn't get in with SSH, couldn't even log in from the root. Ended up having to reboot.

I went back to the asterisk full log, and the only thing that jumped out at me is the following:

[2022-11-06 15:57:31] WARNING[1120] loader.c: Some non-required modules failed to load.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'res_monitor' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 21. Its replacement is 'app_mixmonitor'.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'res_adsi' has been loaded but may be removed in a future release.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'res_pktccops' has been loaded but will be deprecated in Asterisk version 19 and will be removed in Asterisk version 21.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_image' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_adsiprog' has been loaded but may be removed in a future release.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_ices' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_nbscat' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_macro' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 21. Its replacement is 'app_stack (GoSub)'.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_getcpeid' has been loaded but may be removed in a future release.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_url' has been loaded but was deprecated in Asterisk version 16 and will be removed in Asterisk version 19.
[2022-11-06 15:57:31] WARNING[1120] loader.c: Module 'app_mysql' has been loaded but was deprecated in Asterisk version 1.8 and will be removed in Asterisk version 19. Its replacement is 'func_odbc'.
[2022-11-06 15:57:31] ERROR[1120] loader.c: chan_dongle declined to load.
[2022-11-06 15:57:31] VERBOSE[1120] asterisk.c: Asterisk Ready.

The last few lines of the log are:

[2022-11-06 15:58:20] VERBOSE[1120] asterisk.c: Asterisk cleanly ending (0).
[2022-11-06 15:58:20] VERBOSE[1120] asterisk.c: Executing last minute cleanups
[2022-11-06 15:58:20] VERBOSE[1120] res_musiconhold.c: Destroying musiconhold processes
[2022-11-06 15:58:20] VERBOSE[1120] manager.c: Manager unregistered action DBGet
[2022-11-06 15:58:20] VERBOSE[1120] manager.c: Manager unregistered action DBGetTree
[2022-11-06 15:58:20] VERBOSE[1120] manager.c: Manager unregistered action DBPut
[2022-11-06 15:58:20] VERBOSE[1120] manager.c: Manager unregistered action DBDel
[2022-11-06 15:58:20] VERBOSE[1120] manager.c: Manager unregistered action DBDelTree

I'm convinced it's probably something silly on my part !

ugoviti commented 1 year ago

still experiencing these issues?

thisisbenwoo commented 1 year ago

still experiencing these issues?

Yes, but I decided to give up. I tried another project that seems to give me what I want. Thank you for following up.

fukemy commented 3 months ago

hi @thisisbenwoo do you found anything better?