Deploying updated code, applying schema updates?

Hi there - I’m new to FreePBX, but not PHP (I’m a Drupal developer, mostly.)

I have been spec’ing out FreePBX and Asterisk for a client and am considering deploying using Docker. I know there is not a specific supported Docker image, however I do see a number of configurations in the wild which utilize this approach. I am to the point where I can successfully install FreePBX and utilize an external database, however I’m stuck on how to effectively deploy updates. My goal would be to not upgrade directly on the production machines, but test upgrades locally, package the working code, and then deploy that code to production and complete any upgrade scripts/schema updates after pushing the tested image with the new code.

The only real upgrade/update paths I see utilize fwconsole or similar to download and apply the upgrades directly; is there a way I could do that in development, committing the resulting code to my repo, and then run just something like an update-db script on production?

You’d first want to disable Module Admin so that users couldn’t go to it (Possible using freepbx_menu.conf) and then also block out updating from fwconsole (possible by changing MODULE_REPO to null).

The database and code updates work hand-in-hand because each module is self contained. So there is no good way to apply the code and then the database later. Some of them require the database to already exist otherwise they will crash. You can apply the code and the run fwconsole ma installlocal which would install whatever is updated locally but you’d have to do this in production.

@tm1000 Thank you very much. So do I correctly interpret “install” in FreePBX terms to be run the module’s install scripts, OR if already enabled, do any updates the module determines to be required moving from version-to-version? I did read through the docs for module_functions::install() but it looks like the only place an upgrade might be handled is by the module’s install.sql file or BMO::install() implementation, where it needs to properly handle existing tables and schema updates and the like?

install.sql is deprecated and no longer used.

BMO::install() is one way, another way you missed is install.php.

There is also module.xml which parses .