TheDMSGroup / mautic-eb

Mautic + Elastic Beanstalk = Scalable marketing automation
https://www.mautic.org
GNU General Public License v3.0
105 stars 27 forks source link

How to ensure custom configuration for my project ? #34

Closed Guibod closed 6 years ago

Guibod commented 6 years ago

Hey, I feel confuse with the configuration process, because there are a lot of files involved, both stored on EFS and local EC2 storage. How can I extend the master behavior in my fork by extending the mautic_eb/app/config/parameters_local.php system ? How can I run a reconfiguration from the ENV variable without rebuilding a new EC2 host, or pushing a new eb deploy ?

heathdutton commented 6 years ago

local.php is autogenerated by Mautic, so we use parameters_local.php to override settings that we do not wish for local.php to be able to set. This includes DB credentials and other security stuff. This prevents an admin from blowing things up. In the meantime we still want local.php to be writable (and shared) for all the other settings. We use environment variables in EB to hand over DB credentials (and other settings) to parameters_local.php, these should be mostly listed in the readme. You can set environment variables without complete re-deployment (depending on how you set up EB), but may need to clear cache if you change DB settings (since the contents of local.php are cached in /app/current/mautic/app/cache/*).

Note, this means that all cron/cli tasks must also load those environment variables before running, which is why we made aliases for cron/console/etc to make that easy, otherwise the'll be getting db errors.

All this is to allow the code to stay open and keep credentials from ever being in a file that can be accidentally lost.

Guibod commented 6 years ago

OK, then i'd' like to suggest you to remove the no clobber option (-n) from this installation step:

63_io_efs_create_files:
    leader_only: true
    command: cp -n mautic/app/config/parameters_local.php /efs/mautic/app/config/local.php

This prevent an updated parameters_local.php to reach an already installed environment.

heathdutton commented 6 years ago

Actually it doesn't... that line creates a local.php file (if one doesn't already exist) from parameters_local.php as a temporary measure if you are deploying for the first time. The local.php file must exist in order to prevent the installation UI. The parameters_local.php file is still put into place by composer, this line here is just a one-time measure to avoid the web installation... with that in mind it probably should be in the mautic-install.sh script, not here (to avoid confusion).