Configure MySQL-connection in (SuiteCRM-) Docker-container

On a freshly installed standalone-UCS-system, I installed SuiteCRM via App-Center which deployed a Docker container. During the installation, an instance of MySQL was set up on the host system and SuiteCRM was configured to use this database.

Inside the Docker container, the database connection is configured in /var/www/suitecrm/config.php. I’d like to change that to an external MySQL-host.

I’m not quite familiar with Docker yet, but if I understand correctly, the whole container will be replaced during an update of SuiteCRM. So if I would change the database details that specific file, it would be overwritten during that process.

Is there a preferred way to accomplish my goal? There seem to be no UCR-variables for that.

Thanks in advance!

Hi,

first of all, the suitecrm docker container is configured to use the docker host as database server, so the database is on the actual host not in the container and should survive updates …

But if you want to use a different server as database server, just edit /var/www/suitecrm/config.php accordingly. The /var/www directory in the container is mapped to /var/lib/suitecrm on the docker host. These mappings (or docker volumes) are the preferred mechanism for persisting data in containers (/var/lib/suitecrm is never removed during updates and is always mapped to /var/www in the container).

Best regards,
Felix

Hi Felix!

Thanks for the reply - this was the answer I was looking for!

Is there any way to easily gain access to the database? Looking to drop in some data directly into the mysql database for suitecrm from an external source…

yes, on the Docker host as root

mysql -u root --password="$(< /etc/mysql.secret)" suitecrm

Best regards,
Felix

Mastodon