Automattic / vip-cli

The VIP CLI
https://docs.wpvip.com/vip-cli/
MIT License
58 stars 16 forks source link

Cannot start environment using recommended docker desktop in Linux #1786

Closed luislard closed 2 months ago

luislard commented 4 months ago

Expected/Desired Behavior

When executing the start command in Linux with docker desktop (as recommended), it works.

vip dev-env start --slug=acme-website

Actual Behavior

I get:

✕ Please contact VIP Support with the following information:
Error: Error: EACCES: permission denied, open '/home/johndoe/.local/share/vip/lando/scripts/add-cert.sh'
    at exports.moveConfig (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/utils.js:165:13)
   at /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:119:32
    at process.processImmediate (node:internal/timers:478:21)
From previous event:
    at bootstrapEngine (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:116:39)
    at bootstrapRouter (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:154:27)
    at /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:310:19
From previous event:
    at /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:310:8
From previous event:
    at Lando.bootstrap (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:255:25)
    at bootstrapLando (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/dist/lib/dev-environment/dev-environment-lando.js:191:17)
    at async /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/dist/bin/vip-dev-env-start.js:22:17
    at async _args.default.argv (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/dist/lib/cli/command.js:444:11)

Steps to Reproduce the Problem

OS: Linux Ubuntu 22.04 Docker desktop: 4.29.0 VIP CLI: 2.39.0

  1. Set docker context to use docker-desktop context
  2. Create a project
    vip dev-env create --app-code="./vip" --slug="acme-website" \
    --title="Acme Website" --php="8.2" \
    --wordpress="6.5" \
    --mu-plugins="demo" \
    --multisite=subdirectory \
    --xdebug \
    --mailpit \
    --phpmyadmin \
    --elasticsearch \
    --photon
  3. Start the project
    vip dev-env start --slug=acme-website

(Optional) Additional notes

Where is the issue?

For some reason, the target folder /home/johndoe/.local/share/vip/lando is owned by docker-desktop uid 100999 and gid 100999. I added created a group docker_share with gid 100999 but still get the error.

➜  acme-website git:(ABC-123) ls -la /home/johndoe/.local/share/vip/lando
total 76
drwxrwxr-x+ 10   100999 docker_share 4096 abr 21 23:42 .
drwxrwxr-x   5 johndoe johndoe     4096 abr 21 23:42 ..
drwxrwxr-x+  2   100999 docker_share 4096 abr 21 23:43 cache
drwxrwxr-x+  2   100999 docker_share 4096 abr 21 23:43 certs
drwxrwxr-x+  3   100999 docker_share 4096 abr 21 23:42 compose
drwxrwxr-x+  3   100999 docker_share 4096 abr 21 23:42 config
drwxrwxr-x+  3   100999 docker_share 4096 abr 21 23:42 home
drwxrwxr-x+  2   100999 docker_share 4096 abr 21 23:42 keys
drwxrwxr-x+  3   100999 docker_share 4096 abr 21 23:42 proxy
drwxrwxr-x+  2   100999 docker_share 4096 abr 21 23:42 scripts

The issue is entering here in the lando-core utils file.

The problem is that the node process is running by the host johndoe but the script is trying to do some file operations in files owned by 100999:100999.

I tried using setfacl like this:

sudo setfacl -Rm u:johndoe:rwx /home/johndoe/.local/share/vip/lando
sudo setfacl -Rdm u:johndoe:rwx /home/johndoe/.local/share/vip/lando

sudo setfacl -Rm g:johndoe:rwx /home/johndoe/.local/share/vip/lando
sudo setfacl -Rdm g:johndoe:rwx /home/johndoe/.local/share/vip/lando

That solved the first problem, now the process can open the files, but since the script tries to chmod here the operation is giving a new error:

✕ Please contact VIP Support with the following information:
Error: Error: EPERM: operation not permitted, chmod '/home/johndoe/.local/share/vip/lando/scripts/add-cert.sh'
    at exports.moveConfig (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/utils.js:167:13)
    at /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:119:32
    at process.processImmediate (node:internal/timers:478:21)
From previous event:
    at bootstrapEngine (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:116:39)
    at bootstrapRouter (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:154:27)
    at /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:310:19
From previous event:
    at /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:310:8
From previous event:
    at Lando.bootstrap (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/node_modules/lando/lib/lando.js:255:25)
    at bootstrapLando (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/dist/lib/dev-environment/dev-environment-lando.js:191:17)
    at async /home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/dist/bin/vip-dev-env-destroy.js:23:17
    at async _args.default.argv (/home/johndoe/.nvm/versions/node/v20.12.1/lib/node_modules/@automattic/vip/dist/lib/cli/command.js:444:11)
github-actions[bot] commented 2 months ago

This issue has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed.

This is an automation to keep issues manageable and actionable and is not a comment on the quality of this issue nor on the work done so far. Closed issues are still valuable to the project and are available to be searched.