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

Can not run file #62

Closed fukemy closed 3 months ago

fukemy commented 3 months ago

please help, I got error FreePBX not found + DB not found:

2024-04-04 11:49:05 => Starting container izPBX Cloud Native Telephony System -> izpbx-asterisk:20.16.11 (build:109 commit:eb6e874 date:2024-01-06)
2024-04-04 11:49:05 ===============================================================================
2024-04-04 11:49:05 => Executing izpbx-asterisk hooks:
2024-04-04 11:49:06 --> fixing supervisord config file...
2024-04-04 11:49:06 ---> RHEL Linux based distro detected
2024-04-04 11:49:06 => WARNING: No Persistent storage path detected... the configurations will be lost on container restart
2024-04-04 11:49:06 --> verifying files permissions
2024-04-04 11:49:06 ---> WARNING: file or directory doesn't exist: '/var/lib/tftpboot'
2024-04-04 11:49:06 => Setting up MSMTP as (default) sendmail replacement
2024-04-04 11:49:06 --> forwarding all emails to: 
2024-04-04 11:49:06 => Disabling postfix service... because POSTFIX_ENABLED=false
2024-04-04 11:49:06 => Enabling cron service... because CRON_ENABLED=true
2024-04-04 11:49:06 --> configuring cron service...
2024-04-04 11:49:06 ---> fixing permissions: '/var/spool/cron'
2024-04-04 11:49:06 => Enabling fail2ban service... because FAIL2BAN_ENABLED=true
2024-04-04 11:49:06 --> configuring fail2ban service...
2024-04-04 11:49:06 --> reconfiguring Fail2ban settings...
2024-04-04 11:49:07 => Enabling httpd service... because HTTPD_ENABLED=true
2024-04-04 11:49:07 --> configuring httpd service...
2024-04-04 11:49:07 --> setting Apache ServerName to 16effb46a6dd
2024-04-04 11:49:07 --> configuring Apache VirtualHosting and creating empty /etc/httpd/conf.d/virtual.conf file
2024-04-04 11:49:07 => Disabling asterisk service... because ASTERISK_ENABLED=false
2024-04-04 11:49:07 => Enabling izpbx service... because IZPBX_ENABLED=true
2024-04-04 11:49:07 --> configuring izpbx service...
2024-04-04 11:49:07 ---> verifing FreePBX configurations
2024-04-04 11:49:07 ---> configuring FreePBX ODBC
2024-04-04 11:49:07 
2024-04-04 11:49:07 =====================================================================
2024-04-04 11:49:07 => !!! NEW INSTALLATION DETECTED :: FreePBX IS NOT INITIALIZED !!! <=
2024-04-04 11:49:07 =====================================================================
2024-04-04 11:49:07 --> missing '/.initialized' file... initializing FreePBX... try:[1/5]
2024-04-04 11:49:07 --> NOTE: skipping MySQL init because not root user password defined
2024-04-04 11:49:07 
2024-04-04 11:49:07 
2024-04-04 11:49:07 STARTING ASTERISK
2024-04-04 11:49:13 Asterisk Started
2024-04-04 11:49:24 ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)
2024-04-04 11:49:24 --> WARNING: cannot connect to MySQL database 'db'... waiting database to become ready... retrying in 10 seconds... try:[2/10]
2024-04-04 11:49:34 ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)
2024-04-04 11:49:34 --> WARNING: cannot connect to MySQL database 'db'... waiting database to become ready... retrying in 10 seconds... try:[3/10]
2024-04-04 11:49:44 ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)
2024-04-04 11:49:44 --> WARNING: cannot connect to MySQL database 'db'... waiting database to become ready... retrying in 10 seconds... try:[4/10]
2024-04-04 11:49:54 ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)
2024-04-04 11:49:54 --> WARNING: cannot connect to MySQL database 'db'... waiting database to become ready... retrying in 10 seconds... try:[5/10]
2024-04-04 11:50:04 ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)
2024-04-04 11:50:04 --> WARNING: cannot connect to MySQL database 'db'... waiting database to become ready... retrying in 10 seconds... try:[6/10]
2024-04-04 11:50:14 ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)
2024-04-04 11:50:14 --> WARNING: cannot connect to MySQL database 'db'... waiting database to become ready... retrying in 10 seconds... try:[7/10]
2024-04-04 11:50:24 ERROR 2005 (HY000): Unknown MySQL server host 'db' (-2)
Ảnh màn hình 2024-04-04 lúc 11 50 58
ugoviti commented 3 months ago

