salesagility / SuiteCRM-Core

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
174 stars 119 forks source link

Bitnami Azure Marketplace - Cron setup not working with official instructions #369

Open DBRenny opened 10 months ago

DBRenny commented 10 months ago

Issue

When following the bitnami setup guide, daemon cron seems to run successfully when inspecting system logs, but no suiteCRM cron jobs are actually ran.

Expected Behavior

Cron.php should run successfully with the referenced commands in installation documentation. Particularly for Bitnami implementations on azure marketplace.

Actual Behavior

The linux system logs shows daemon running, but it doesn't actually log in the scheduler.

Could not open input file: /opt/bitnami/suitecrm/cron.php PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /bitnami/suitecrm/vendor/javanile/php-imap2/bootstrap.php on line 1217 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /bitnami/suitecrm/vendor/javanile/php-imap2/src/Message.php on line 419 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /bitnami/suitecrm/vendor/javanile/php-imap2/bootstrap.php on line 1217 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /bitnami/suitecrm/vendor/javanile/php-imap2/bootstrap.php on line 1217 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /bitnami/suitecrm/vendor/javanile/php-imap2/bootstrap.php on line 1217 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /bitnami/suitecrm/vendor/javanile/php-imap2/bootstrap.php on line 1217 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in /bitnami/suitecrm/vendor/javanile/php-imap2/bootstrap.php on line 1217 PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 PHP Fatal error: Uncaught mysqli_sql_exception: Connection refused in /bitnami/suitecrm/public/legacy/include/database/MysqliManager.php:326 Stack trace:

0 /bitnami/suitecrm/public/legacy/include/database/MysqliManager.php(326): mysqli_connect()

1 /bitnami/suitecrm/public/legacy/include/database/DBManagerFactory.php(157): MysqliManager->connect()

2 /bitnami/suitecrm/public/legacy/include/entryPoint.php(205): DBManagerFactory::getInstance()

3 /bitnami/suitecrm/public/legacy/cron.php(48): require_once('...')

4 {main}

thrown in /bitnami/suitecrm/public/legacy/include/database/MysqliManager.php on line 326 PHP Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, function "send_record_notification_suitemob" not found or invalid function name in /bitnami/suitecrm/public/legacy/modules/SchedulersJobs/SchedulersJob.php:529 Stack trace:

0 /bitnami/suitecrm/public/legacy/include/SugarQueue/SugarCronJobs.php(191): SchedulersJob->runJob()

1 /bitnami/suitecrm/public/legacy/include/SugarQueue/SugarCronJobs.php(233): SugarCronJobs->executeJob()

2 /bitnami/suitecrm/public/legacy/cron.php(100): SugarCronJobs->runCycle()

3 {main}

thrown in /bitnami/suitecrm/public/legacy/modules/SchedulersJobs/SchedulersJob.php on line 529

Possible Fix

This crontab configuration worked for me, running as bitnami user:

sudo crontab -e

          • sudo -u daemon bash -c "/opt/bitnami/php/bin/php -f /bitnami/suitecrm/public/legacy/cron.php >> /bitnami/suitecrm/logs/cron_output.log 2>&1"

`

Steps to Reproduce

  1. Launch Bitnami on azure: https://bitnami.com/stack/suitecrm/cloud/azure
  2. Inspect system logs
  3. Trace error by adding log output: * * * * * sudo -u daemon /opt/bitnami/php/bin/php -f /bitnami/suitecrm/public/legacy/cron.php >> /path/to/logfile.log 2>&1 5.See empty scheduler logs

Context

Your Environment

SuiteCRM Version used: 8.4 Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Environment name and version: PHP 8.1.24, MariaDB 11.0.3 ------> max supported version is 10.6, potential issue? Debian GNU/Linux 11 (bullseye)

Related Community issue: https://community.suitecrm.com/t/bitnami-suitecrm-8-3-issue-running-scheduled-jobs-works-in-ssh-cli/89920/2

chris001 commented 10 months ago

Your error log shows an out of memory error while using the default 256MB memory limit (PHP Fatal error: Allowed memory size of 268435456 bytes exhausted). Assuming you're using the bitnami docker image, would you edit your docker-compose.yml and add this line to your environment section: PHP_MEMORY_LIMIT = 512M as shown here, then restart your bitnami container or reboot your instance.

DBRenny commented 10 months ago

@chris001 - I actually want to go back and organize it with docker, using azure devops,- but I started this project by just clicking the orange/red button on this site: https://bitnami.com/stack/suitecrm/cloud/azure

It may be a bug for Bitnami, not SuiteCRM - given the error... I still don't know enough to understand why my patch works, and how that reconciles with the error output in my environment. I landed on the fix after a lot of trial and error.

image

I edited the initial report to specify "Azure Marketplace".

johnM2401 commented 9 months ago

Hey @DBRenny !

Have you noticed any subsequent issues after using your modified Cron job line?


I've given cron/scheduled jobs a brief test locally for Suite8, and it appears to be working well. (Although this is on localhost, and not through an Azure/Bitnami image)


I'm not too well versed in Azure/Bitnami, but it appears as though running as Bash may be the expected way of doing it.

According to their docs, for suitecrm: https://docs.bitnami.com/virtual-machine/apps/suitecrm/configuration/configure-scheduler/

They suggest something in the format of: * * * * * su daemon -s /bin/sh -c "cd /opt/bitnami/suitecrm; /opt/bitnami/php/bin/php -f cron.php > /dev/null 2>&1"

Perhaps this format is worth a try? (unless you have already come across this?)

Thanks!