Open hakancunier opened 4 years ago
Let me rebuild the image, it seems to be pulling from the wrong base.
Hi, I took a look at it and there were a few issues, The function you found throwing errors was indeed wrong and trying to install before the DB was ready, however the real underlying issue was FreePBX changing their source code in the install routines and I missed it. This is referenced here #121 and has been solved with latest push tiredofit/freepbx/15-3.9.3
.
Hi. It seems fixed but when i restart docker instance it tries to download modules again. Please find the attached docker log for further information.
PS: Calling as docker run -dit --restart unless-stopped --name freepbx1 -p 1531:80 -p 1532:5060 -p 1533:5160 -p 1565-1600:18000-18035/udp \ --add-host dockerhost:myhostip \ -v /opt/disk/freepbx/certs:/certs \ -v /opt/disk/freepbx/log:/var/log \ -v /opt/disk/freepbx/data:/data \ -v /opt/disk/freepbx/www:/var/www/html \ -e DB_EMBEDDED=FALSE \ -e DB_HOST="dockerhost" \ -e DB_NAME="freepbx" \ -e DB_USER="docker" \ -e DB_PASS="mypass \ tiredofit/freepbx
Thanks, to look into, something is off. It shouldn't be starting Mongo and MariaDB inside the container.
I'm running into the same error (/usr/sbin/fwconsole
missing) deploying using Kubernetes or docker-compose. Interestingly enough using docker run
as in https://github.com/tiredofit/docker-freepbx/issues/120#issuecomment-581059990 works without issue
After restart, didnt started. Can you fix this?
Install (2020-02-11 15:55 GMT+3) ..... Done! Generating CSS...Done Module ucp version 15.0.6.13 successfully installed Updating Hooks...Done Chowning directories...Done [INFO] [freepbx] Finished Installation of FreePBX Modules - Proceeding with next phase of install [NOTICE] [freepbx] Setting Configuration [NOTICE] [freepbx] Setting RTP Ports - Start: '18000' Finish: '20000' [INFO] [freepbx] Starting Asterisk chown: cannot access '/etc/msmtprc': No such file or directory chmod: cannot access '/etc/msmtprc': No such file or directory [INFO] [freepbx] Starting Operator Panel [INFO] [freepbx] Web Server Started - Container Initialization Complete [cont-init.d] 10-freepbx: exited 0. [cont-init.d] 99-container: executing... [cont-init.d] 99-container: exited 0. [cont-init.d] done. [services.d] starting services [services.d] done. [INFO] [zabbix] Starting Zabbix Agent [INFO] [cron] Starting cron [cont-finish.d] executing container finish scripts... [cont-finish.d] 10-freepbx: executing... Running FreePBX shutdown... Running Asterisk pre from Core module Stopping Core FastAGI Server Stopped FastAGI Server Running Asterisk pre from Ucp module Stopping UCP Node Server [>---------------------------] < 1 sec Stopped UCP Node Server Shutting down Asterisk Gracefully. Will forcefully kill after 30 seconds. Press C to Cancel Press N to shut down NOW stty: 'standard input': Inappropriate ioctl for device s6-maximumtime: warning: unable to wait for child process: Operation timed out [cont-finish.d] 10-freepbx: exited 99. [cont-finish.d] done. [s6-finish] waiting for services. stty: 'standard input': Inappropriate ioctl for device [>---------------------------] < 1 sec[s6-finish] sending all processes the TERM signal. [s6-finish] sending all processes the KILL signal and exiting.
After Restart:(I guess) [s6-init] making user provided files available at /var/run/s6/etc...[INFO] [zabbix] Starting Zabbix Agent exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] 00-functions: applying... 2020-02-11T04:50:12.563-0800 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongodb.log" [fix-attrs.d] 00-functions: exited 0. [fix-attrs.d] 01-s6: applying... [fix-attrs.d] 01-s6: exited 0. [fix-attrs.d] 02-zabbix: applying... [fix-attrs.d] 02-zabbix: exited 0. [fix-attrs.d] 03-logrotate: applying... [fix-attrs.d] 03-logrotate: exited 0. [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] 00-timezone: executing... [cont-init.d] 00-timezone: exited 0. [cont-init.d] 01-permissions: executing... [cont-init.d] 01-permissions: exited 0. [cont-init.d] 02-zabbix: executing... [cont-init.d] 02-zabbix: exited 0. [cont-init.d] 03-cron: executing... [cont-init.d] 03-cron: exited 0. [cont-init.d] 04-smtp: executing... [NOTICE] [smtp] Sendmail replaced and enabled to route mail to: 'postfix-relay' [cont-init.d] 04-smtp: exited 0. [cont-init.d] 05-fail2ban: executing... [INFO] [fail2ban] Starting Fail2ban 2020-02-11T04:50:13.319-0800 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongodb.log" 2020-02-11T04:50:14.326-0800 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "/var/log/mongodb/mongodb.log" [cont-init.d] 05-fail2ban: exited 0. [cont-init.d] 08-mongodb: executing... [cont-init.d] 08-mongodb: exited 0. [cont-init.d] 09-mariadb: executing... [cont-init.d] 09-mariadb: exited 0. [cont-init.d] 10-freepbx: executing... [NOTICE] [freepbx] Setting File Permissions ln: failed to create symbolic link '/home/asterisk/asterisk': File exists ln: failed to create symbolic link '/etc/amportal.conf': File exists [NOTICE] [freepbx] Setting Configuration [NOTICE] [freepbx] Setting RTP Ports - Start: '18000' Finish: '20000' [INFO] [freepbx] Starting Asterisk chown: cannot access '/etc/msmtprc': No such file or directory chmod: cannot access '/etc/msmtprc': No such file or directory [INFO] [freepbx] Starting Operator Panel [INFO] ** [freepbx] Web Server Started - Container Initialization Complete [cont-init.d] 10-freepbx: exited 0. [cont-init.d] 99-container: executing...
ERROR - All scripts have not initialized properly - All services are now halted * - Please enter the container find out why the missing -init state file hasn't been written **
/etc/cont-init.d: 00-timezone 01-permissions 02-zabbix 03-cron 04-smtp 05-fail2ban 08-mongodb 09-mariadb 10-freepbx
/tmp/state: /tmp/state/00-timezone-init /tmp/state/01-permissions-init /tmp/state/02-zabbix-init /tmp/state/03-cron-init /tmp/state/04-smtp-init /tmp/state/05-fail2ban-init /tmp/state/08-mongodb-init /tmp/state/09-mariadb-init /tmp/state/10-freepbx-init /tmp/state/99-container-init
[cont-init.d] 99-container: exited 1. [cont-init.d] done. [services.d] starting services [services.d] done.
I cant for the life of me recreate this. What's confusing is that your system is taking in random variables to enable MongoDB which in the command line copy you've sent clearly do not activate it. I'm also wondering at the errors you are getting displayed regarding your /etc folder (/etc/msmtprc) which I cannot get happening on my system.
Probably worth while understanding what type of host you are using, the filesystem for storage, and Docker version. Hows about if you used the example docker-compose file and tweaked it for your purposes as well?
I am also having the same problem, trying the docker run command in #120 doesn't work for me.
s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] 00-functions: applying...
[fix-attrs.d] 00-functions: exited 0.
[fix-attrs.d] 01-s6: applying...
[fix-attrs.d] 01-s6: exited 0.
[fix-attrs.d] 02-zabbix: applying...
[fix-attrs.d] 02-zabbix: exited 0.
[fix-attrs.d] 03-logrotate: applying...
[fix-attrs.d] 03-logrotate: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-timezone: executing...
[cont-init.d] 00-timezone: exited 0.
[cont-init.d] 01-permissions: executing...
[cont-init.d] 01-permissions: exited 0.
[cont-init.d] 02-zabbix: executing...
[cont-init.d] 02-zabbix: exited 0.
[cont-init.d] 03-cron: executing...
[cont-init.d] 03-cron: exited 0.
[cont-init.d] 04-smtp: executing...
[100m[NOTICE][49m ** [smtp] Sendmail replaced and enabled to route mail to: 'postfix-relay'
[cont-init.d] 04-smtp: exited 0.
[cont-init.d] 05-fail2ban: executing...
[42m[INFO][49m ** [fail2ban] Starting Fail2ban
[cont-init.d] 05-fail2ban: exited 0.
[cont-init.d] 08-mongodb: executing...
[cont-init.d] 08-mongodb: exited 0.
[cont-init.d] 09-mariadb: executing...
[cont-init.d] 09-mariadb: exited 0.
[cont-init.d] 10-freepbx: executing...
[100m[NOTICE][49m ** [freepbx] Creating Default Configuration Files
[100m[NOTICE][49m ** [freepbx] Setting File Permissions
ln: failed to create symbolic link '/home/asterisk/asterisk': File exists
[42m[INFO][49m ** [freepbx] New Install Detected - Please wait while we fetch FreePBX - Will take 3 to 30 minutes!
[100m[NOTICE][49m ** [freepbx] Starting Asterisk 16.7.0 for the first time
[100m[NOTICE][49m ** [freepbx] Installing FreePBX source code
[101m[ERROR][49m ** [freepbx] Can't seem to locate /usr/sbin/fwconsole.. Exitting
[cont-init.d] 10-freepbx: exited 1.
[cont-init.d] 99-container: executing...
**********************************************************************************************************************
**********************************************************************************************************************
**** ****
**** ERROR - All scripts have not initialized properly - All services are now halted ****
**** - Please enter the container find out why the missing *-init state file hasn't been written ****
**** ****
**********************************************************************************************************************
**********************************************************************************************************************
/etc/cont-init.d:
00-timezone 01-permissions 02-zabbix 03-cron 04-smtp 05-fail2ban
08-mongodb 09-mariadb 10-freepbx
/tmp/state:
/tmp/state/00-timezone-init /tmp/state/01-permissions-init
/tmp/state/02-zabbix-init /tmp/state/03-cron-init
/tmp/state/04-smtp-init /tmp/state/05-fail2ban-init
/tmp/state/08-mongodb-init /tmp/state/09-mariadb-init
[cont-init.d] 99-container: exited 1.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
I should say I am using the latest
tag for your container.
Can you confirm you are starting fresh (ie no external volumes ie data, db, dbbackup logs)? I can add some additional checks if a failed install occurs by bad downloads if this is not the case.
In my case, both docker-compose and kubernetes were on fresh systems with no existing persistent volumes, on two separate machines (local and GCE)
OK thanks for the confirmation. Before I dive into this, can you set DEBUG_MODE=TRUE as an environment variable and send me privately the logs? My email address is in the Changelog. (dave at..)
I've also tried with a fresh environment and am getting the same error: Can't seem to locate /usr/sbin/fwconsole.. Exitting
Sorry for the noise. Turns out my issue was that the database was not created correctly when I started the mariadb container, so FreePBX couldn't connect to it (Access denied) and failed from there. Correctly creating the DB fixed the issue
Sorry for the noise. Turns out my issue was that the database was not created correctly when I started the mariadb container, so FreePBX couldn't connect to it (Access denied) and failed from there. Correctly creating the DB fixed the issue
You are missing the point man. After a few changes made since the issue created, the code successfuly installs freepbx. I mean At First installation DB created, we set all the settings. But after reboot, all the settings gone and logs say initial installation starting...
So an update....if I use embedded DB setting then the installation runs absolutely fine. When I set embedded DB to false and turn on the debug log. There is a SQL error that seems to be the cause of the problem with using an external DB:
Assuming you are Database Root
Checking if SELinux is enabled...Its not (good)!
Reading /etc/asterisk/asterisk.conf...Done
Checking if Asterisk is running and we can talk to it as the 'asterisk' user...Yes. Determined Asterisk version to be: 16.7.0
Checking if NodeJS is installed and we can get a version from it...Yes. Determined NodeJS version to be: 10.19.0
Preliminary checks done. Starting FreePBX Installation
Checking if this is a new install...Yes (No /etc/freepbx.conf file detected)
Database Root installation checking credentials and permissions..Connected!
In utility.functions.php line 120:
SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'172.17.0.1' (u
sing password: YES)::SQLSTATE[HY000] [1045] Access denied for user 'freepbx
user'@'172.17.0.1' (using password: YES)
In Database.class.php line 140:
SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'172.17.0.1' (u
sing password: YES)
install [--dbengine DBENGINE] [--dbname DBNAME] [--dbhost DBHOST] [--cdrdbname CDRDBNAME] [--dbuser DBUSER] [--dbpass DBPASS] [--user USER] [--group GROUP] [--dev-links] [--skip-install] [--webroot WEBROOT] [--astetcdir ASTETCDIR] [--astmoddir ASTMODDIR] [--astvarlibdir ASTVARLIBDIR] [--astagidir ASTAGIDIR] [--astspooldir ASTSPOOLDIR] [--astrundir ASTRUNDIR] [--astlogdir ASTLOGDIR] [--ampbin AMPBIN] [--ampsbin AMPSBIN] [--ampcgibin AMPCGIBIN] [--ampplayback AMPPLAYBACK] [-r|--rootdb] [-f|--force]
+ '[' '!' -f /tmp/state/99-container-init ']'
+ print_debug 'Checking to see if container initialization scripts have completed'
+ '[' '!' -f /tmp/state/99-container-init ']'
+ output_off
+ '[' TRUE = TRUE ']'
+ print_debug 'Checking to see if container initialization scripts have completed'
+ set +x
+ output_off
+ '[' TRUE = TRUE ']'
+ set +x
[45m[DEBUG][49m /run/s6/services/03-cron/run ** [cron] Checking to see if container initialization scripts have completed
[45m[DEBUG][49m /run/s6/services/02-zabbix/run ** [zabbix] Checking to see if container initialization scripts have completed
1
1
+ [[ FALSE = \F\A\L\S\E ]]
+ cat
+ '[' '!' -f /usr/sbin/fwconsole ']'
+ print_error 'Can'\''t seem to locate /usr/sbin/fwconsole.. Exitting'
+ output_off
+ '[' TRUE = TRUE ']'
+ set +x
+ exit 1
[101m[ERROR][49m /etc/cont-init.d/10-freepbx ** [freepbx] Can't seem to locate /usr/sbin/fwconsole.. Exitting
[cont-init.d] 10-freepbx: exited 1.
[cont-init.d] 99-container: executing...
+ for s in /assets/functions/*
+ source /assets/functions/01-permissions
++ DEBUG_PERMISSIONS=FALSE
++ ENABLE_PERMISSIONS=FALSE
+ for s in /assets/functions/*
+ source /assets/functions/02-zabbix
++ ENABLE_ZABBIX=TRUE
++ ZABBIX_LOGFILE=/var/log/zabbix/zabbix_agentd.log
++ ZABBIX_LOGFILESIZE=1
++ ZABBIX_DEBUGLEVEL=1
++ ZABBIX_REMOTECOMMANDS=1
++ ZABBIX_REMOTECOMMANDS_LOG=1
++ ZABBIX_SERVER=0.0.0.0/0
++ ZABBIX_LISTEN_PORT=10050
++ ZABBIX_LISTEN_IP=0.0.0.0
++ ZABBIX_START_AGENTS=2
++ ZABBIX_SERVER_ACTIVE=zabbix-proxy
++ ZABBIX_HOSTNAME=debian.stretch
++ ZABBIX_REFRESH_ACTIVE_CHECKS=120
++ ZABBIX_BUFFER_SEND=5
++ ZABBIX_BUFFER_SIZE=100
++ ZABBIX_MAXLINES_SECOND=20
++ ZABBIX_ALLOW_ROOT=1
++ ZABBIX_USER=zabbix
+ for s in /assets/functions/*
+ source /assets/functions/03-cron
++ ENABLE_CRON=TRUE
+ for s in /assets/functions/*
+ source /assets/functions/04-smtp
++ DEBUG_SMTP=FALSE
++ ENABLE_SMTP=TRUE
++ SMTP_HOST=postfix-relay
++ SMTP_PORT=25
++ SMTP_DOMAIN=docker
++ SMTP_MAILDOMAIN=example.org
++ SMTP_TLS=off
++ SMTP_STARTTLS=off
++ SMTP_TLSCERTCHECK=off
++ DEBUG_SMTP=FALSE
+ for s in /assets/functions/*
+ source /assets/functions/10-freepbx
++ ADMIN_DIRECTORY=/admin
++ DB_PORT=3307
++ ENABLE_FAIL2BAN=TRUE
++ ENABLE_FOP=TRUE
++ ENABLE_XMPP=FALSE
++ FOP_DIRECTORY=/fop
++ HTTP_PORT=80
++ HTTPS_PORT=443
++ RTP_FINISH=20000
++ RTP_START=18000
++ UCP_FIRST=TRUE
++ WEBROOT=/var/www/html
+ '[' '' '!=' FALSE ']'
+ output_off
+ '[' TRUE = TRUE ']'
+ set +x
**********************************************************************************************************************
**********************************************************************************************************************
**** ****
**** ERROR - Some initialization scripts haven't completed - All services are now halted ****
**** - The following scripts in '/etc/cont-init.d' did not pass their completion check ****
**** ****
**********************************************************************************************************************
**********************************************************************************************************************
10-freepbx
**********************************************************************************************************************
**********************************************************************************************************************
**** ****
**** This could have happened for a variety of reasons. Please make sure you have followed the README ****
**** relating to this image and have proper configuration such as environment variables and volumes set ****
**** ****
**** If you feel that you have encountered a bug, please submit an issue on the revision control system ****
**** and provide full debug logs by setting the environment variable 'DEBUG_MODE=TRUE' ****
**** ****
**********************************************************************************************************************
**********************************************************************************************************************
[cont-init.d] 99-container: exited 1.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
Specifically:
In utility.functions.php line 120:
SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'172.17.0.1' (u
sing password: YES)::SQLSTATE[HY000] [1045] Access denied for user 'freepbx
user'@'172.17.0.1' (using password: YES)
In Database.class.php line 140:
SQLSTATE[HY000] [1045] Access denied for user 'freepbxuser'@'172.17.0.1' (u
sing password: YES)
Are you able to go into the container and try mysql -u$DB_USER -h$DB_HOST -p$DB_PASS
and see if you are able to connect at all? If so, try a use (yourdatabasename);
and then after that just see if you can perform even the most basic of operations such as show tables;
Thanks, I found the issue through trying to connect to the DB from inside the container as you suggested.
It appears the command does not specify the DB port, my container is not using the default MariaDB SQL port because I have 10 other DB instances running. Your docker container allows a DB port environment variable to be set but it appears the command being invoked here does not make use of it.
I just took a quick look at the Freepbx install routines and they do not include an ability to use a different port. This is occurring in this file: /usr/src/freepbx/installlib/installcommand.class.php
I'm sure there would be around it but would potentially be a cat and mouse game tracking their source changes which seem to be happening more than they need to be as they prepare for PHP 7.x compatibility and version 16.
Hmm it appears if you don't want to use default values provided by freepbx you can set values in CDR DB conf file. Would that be a work around?
EDIT: Nvm, I ended up swapping ports with my other DB container, since the application was friendly to changes and it was easy. Maybe this caveat should be documented for anyone else that may potentially run into this error...
Sadly not. That's actually the big hack that I am doing in this image. It's originally intended to be two databases - quite odd that the CDRDB is referencing a port yet the main freepbx database does not support it. I could have sworn 2 years ago we were using this with different port numbers, but I may be getting confused with another one.I suppose what you might be able to do is setup a temporary copy with a db container on the same host, export it and reimport it into your remote server then by changing the environment variables. It's hackish, but would probably work as I write the DB Connection strings on each container start - It's just the install script which is our issue here.
Seems that someone has submitted a PR to Freepbx for custom DB Ports - Let's see if they accept it. https://github.com/FreePBX/framework/pull/72
Thanks for all your hard work! I hope that PR gets merged.
Good step but Will this fix this issue about no data after restart...
I made a fresh install today. Here is my log with DEBUG ..... ++ UCP_FIRST=TRUE ++ WEBROOT=/var/www/html + '[' '' '!=' FALSE ']'
ERROR - Some initialization scripts haven't completed - All services are now halted - The following scripts in '/etc/cont-init.d' did not pass their completion check
This could have happened for a variety of reasons. Please make sure you have followed the README relating to this image and have proper configuration such as environment variables and volumes set
If you feel that you have encountered a bug, please submit an issue on the revision control system and provide full debug logs by setting the environment variable 'DEBUG_MODE=TRUE'
[cont-init.d] 99-container: exited 1. [cont-init.d] done. [services.d] starting services [services.d] done.
Send me the whole thing privately to my email please - My email is in the changelog.
Any Updates? I'm having the same issue with :14 and :15 I tried :15 with and without external DB. Same error every time.
Send me your logs with DEBUG_MODE=TRUE to my private email and I will analyze.
The install log or the startup log with debug enabled? @tiredofit
Both if possible, also include any startup commands or your docker compose and Host Operating system info.
You got my message @tiredofit ?
Yes I did see it this morning - replied earlier on today privately.If you didn't receive let me know and I'll post here the full contents.
Takeaway though is for the time being is try to SKIP_SANITY_CHECK=TRUE
in your environment variables to skip that section as your install is working without issue. I am diagnosing why it's failing and have decided to rebuild some of the core base images first.
New version tiredofit/freepbx:15-4.0.0
should give you much better success.
Here is the log: [....] Starting authentication failure monitor: fail2banWARNING 'failregex' not defined in 'Definition'. Using default one: '' WARNING 'failregex' not defined in 'Definition'. Using default one: '' . ok [cont-init.d] 05-fail2ban: exited 0. [cont-init.d] 08-mongodb: executing... [cont-init.d] 08-mongodb: exited 0. [cont-init.d] 09-mariadb: executing... [cont-init.d] 09-mariadb: exited 0. [cont-init.d] 10-freepbx: executing... ### /var/run/s6/etc/cont-init.d/10-freepbx: line 30: db_check: command not found [NOTICE] [freepbx] Creating Default Configuration Files [NOTICE] [freepbx] Setting File Permissions [INFO] [freepbx] New Install Detected - Please wait while we fetch FreePBX - Will take 3 to 30 minutes! [NOTICE] [freepbx] Starting Asterisk 16.7.0 for the first time [NOTICE] ** [freepbx] Installing FreePBX source code
[ERROR] ** [freepbx] Can't seem to locate /usr/sbin/fwconsole.. Exitting
[cont-init.d] 10-freepbx: exited 1. [cont-init.d] 99-container: executing...
ERROR - All scripts have not initialized properly - All services are now halted * - Please enter the container find out why the missing -init state file hasn't been written **
/etc/cont-init.d: 00-timezone 01-permissions 02-zabbix 03-cron 04-smtp 05-fail2ban 08-mongodb 09-mariadb 10-freepbx
/tmp/state: /tmp/state/00-timezone-init /tmp/state/01-permissions-init /tmp/state/02-zabbix-init /tmp/state/03-cron-init /tmp/state/04-smtp-init /tmp/state/05-fail2ban-init /tmp/state/08-mongodb-init /tmp/state/09-mariadb-init