Hi, can you paste you .env file? (remove any password please)

Thankyou

fukemy commented 3 months ago

Hi, I just pull and run from the docker desktop, please tell me how to get the env file, thanks so much

Ảnh màn hình 2024-04-04 lúc 15 00 56
ugoviti commented 3 months ago

did you follow the installation guide from https://github.com/ugoviti/izpbx/blob/main/README.md?

kind regards

fukemy commented 3 months ago

@ugoviti, yes now I followed your guide but still got error, I will paste log here:

Ảnh màn hình 2024-04-08 lúc 17 12 27
ugoviti commented 3 months ago

Please check the MYSQL_PASSWORD password, I can see a space before the password from your log:

vedaxm1@VedaXs-MacBook-Pro izpbx % docker run --rm -ti -v ./data/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=asterisk -e **MYSQL_PASSWORD= asterisk** --name izpbx-db mariadb:10.11.6
fukemy commented 3 months ago

@ugoviti I editted the question and remove the space but still got this error like above question. here is my command:

docker run --rm -ti -v ./data/db:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=asterisk -e MYSQL_PASSWORD=asterisk --name izpbx-db mariadb:10.4

docker run --platform linux/amd64 --rm -ti --network=host --privileged --cap-add=NET_ADMIN -v ./data/izpbx:/data -e MYSQL_ROOT_PASSWORD=asterisk -e MYSQL_PASSWORD=asterisk -e MYSQL_SERVER=127.0.0.1 -e MYSQL_DATABASE=asterisk -e MYSQL_USER=asterisk -e APP_DATA=/data --name izpbx izpbx-asterisk:latest

here is my .env file:

### Persistent data management
## 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/Rome

### 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=asterisk
MYSQL_ROOT_PASSWORD=asterisk

## 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=asterisk
MYSQL_DATABASE_CDR=asteriskcdrdb
MYSQL_USER=asterisk

### 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
#SMTP_RELAYHOST_PORT=25
#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

## 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/)
## Note: If FOP2_AUTOUPGRADE=true, you must have purchased a valid upgrade subscription from fop.com, otherwise FOP2 will become unsupported.
#FOP2_AUTOUPGRADE=false
#FOP2_AUTOACTIVATION=false
#FOP2_LICENSE_NAME=<put here your corporation name>
#FOP2_LICENSE_CODE=<put here your license code>
#FOP2_LICENSE_IFACE=eth0

## 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=true
FAIL2BAN_ASTERISK_ENABLED=true
#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

# fix permission of freepbx and asterisk files on every start
FREEPBX_FIX_PERMISSION=false

# customize default freepbx settings on every start
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
MSMTP_ENABLED=true
#POSTFIX_ENABLED=true
CRON_ENABLED=true
HTTPD_ENABLED=true
IZPBX_ENABLED=true
FAIL2BAN_ENABLED=true
#DHCP_ENABLED=true
#TFTP_ENABLED=true
#NTP_ENABLED=true
#FOP2_ENABLED=true
#ZABBIX_ENABLED=true
#PMA_ENABLED=true
PHONEBOOK_ENABLED=true
fukemy commented 3 months ago

@ugoviti I make all running, thanks you so much, can you tell me how can I open FreePBX GUI now? I can not see any url to open here:

Ảnh màn hình 2024-04-09 lúc 09 56 35
ugoviti commented 3 months ago

You can connect via http://DOCKERHOST_IP or https if you enabled.

Thank you

fukemy commented 2 months ago

hi, could you please guide me what is DOCKERHOST_IP, I am new with docker, then i am following your guide to open FreePBX GUI