FreePBX / sng_freepbx_debian_install

FreePBX 17 Installation Script
109 stars 42 forks source link

[bug]: Apache & freepbx services order #114

Closed JoseGoncalves closed 3 weeks ago

JoseGoncalves commented 1 month ago

FreePBX Version

FreePBX 17

Issue Description

In the FreePBX 17 install script I see this snippet:

# Make sure that the apache service start after freepbx service is started
if [ -e "/lib/systemd/system/apache2.service" ]; then
    if [ -e "/lib/systemd/system/freepbx.service" ]; then
        is_fpbx_pres=$(grep -nr "freepbx.service" /lib/systemd/system/apache2.service | wc -l)

        if [ $is_fpbx_pres -eq 0 ]; then
            sed -i '/After=/s/$/ freepbx.service/' /lib/systemd/system/apache2.service
        fi
    fi
fi

that changes the apache2.service file to force apache2.service to start after the freepbx.service.

Nevertheless, in freepbx.service file shipped in the freepbx17 package, there is this:

[Unit]
Description=FreePBX VoIP Server
After=mariadb.service
After=httpd.service
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/fwconsole start
ExecStop=/usr/sbin/fwconsole stop

[Install]
WantedBy=multi-user.target

which is to configure for the freepbx.service to start after httpd.service .

httpd.service does not exist in Debian (is a CentOS service), so that is another issue, but the reason why I raised this issue is to know in which order do the FreePBX team want do enforce the start of apache and freepbx services?

What makes sense to me is that freepbx.service is started after apache2.service.

If that is also the FreePBX team understanding, the previous install script's snippet should be removed and the freepbx.service file shipped in the freepbx17 package should be corrected, to replace httpd.service with apache2.service.

Operating Environment

Debian 12 freepbx17 17.1-1.sng12

Relevant log output

No response

kguptasangoma commented 1 month ago

Good point @JoseGoncalves

Yes httpd should replace with apache2 so modified the freepbx spec file.

After=apache2.service

We have seen the issues where both apache2 and freepbx was trying to start at the same time which was causing issue in apache2 specially in low footprint memory systems.

as Centos we were using logic of starting freepbx after httpd so i think we can go in the same path i.e. start the apache2 first and then freepbx.

Once I publish the new freepbx rpm, then will modify the script. thanks