izer-xyz / 3cx-docker

3CX PBX Phone System docker image. [ x86_64 | ARM | v18.x ]
MIT License
28 stars 8 forks source link

Persistant Volume Pt.2 ! #14

Closed tonyrking closed 1 year ago

tonyrking commented 2 years ago

thanks again for such great work..

I'm a little confused though, working 'fine' BUT.. there's no definition as to where 3CX is going to save config and setting.

docker run \ -d \ -t \ --name=3cx \ --net=host \ --tmpfs /tmp \ --tmpfs /run \ --tmpfs /run/lock \ -v /sys/fs/cgroup:/sys/fs/cgroup:ro \ ghcr.io/izer-xyz/3cx:latest

(I'm running on Synology host network)

cgroup is read only. So forgive my ignorance, in the setup process it fails as it seems not to be able to save settings. Should I at least be giving a read write defined area for all this to be written to!?

I feel like this is a minor final hurdle then I can finally ditch the VM version! You're awesome!

Screenshot 2022-09-01 at 12 46 33
sinegar commented 2 years ago

There is no persistent volume. Unfortunately, the working directory is created on first run. If it’s already exists the setup fails so can’t be mounted. The parent directory is a common location so it can’t work neither.

You should run regular backups to a persistent volume and the restore can be automated.

In my experience a host reboot isn’t an issue as the same container is run on restart. Upgrade requires a restore from backup.

The screenshot looks like a strange error. When did you get that error? Is it using the wizard? It looks like postgres is not running. Do you have the console output of the container?

tonyrking commented 2 years ago

Indeed.. It does appear to be something with Postgres doesn't it.. the Synology does have a firewall turned on. But all other added dockers work fine.

First run. Configure instance ... Check config tool logs in case of any issues /var/lib/3cxpbx/Data/Logs/PbxConfigTool.log Run WebConfig on port :5015 Created symlink /etc/systemd/system/multi-user.target.wants/setup-3cx.service -> /etc/systemd/system/setup-3cx.service. chown: invalid user: 'phonesystem:phonesystem' Start systemd Failed to create symlink /sys/fs/cgroup/cpuacct: File exists Failed to create symlink /sys/fs/cgroup/cpu: File exists

Welcome to Linux!

Failed to create timezone change event source: No such device or address [ OK ] Started Dispatch Password...s to Console Directory Watch. [ OK ] Reached target Slices. [ OK ] Listening on Journal Socket. [ OK ] Reached target Network is Online. [ OK ] Reached target Paths. [ OK ] Reached target Local Encrypted Volumes. [ OK ] Listening on Journal Socket (/dev/log). Starting Journal Service... [ OK ] Reached target Sockets. [ OK ] Reached target Swap. [ OK ] Reached target Local File Systems. Starting Create System Users... [ OK ] Started Journal Service. Starting Flush Journal to Persistent Storage... [ OK ] Started Flush Journal to Persistent Storage. [ OK ] Started Create System Users. [ OK ] Reached target System Initialization. [ OK ] Started Daily Cleanup of Temporary Directories. [ OK ] Reached target Timers. [ OK ] Reached target Basic System. Starting A high performan...and a reverse proxy server... Starting Setup 3CX... [ OK ] Created slice system-postgresql.slice. Starting PostgreSQL Cluster 11-main... [ OK ] Started A high performanc...r and a reverse proxy server. [ OK ] Started PostgreSQL Cluster 11-main. Starting PostgreSQL RDBMS... [ OK ] Started PostgreSQL RDBMS. [ OK ] Started Setup 3CX. [ OK ] Reached target Multi-User System. [ OK ] Reached target Graphical Interface. systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid) Detected virtualization docker. Detected architecture x86-64. File /lib/systemd/system/systemd-journald.service:12 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling. Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)

tonyrking commented 2 years ago

