Search code examples
mysqldockercoldfusiondocker-composemura

Mura CMS / Docker Compose Connect to Database


I am running a Mura CMS instance with docker compose (using config/docker/local-mysql/docker-compose.yml) and getting the following error:

500 Error

Error Executing Database Query.

Datasource:nodatabase

SQL:SELECT IF('muradb' IN(SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA), 1, 0) AS found 

Code:n/a

Type:Database

Timed out trying to establish connection

Here is a copy of my Docker-compose.yml, which is the standard yml file Blue River distributes with Mura. It hasn't be modified other than the change from port 8080 to port 80.

version: '2.1'

services:
  #Mura Server
  mura_mysql_cfml:
    image: ortussolutions/commandbox:latest
    environment:
      PORT: 80
      SSL_PORT: 8443
      CFENGINE: adobe@2016
      CFCONFIG_ADMINPASSWORD: NOT_SECURE_CHANGE
      MURA_ADMIN_USERNAME: admin
      MURA_ADMIN_PASSWORD: admin
      MURA_ADMINEMAIL: example@localhost.com
      MURA_APPRELOADKEY: appreload
      MURA_DATASOURCE: muradb
      MURA_DATABASE: muradb
      MURA_DBTYPE: mysql
      MURA_DBUSERNAME: root
      MURA_DBPASSWORD: NOT_SECURE_CHANGE
      MURA_DBHOST: mura_mysql
      MURA_DBPORT: 3306
      MURA_SITEIDINURLS: "false"
      MURA_INDEXFILEINURLS: "false"
      MURA_TESTBOX: "true"
    volumes:
        - ../../../:/app
    ports:
        - "80:80"

  #MySQL
  mura_mysql:
    image: mysql:latest
    environment:
        MYSQL_ROOT_PASSWORD: NOT_SECURE_CHANGE
        MYSQL_DATABASE: muradb
    volumes:
        - mura_mysql_data:/var/lib/mysql
    ports:
        - "55555:3306"

volumes:
    mura_mysql_data:

Any ideas of what may be going wrong?


Solution

  • Your issue is where you've modified the ports in your docker-compose.yml file.

    The left side is the host ... or your local machine. The right side is the container's network port, which you shouldn't change. So, under the mura_mysql_cfml service try:

    ports:
        - "80:8080"
    

    Also, under the environment: setting, I would ommit the PORT: 80 environment variable altogether. The reason is because that port isn't exposed in the underlying Docker image.


    EDIT:

    Also, I just noticed you're not using the default image. This is critical! The image you're attempting to use doesn't even have Mura CMS in it. Which means you would have to supply it, or mount it as a volume into the /app directory.

    Coincidentally, I'm working on putting together some example images, and docker-compose.yml files for users such as yourself. It's still being worked on, but I think you should take a look at the repository anyway: https://github.com/blueriver/docker-muracms

    Hope this helps!