prestashop-flashlight icon indicating copy to clipboard operation
prestashop-flashlight copied to clipboard

`docker compose up` leads to `prestashop-1 | cp: can't stat '/var/opt/prestashop/settings.inc.php': No such file or directory`

Open alisamie97 opened this issue 1 year ago • 3 comments

I tried to run docker compose up in all example directories, it works only if I don't want to map the root directory of prestashop to my host machine. If I map the modules directory it's fine, but in the example for developing prestashop when I run docker compose up it returns this error prestashop-1 | cp: can't stat '/var/opt/prestashop/settings.inc.php': No such file or directory. When I remove the volume mapping configuration from the docker compose file, it resolves the error and the container gets running properly

volumes:
      - ..:/var/www/html:rw

alisamie97 avatar Jul 26 '24 08:07 alisamie97

Hi Alie, thank you for reaching out. What version of Flashlight do you use? (image tagname and id please)

This must be tied to this specific lines of code from PrestaShop Flashlight: cp /var/opt/prestashop/settings.inc.php "$PS_16_CONFIG_PARAMETERS"

cdesiles avatar Aug 16 '24 18:08 cdesiles

Seems to work as expected on the latest version of Flashlight:

❯ docker compose up prestashop --force-recreate
[+] Running 3/2
 ✔ Network flashlight-develop-prestashop_default         Created                                                                                                                   0.0s 
 ✔ Container flashlight-develop-prestashop-mysql-1       Created                                                                                                                   0.1s 
 ✔ Container flashlight-develop-prestashop-prestashop-1  Created                                                                                                                   0.0s 
Attaching to prestashop-1
prestashop-1  | * Applying PS_DOMAIN (localhost:8000) to the dump...
prestashop-1  | * Checking MySQL connectivity...
prestashop-1  | * PHP PDO connectivity checked
prestashop-1  | * Editing PrestaShop configuration...
prestashop-1  | ⚠ Warning: PrestaShop config file not found, using our backup plan!
prestashop-1  | * PrestaShop MySQL configuration set
prestashop-1  | * Blackfire disabled
prestashop-1  | * Restoring MySQL dump...
prestashop-1  | * MySQL dump restored!
prestashop-1  | * Running init-script(s)...
prestashop-1  |   --> Running /tmp/init-scripts/build-assets.sh...
prestashop-1  |   * Download composer dependencies...
prestashop-1  |   COMPOSER_PROCESS_TIMEOUT=600 composer install --no-interaction
prestashop-1  | Installing dependencies from lock file (including require-dev)
prestashop-1  | Verifying lock file contents can be installed on current platform.
prestashop-1  | Package operations: 282 installs, 0 updates, 0 removals
prestashop-1  |   - Downloading composer/installers (v2.2.0)
...

Did you carefully read the readme file of this example? Best,

cdesiles avatar Aug 19 '24 08:08 cdesiles

@jokesterfr Thanks for the reply

Here's the docker-compose.yml from basic example

I just want to have prestashop core files in my host machine to be able to work on them, or work on modules As far as I know it must be simple like this

    volumes:
      - ./prestashop:/var/www/html

Here's what happened just right now, with the latest image, following the readme file on basic example