(And yes, I was going through the setup wizard.. all worked fine till the end when it said 'saving configuration'.

sinegar commented 2 years ago

Would you share the output of these 3 commands?

docker info
docker exec -it [id] sh -c "ps eax"
docker exec -it [id] sh -c "netstat -ln"

Maybe check if these is some errors in the /var/lib/3cxpbx/Data/Logs/PbxConfigTool.log file.

systemd and docker doesn’t like each other much and causes most of the issues but usually it doesn’t work at all.

tonyrking commented 2 years ago

Ok, here we go! Thanks.

netstat.txt pseax.txt docker-info.txt

tonyrking commented 2 years ago

What I'll add is that I know of many Synology users who would love this to work for them. Great job.

tonyrking commented 2 years ago

Tail end of PbxWebConfigTool.log:

2022/09/01 11:52:37.550|Dbg|0034| Starting database service... 2022/09/01 11:52:37.565|Dbg|0034| Database service started successfully 2022/09/01 11:52:37.565|Dbg|0034| Creating database (Single Instance) ... 2022/09/01 11:52:37.565|Dbg|0034| CreateCloudServerManagementDatabase params =
{ "CloudServerManagementDatabase": "masterprofiles", "CloudServerAdminUser": "phonesystem", Password Removed "NetworkInstallation": "NAT", "CloudWebService": "http://localhost:5000/3CXCloudWebService", "Sep": "/", "MailServerHost": "", "MailServerPort": "", "MailServerUseTLS": "", "MailServerUser": "", Password Removed "MailFromAddress": "", "CloudAdminEmail": "", "NotifyServicesDown": "1" }

2022/09/01 11:52:42.591|Dbg|0034| Setup exception System.Exception: Error in CreatingCloudServerManagementDatabase.sql: 28000: no pg_hba.conf entry for host "127.0.0.1", user "phonesystem", database "template1" ---> Npgsql.PostgresException (0x80004005): 28000: no pg_hba.conf entry for host "127.0.0.1", user "phonesystem", database "template1" at Npgsql.NpgsqlConnector.gReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage) at Npgsql.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken) at Npgsql.NpgsqlConnection.<>c__DisplayClass41_0.<gOpenAsync|0>d.MoveNext() --- End of stack trace from previous location --- at Npgsql.NpgsqlConnection.Open() at PostInstall.DBConnection.get_Connection() at PostInstall.DBConnection.ExecuteScript(String sqlQuery, IDictionary2 parameters) at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName) Exception data: Severity: FATAL SqlState: 28000 MessageText: no pg_hba.conf entry for host "127.0.0.1", user "phonesystem", database "template1" File: auth.c Line: 520 Routine: ClientAuthentication --- End of inner exception stack trace --- at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName) at _3CXCloudDBManager.CloudDBManager.CreateCloudServerManagementDatabase(IDBConnection superuser, CloudServerManagementDatabaseConfiguration configuration) at PostInstall.SetupExecutor.CreateCloudServerManagementDatabase(CloudDBManager cloudDbManager, DBConnection templateConnection) at PostInstall.SetupExecutor.CreateDatabase(Action1 stateChanged) at PostInstall.SetupExecutor.ExecuteSetup(SetupSettings setupSettings, Action1 stateChanged, Action1 errorNotifier) 2022/09/01 11:52:42.594|Dbg|0034| CreatePbxInternal completed. result = { "Success": false, "ServerProcessSetupOperation": false, "ManagementConsoleHttpsUrl": null, "UserName": null, Password Removed "ManagementConsoleIpUrl": null, "HostnameOrFullFqdn": null, "PublicIp": null, "Fqdn": null, "LicenseKey": null, "ErrorMessage": "System.Exception: Error in CreatingCloudServerManagementDatabase.sql: 28000: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n ---> Npgsql.PostgresException (0x80004005): 28000: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n at Npgsql.NpgsqlConnector.gReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)\n at Npgsql.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlConnection.<>c__DisplayClass41_0.<gOpenAsync|0>d.MoveNext()\n--- End of stack trace from previous location ---\n at Npgsql.NpgsqlConnection.Open()\n at PostInstall.DBConnection.get_Connection()\n at PostInstall.DBConnection.ExecuteScript(String sqlQuery, IDictionary2 parameters)\n at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName)\n Exception data:\n Severity: FATAL\n SqlState: 28000\n MessageText: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n File: auth.c\n Line: 520\n Routine: ClientAuthentication\n --- End of inner exception stack trace ---\n at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName)\n at _3CXCloudDBManager.CloudDBManager.CreateCloudServerManagementDatabase(IDBConnection superuser, CloudServerManagementDatabaseConfiguration configuration)\n at PostInstall.SetupExecutor.CreateCloudServerManagementDatabase(CloudDBManager cloudDbManager, DBConnection templateConnection)\n at PostInstall.SetupExecutor.CreateDatabase(Action1 stateChanged)\n at PostInstall.SetupExecutor.ExecuteSetup(SetupSettings setupSettings, Action1 stateChanged, Action1 errorNotifier)\n at PbxWebConfigTool.PbxSetupService.CreatePbxInternal(SetupSettings settings)", "LicenseActivated": false, "SelfSignedCertificatesGenerated": false, "ActivationEmail": null }

