mautic/docker-mautic

Cannot acces 'app/config/local.php'

sr-verde opened this issue · 8 comments

Mautic in Docker does not start. Here is the log:

mautic_1      | MySQL Database Created
mautic_1      | ========================================================================
mautic_1      | 
mautic_1      | This server is now configured to run Mautic!
mautic_1      | The following information will be prefilled into the installer (keep password field empty):
mautic_1      | Host Name: mysql
mautic_1      | Database Name: mautic
mautic_1      | Database Username: mautic
mautic_1      | Database Password: xxxxxxx
mautic_1      | 
mautic_1      | Writing initial Mautic config
mautic_1      | 
mautic_1      | Warning: file_put_contents(/var/www/html/app/config/local.php): failed to open stream: No such file or directory in /makeconfig.php on line 46
mautic_1      | 
mautic_1      | Could not write configuration file to /var/www/html/app/config/local.php, you can create this file with the following contents:
mautic_1      | 
mautic_1      | <?php
mautic_1      | $parameters = array (
mautic_1      |   'db_driver' => 'pdo_mysql',
mautic_1      |   'install_source' => 'Docker',
mautic_1      |   'db_host' => 'mysql',
mautic_1      |   'db_name' => 'mautic',
mautic_1      |   'db_user' => 'mautic',
mautic_1      |   'db_password' => 'xxxxxxx',
mautic_1      |   'trusted_proxies' => 
mautic_1      |   array (
mautic_1      |     0 => '0.0.0.0/0',
mautic_1      |   ),
mautic_1      |   'default_timezone' => 'UTC',
mautic_1      | );
mautic_1      | 
mautic_1      | chown: cannot access 'app/config/local.php': No such file or directory

Thats my docker-compose:

  mautic:
    image: mautic/mautic:latest
    restart: always
    depends_on:
      - mysql
    environment:
      - MAUTIC_DB_HOST=mysql
      - MAUTIC_DB_USER=mautic
      - MAUTIC_DB_PASSWORD=xxxxxx
      - MAUTIC_DB_NAME=mautic
      - MAUTIC_RUN_CRON_JOBS="true"
      - MAUTIC_TRUSTED_PROXIES=0.0.0.0/0
    networks:
      - default

  mysql:
    image: mariadb:latest
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: xxxxxx
    volumes:
      - ./mariadb/db-init:/docker-entrypoint-initdb.d
      - ./mariadb/data:/var/lib/mysql

I too am having this exact issue. How can we get a modern version of the docker-compose file, since this is a version 1.0 file and compatibility is going back to 2017.

This problem seems to be caused by commit 7c8432d that updated the if-condition which checks whether the sources have already been copied to /var/www/html/. The new condition fails to evaluate to true if both files are missing.

I will prepare a pull request to propose a fix for the problem tonight.

Thanks, @cboehme.

@sr-verde running on osx?

No, running on Alpine Linux.

# uname -a
Linux radler 4.19.80-0-virt #1-Alpine SMP Fri Oct 18 11:51:24 UTC 2019 x86_64 Linux
# cat /etc/alpine-release 
3.10.3

Thanks for fixing!

I´m building new image on Dockerhub ;)

Hi @luizeof ,

I also encountered this issue and wanted to fix but found this thread.

Instead of doing a rollback of 7c8432d, can't we have both the fix and original "code quality improvement" ?
Something like this :

if ! [ -e index.php ] && ! [ -e app/AppKernel.php ]; then

See #138