ali@IdeaPadGaming3:~/Projects/prestashop-flashlight/examples/basic-example$ docker compose up prestashop --force-recreate
[+] Running 35/35
 ✔ prestashop Pulled                                                                                                       78.0s 
   ✔ c6a83fedfae6 Pull complete                                                                                             2.3s 
   ✔ 3ae0d9dfc4da Pull complete                                                                                            65.2s 
   ✔ ce295ca8623e Pull complete                                                                                            65.2s 
   ✔ 60d3eb99f3c1 Pull complete                                                                                            65.3s 
   ✔ 92a72fb3364c Pull complete                                                                                            65.3s 
   ✔ f903a35577be Pull complete                                                                                            65.4s 
   ✔ fea1017fadda Pull complete                                                                                            65.7s 
   ✔ 79d5203ef295 Pull complete                                                                                            65.7s 
   ✔ 2d6f3b18a599 Pull complete                                                                                            65.8s 
   ✔ c1faccbbd188 Pull complete                                                                                            65.8s 
   ✔ b87d356cccc9 Pull complete                                                                                            65.8s 
   ✔ 40bb7c931676 Pull complete                                                                                            65.8s 
   ✔ 9ed5379281e4 Pull complete                                                                                            65.8s 
   ✔ 56dff9337272 Pull complete                                                                                            65.8s 
   ✔ bd65d0e59930 Pull complete                                                                                            65.9s 
   ✔ 6bf819d1c415 Pull complete                                                                                            65.9s 
   ✔ 6e03e4b94fab Pull complete                                                                                            65.9s 
   ✔ 9b41495fc20e Pull complete                                                                                            68.7s 
   ✔ 10d3a31c4279 Pull complete                                                                                            68.7s 
   ✔ 4f4fb700ef54 Pull complete                                                                                            68.7s 
   ✔ 057abb8863fe Pull complete                                                                                            68.7s 
   ✔ de1b43402d3f Pull complete                                                                                            74.2s 
   ✔ b36ad3489241 Pull complete                                                                                            74.2s 
   ✔ 243486fbf256 Pull complete                                                                                            74.2s 
   ✔ 3ae733959149 Pull complete                                                                                            74.2s 
 ✔ mysql Pulled                                                                                                            81.6s 
   ✔ 31e907dcc94a Pull complete                                                                                            54.0s 
   ✔ c2de853d7d08 Pull complete                                                                                            54.0s 
   ✔ 8ac46b953a5b Pull complete                                                                                            54.2s 
   ✔ 2e2490849ad8 Pull complete                                                                                            54.2s 
   ✔ 6e780023d0db Pull complete                                                                                            54.3s 
   ✔ 38677962e42f Pull complete                                                                                            77.8s 
   ✔ a3df71076ea3 Pull complete                                                                                            77.8s 
   ✔ 78970c4c6ca6 Pull complete                                                                                            77.8s 
[+] Running 3/2
 ✔ Network flashlight-basic-example_default         Created                                                                 0.0s 
 ✔ Container flashlight-basic-example-mysql-1       Created                                                                 0.4s 
 ✔ Container flashlight-basic-example-prestashop-1  Created                                                                 0.0s 
Attaching to prestashop-1
prestashop-1  | * Applying PS_DOMAIN (localhost:8000) to the dump...
prestashop-1  | * Checking MySQL connectivity...
prestashop-1  | * PHP PDO connectivity checked
prestashop-1  | * Editing PrestaShop configuration...
prestashop-1  | ⚠ Warning: PrestaShop config file not found, using our backup plan!
prestashop-1  | cp: can't stat '/var/opt/prestashop/settings.inc.php': No such file or directory
prestashop-1 exited with code 1

I just cloned the prestashop flashlight, changed directory to the basic example, added volume mapping on docker compose file, and finally ran the docker compose up command as per the read me file.

Is there anything else I am missing? I'm just following the guides.

alisamie97 avatar Aug 19 '24 15:08 alisamie97

Could you please output the result of this:

docker inspect prestashop/prestashop-flashlight:latest

and:

docker run -it --rm --entrypoint cat prestashop/prestashop-flashlight:latest VERSION

Thank you

cdesiles avatar Aug 21 '24 09:08 cdesiles

Here you are @jokesterfr

Output for this command docker inspect prestashop/prestashop-flashlight:latest