2022/09/01 11:52:42.595|Dbg|0034| Create PBX completed, result = { "Success": false, "ServerProcessSetupOperation": false, "ManagementConsoleHttpsUrl": null, "UserName": null, Password Removed "ManagementConsoleIpUrl": null, "HostnameOrFullFqdn": null, "PublicIp": null, "Fqdn": null, "LicenseKey": null, "ErrorMessage": "System.Exception: Error in CreatingCloudServerManagementDatabase.sql: 28000: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n ---> Npgsql.PostgresException (0x80004005): 28000: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n at Npgsql.NpgsqlConnector.gReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)\n at Npgsql.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlConnection.<>c__DisplayClass41_0.<gOpenAsync|0>d.MoveNext()\n--- End of stack trace from previous location ---\n at Npgsql.NpgsqlConnection.Open()\n at PostInstall.DBConnection.get_Connection()\n at PostInstall.DBConnection.ExecuteScript(String sqlQuery, IDictionary2 parameters)\n at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName)\n Exception data:\n Severity: FATAL\n SqlState: 28000\n MessageText: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n File: auth.c\n Line: 520\n Routine: ClientAuthentication\n --- End of inner exception stack trace ---\n at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName)\n at _3CXCloudDBManager.CloudDBManager.CreateCloudServerManagementDatabase(IDBConnection superuser, CloudServerManagementDatabaseConfiguration configuration)\n at PostInstall.SetupExecutor.CreateCloudServerManagementDatabase(CloudDBManager cloudDbManager, DBConnection templateConnection)\n at PostInstall.SetupExecutor.CreateDatabase(Action1 stateChanged)\n at PostInstall.SetupExecutor.ExecuteSetup(SetupSettings setupSettings, Action1 stateChanged, Action1 errorNotifier)\n at PbxWebConfigTool.PbxSetupService.CreatePbxInternal(SetupSettings settings)", "LicenseActivated": false, "SelfSignedCertificatesGenerated": false, "ActivationEmail": null }

2022/09/01 11:52:42.874|Dbg|0025| GetInstallationResult 2022/09/01 11:52:42.876|Dbg|0025| GetInstallationResult result = { "Success": false, "ServerProcessSetupOperation": false, "ManagementConsoleHttpsUrl": null, "UserName": null, Password Removed "ManagementConsoleIpUrl": null, "HostnameOrFullFqdn": null, "PublicIp": null, "Fqdn": null, "LicenseKey": null, "ErrorMessage": "System.Exception: Error in CreatingCloudServerManagementDatabase.sql: 28000: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n ---> Npgsql.PostgresException (0x80004005): 28000: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n at Npgsql.NpgsqlConnector.gReadMessageLong|194_0(NpgsqlConnector connector, Boolean async, DataRowLoadingMode dataRowLoadingMode, Boolean readingNotifications, Boolean isReadingPrependedMessage)\n at Npgsql.NpgsqlConnector.Authenticate(String username, NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlConnector.Open(NpgsqlTimeout timeout, Boolean async, CancellationToken cancellationToken)\n at Npgsql.NpgsqlConnection.<>c__DisplayClass41_0.<gOpenAsync|0>d.MoveNext()\n--- End of stack trace from previous location ---\n at Npgsql.NpgsqlConnection.Open()\n at PostInstall.DBConnection.get_Connection()\n at PostInstall.DBConnection.ExecuteScript(String sqlQuery, IDictionary2 parameters)\n at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName)\n Exception data:\n Severity: FATAL\n SqlState: 28000\n MessageText: no pg_hba.conf entry for host \"127.0.0.1\", user \"phonesystem\", database \"template1\"\n File: auth.c\n Line: 520\n Routine: ClientAuthentication\n --- End of inner exception stack trace ---\n at _3CXCloudDBManager.DbConnectionExtensions.ExecuteScript(IDBConnection connection, Object configurationStructure, String scriptText, Boolean asResourceName)\n at _3CXCloudDBManager.CloudDBManager.CreateCloudServerManagementDatabase(IDBConnection superuser, CloudServerManagementDatabaseConfiguration configuration)\n at PostInstall.SetupExecutor.CreateCloudServerManagementDatabase(CloudDBManager cloudDbManager, DBConnection templateConnection)\n at PostInstall.SetupExecutor.CreateDatabase(Action1 stateChanged)\n at PostInstall.SetupExecutor.ExecuteSetup(SetupSettings setupSettings, Action1 stateChanged, Action1 errorNotifier)\n at PbxWebConfigTool.PbxSetupService.CreatePbxInternal(SetupSettings settings)", "LicenseActivated": false, "SelfSignedCertificatesGenerated": false, "ActivationEmail": null }

root@Synology:/var/lib/3cxpbx/Data/Logs#

sinegar commented 1 year ago

Closing all issues before archiving the project.