ali@IdeaPadGaming3:~/Projects/prestashop-flashlight/examples/basic-example$ docker inspect prestashop/prestashop-flashlight:latest
[
    {
        "Id": "sha256:a5eb443d8588084a2731114b04bafc2780fa77d8184f859002000d6cfa7ed2e6",
        "RepoTags": [
            "prestashop/prestashop-flashlight:latest"
        ],
        "RepoDigests": [
            "prestashop/prestashop-flashlight@sha256:cb3b23d33ac9752e37f7f371311319273dc142cfcbaa735508feee0e892a6672"
        ],
        "Parent": "",
        "Comment": "buildkit.dockerfile.v0",
        "Created": "2024-08-19T08:57:45.678136698Z",
        "DockerVersion": "",
        "Author": "",
        "Config": {
            "Hostname": "",
            "Domainname": "",
            "User": "www-data",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "ExposedPorts": {
                "80/tcp": {},
                "9000/tcp": {}
            },
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "PHPIZE_DEPS=autoconf \t\tdpkg-dev dpkg \t\tfile \t\tg++ \t\tgcc \t\tlibc-dev \t\tmake \t\tpkgconf \t\tre2c",
                "PHP_INI_DIR=/usr/local/etc/php",
                "PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
                "PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64",
                "PHP_LDFLAGS=-Wl,-O1 -pie",
                "GPG_KEYS=528995BFEDFBA7191D46839EF9BA0ADA31CBD89E 39B641343D8C104B2B146DC3F9C39DC0B9698544 F1F692238FBC1666E5A5CCD4199F9DFEF6FFBAFD",
                "PHP_VERSION=8.1.29",
                "PHP_URL=https://www.php.net/distributions/php-8.1.29.tar.xz",
                "PHP_ASC_URL=https://www.php.net/distributions/php-8.1.29.tar.xz.asc",
                "PHP_SHA256=288884af60581d4284baba2ace9ca6d646f72facbd3e3c2dd2acc7fe6f903536",
                "PS_FOLDER=/var/www/html",
                "COMPOSER_HOME=/var/composer",
                "PHP_ENV=development",
                "MYSQL_HOST=mysql",
                "MYSQL_USER=prestashop",
                "MYSQL_PASSWORD=prestashop",
                "MYSQL_PORT=3306",
                "MYSQL_DATABASE=prestashop",
                "DEBUG_MODE=false",
                "MYSQL_EXTRA_DUMP="
            ],
            "Cmd": null,
            "Healthcheck": {
                "Test": [
                    "CMD-SHELL",
                    "curl -Isf http://localhost:80/admin-dev/robots.txt || exit 1"
                ],
                "Interval": 5000000000,
                "Timeout": 5000000000,
                "StartPeriod": 10000000000,
                "Retries": 10
            },
            "Image": "",
            "Volumes": null,
            "WorkingDir": "/var/www/html",
            "Entrypoint": [
                "/run.sh"
            ],
            "OnBuild": null,
            "Labels": {
                "org.opencontainers.image.created": "2024-08-19T08:18:27.429Z",
                "org.opencontainers.image.description": "PrestaShop Flashlight testing utility",
                "org.opencontainers.image.licenses": "MIT",
                "org.opencontainers.image.source": "https://github.com/PrestaShop/prestashop-flashlight",
                "org.opencontainers.image.title": "PrestaShop Flashlight",
                "org.opencontainers.image.url": "https://hub.docker.com/r/prestashop/prestashop-flashlight"
            },
            "StopSignal": "SIGQUIT"
        },
        "Architecture": "amd64",
        "Os": "linux",
        "Size": 723590701,
        "GraphDriver": {
            "Data": {
                "LowerDir": "/var/lib/docker/overlay2/4c3d65c7bc9c5e0ca31d42cfec1310a65a87444dfb548e4b087e3504de71c934/diff:/var/lib/docker/overlay2/9881e88be2501b4cb3383f09d804188ff2a7bda213162e3337bd9b207921e4c0/diff:/var/lib/docker/overlay2/54e9851d806d1611edc129d2872924e9828b7131ee51b02d480f26ab57640f8f/diff:/var/lib/docker/overlay2/2c827ad74242a4c19779b00b37b04286b18815f4a27ca5fe14924a802f1c8668/diff:/var/lib/docker/overlay2/d6eb1abf0deb3a35fe3cc2b827caa1c40e9cc0eb3367632ee20a6966c12c9d47/diff:/var/lib/docker/overlay2/45b70ca52ca12757cbf2f06879c87a63b1db4fbfcb41b2746038002ae0e8d1c8/diff:/var/lib/docker/overlay2/0dddd5f3b54108edc7a8f087397369174c7ca1b509e31442e0570cccede70799/diff:/var/lib/docker/overlay2/41bf61a49d6397b9c29c69a28e9cc2fbdef70fc57fa2fc5c69686a5ad4c1e028/diff:/var/lib/docker/overlay2/0669ea4d5df8f21c9e1b0d981f3ca17476d19a564f21fb58810bad52dccb7587/diff:/var/lib/docker/overlay2/c4ad4b12134a7da2ff63d05c803fd4e836f70ec2da65f58450144b24508fdca9/diff:/var/lib/docker/overlay2/7fc7a6d8cb45a8dfd0a2952410b12656b235d337e8c4c442b3211cb2304a4aac/diff:/var/lib/docker/overlay2/5c17c8ca9dd2b05f7c24ea0e9a2a291bf40eb028d5f276d41fbc52bb69f35e9b/diff:/var/lib/docker/overlay2/f580bcc1ba7fee743c7fb9c0911148c4edb09f23c6fe5a8031c72e1a6cb3d5f0/diff:/var/lib/docker/overlay2/1bed0ff15ea59b41762948d7ff4ac3d42c272558252da95a7d746712ef7cbd82/diff:/var/lib/docker/overlay2/d0897caecf29d31818b3825e01af874e582ec75894e7bae7fc09d6237f805352/diff:/var/lib/docker/overlay2/e9c6b8d75fc01707aa3e87ea30ab41bb747193dc42858a2ed14309b423c5b84a/diff:/var/lib/docker/overlay2/f0cc3ffb587a4e3d55c1f49bb0cb72a02ba71f9981779048a35c95f6430ed8ce/diff:/var/lib/docker/overlay2/a7817ca2b84934d98734095ac6f3cb04fec92f0482f31471332fdb9c0384c6e5/diff:/var/lib/docker/overlay2/0720b3955286f0f66f33d67b299fc2a8350c240dbb9b4188c99d11f40c719be7/diff:/var/lib/docker/overlay2/b26522f0246d5e54c72731f4b63781e0d3e6767f9b50323d746942bf4b712323/diff:/var/lib/docker/overlay2/85aae2ae02a42a671850606b0bb903037a470bdeeae26d755ec1663c2b34f34b/diff:/var/lib/docker/overlay2/d719de9d832b6638a8967356ddc8313dcdd3cb0bcfa0b47d16f73bc7c5f63877/diff:/var/lib/docker/overlay2/17bfbe6fec873432c13a10c220767bcf4d96fbe56208995a28f169fbfa4931eb/diff:/var/lib/docker/overlay2/f787ccf059e761ecc0c18d3db43e424cddc16e593971c321e347b7284aec5b5f/diff",
                "MergedDir": "/var/lib/docker/overlay2/ded3e21559f3589716f0826bd1e481256cb1dee608e56df19ea2431ad564028f/merged",
                "UpperDir": "/var/lib/docker/overlay2/ded3e21559f3589716f0826bd1e481256cb1dee608e56df19ea2431ad564028f/diff",
                "WorkDir": "/var/lib/docker/overlay2/ded3e21559f3589716f0826bd1e481256cb1dee608e56df19ea2431ad564028f/work"
            },
            "Name": "overlay2"
        },
        "RootFS": {
            "Type": "layers",
            "Layers": [
                "sha256:78561cef0761903dd2f7d09856150a6d4fb48967a8f113f3e33d79effbf59a07",
                "sha256:6331e293fc95c595dbfaf76d075c285a13e1c513ad7f3f5b2a8f25337d67fa9e",
                "sha256:8081158e2862d1dbe98e110fa749e68fb907a21c92652d0120055acbd274ff3b",
                "sha256:44807cdd4189dabb49857c92c2cd5bff1a43b8f1b0c985be9f379b2e61cd9f5d",
                "sha256:90a3be968b47dd7e04c522ea8ea86e4cfe929ba524bf55d54a972cb7b79b8d5d",
                "sha256:fcaa677d07eb218859993c111db07194884148fd9107df06ce8c1dd1842eb90f",
                "sha256:05a473116f2ba9cf6d8b0b1a55d2364a22e29ed5d20de8fdd2775e539bccf45f",
                "sha256:85d78db730ad67cb2eb7599a0bc45c0cb3149b6d82eac3b1dd246b083c09e518",
                "sha256:a451eb7c1e8306972f40c99c6fda0f73cfe0c16fd9c3a8195abd5e4c1ade8f81",
                "sha256:1e0f9fd46ebe31cefb206aec824b6f0707d1e7ad197d176e22a59055dd61196f",
                "sha256:6796aa60e1a18b93a9ed0b1de0ad9f14fe3586aae39bd79cd6e005a5f50cb2ee",
                "sha256:4612eeb1f3588e05e062e3ddd9a287b6147d4e743820ad094ba224011524d57d",
                "sha256:367fb66240d3c57a8944f82bceae15d4cf323a7683c696f2080cba612003be14",
                "sha256:9d2c0c739a899d83ace24b0c1779d9d44bb86794688c6bfb7071c25c3882d6b1",
                "sha256:1e9cecd8f6a74cb31166097e489e8f0545438dbb4dbb200c53f6c3c1fcb20a98",
                "sha256:7099d4e7920fe077de3e87c728acaaee964fc063522f28e2b3609b009734ab57",
                "sha256:590ffb371ec2a4a986a979a2abdb7a1e9d3181496e3c67c6a22bf08210de364f",
                "sha256:0926a904ec7401ef9841167dd056f21a6d913a58250d7285375dac3bf253f4b1",
                "sha256:1fcde1fe469a8da404162bcc95a77dd60787ea854dd5568ccce872d90c9d8bf5",
                "sha256:5f70bf18a086007016e948b04aed3b82103a36bea41755b6cddfaf10ace3c6ef",
                "sha256:2d3426c3b4a0600a929897d818cb206c4c67ece67e2a7f86a3d5e7a8b971254b",
                "sha256:53dbb8f8346d30acdfc6e8bdc3e4b5c8c6250ecf0d81b01d56831e452f5dfcd6",
                "sha256:5490e7ee3d6b974e9ace67431b94a4f613fc3c15f0ea1e46cacf1c84d6daa7b8",
                "sha256:c94fa566bca38b0a28afb9954564c508197a0dc09b753642923164c03c111fea",
                "sha256:ecf4f39202ab6b6e0c87f8f3dd534faa00d0d8782aafdb58c8b5bc4c94529f2c"
            ]
        },
        "Metadata": {
            "LastTagTime": "0001-01-01T00:00:00Z"
        }
    }
]

For this command docker run -it --rm --entrypoint cat prestashop/prestashop-flashlight:latest VERSION

ali@IdeaPadGaming3:~/Projects/prestashop-flashlight/examples/basic-example$ docker run -it --rm --entrypoint cat prestashop/prestashop-flashlight:latest VERSION
PrestaShop 8.1.7
PHP 8.1
Flashlight 2c27886eea22cdd4e5de8814564a48a35a4ce1a3

alisamie97 avatar Aug 21 '24 10:08 alisamie97

Thank you very much. I've to test on a Linux machine, cannot reproduce right now. Tomorrow I'll have my desktop available.

Thank you for your patience,

cdesiles avatar Aug 21 '24 13:08 cdesiles

Got this on my Linux setup:

prestashop-1  | ⚠ Warning: PrestaShop config file not found, using our backup plan!
prestashop-1  | sed: can't create temp file '/var/www/html/app/config/parameters.phpXXXXXX': Permission denied

This seems related to rights dropped to www-data.

cdesiles avatar Aug 29 '24 08:08 cdesiles

The issue is here: https://github.com/PrestaShop/prestashop-flashlight/blob/f8a8e731ac740e32a153a9197322d5507c59733d/assets/run.sh#L110

copying this file will keep the root ownership of the source file, and sed won't be able to customize the settings.

cdesiles avatar Aug 29 '24 09:08 cdesiles

@alisamie97 should be fixed now, can you confirm me this?

cdesiles avatar Sep 02 '24 08:09 cdesiles

@jokesterfr

I made this docker compose file and then ran this command docker compose up

volumes:
  mysql-data:

services:
  mysql:
    image: mysql:8.2.0
    healthcheck:
      test: ["CMD", "healthcheck.sh", "--connect"]
      interval: 10s
      timeout: 10s
      retries: 5
    environment:
      MYSQL_ROOT_PASSWORD: prestashop
      MYSQL_DATABASE: prestashop
    volumes:
      - mysql-data:/var/lib/mysql
  phpmyadmin:
    image: phpmyadmin/phpmyadmin:5.1.2
    environment:
      PMA_ARBITARY: 1
      PMA_HOST: mysql
      PMA_USER: root
      PMA_PASSWORD: prestashop
      UPLOAD_LIMIT: 1024M
      MEMORY_LIMIT: 1024M
      MAX_EXECUTION_TIME: 300
    depends_on:
      - mysql
    ports:
      - 10100:80
  prestashop:
    image: prestashop/prestashop-flashlight:8.1.7
    environment:
      PS_DEV_MODE: 0
      # PS_HOST_MODE: 0
      PS_DEMO_MODE: 0
      DB_SERVER: mysql
      DB_USER: root
      DB_PASSWD: prestashop
      DB_PREFIX: ps_
      DB_NAME: prestashop
      PS_INSTALL_AUTO: 1
      PS_ERASE_DB: 1
      PS_INSTALL_DB: 1
      PS_DOMAIN: localhost:10200
      PS_LANGUAGE: en
      PS_COUNTRY: de
      PS_ALL_LANGUAGES: 0
      # PS_FOLDER_ADMIN: admin
      # PS_FOLDER_INSTALL: install
      # PS_ENABLE_SSL: 0
      ADMIN_MAIL: [email protected]
      ADMIN_PASSWD: dev@examplecom
      # INIT_SCRIPTS_DIR: /tmp/init-scripts
      # INIT_SCRIPTS_USER: root
      XDEBUG_ENABLED: true
    depends_on:
      mysql:
        condition: service_healthy
    volumes:
      - ./PrestaShop:/var/www/html:rw
    ports:
      - 10200:80

and here's the result:

Gracefully stopping... (press Ctrl+C again to force)
dependency failed to start: container meingutscheinmarkt-flashlight-mysql-1 is unhealthy

alisamie97 avatar Sep 11 '24 11:09 alisamie97