sfx101 / deck

DECK is a powerful and high performant local web development studio, an open source alternative to Docker desktop
https://github.com/deck-app
GNU Affero General Public License v3.0
1.51k stars 71 forks source link

Nginx + PHP new files are created as root #71

Closed roke22 closed 2 years ago

roke22 commented 2 years ago

Hello, The nginx service is running with the nobody user but the commands you execute from the Deck console are with root user. For example "composer install" so the vendor directory is with root permissions.

I can not execute "composer install" from my computer because the php version is different. Can you modify to execute with the nobody user or at leas run the nginx service and the console shell with the same user and sync with the USER_ID.

image

Thank you.

nabad600 commented 2 years ago

Hi @roke22 , Thanks for using DECK Application, can you run "composer install" from DECK console as a root user and change the permission "chmod -R nobody:nobody /var/www/" from the deck console

Let us know of any issues, we'd be happy to help.

Thanks you

roke22 commented 2 years ago

Hello @nabad600 , The idea is to be transparent when you upload or create new files. I try to fix as far as i can, you can see on the pull request https://github.com/deck-app/nginx-stack/pull/1

Now you must change the user you are using to execute the command to "myuser" and launch the ssh terminal with "myuser" too.

If you need help i can help you to do it.

Thank you.

nabad600 commented 2 years ago

Hi @roke22 , The idea is good, but we are already implement nginx or apache user.

Let us know of any issues, we'd be happy to help.

Thanks you

roke22 commented 2 years ago

Hello @nabad600 , Just little errors to fix so you can improve the coding enviroment for all users.

if you try to connect visual code with the container (using remote containers extension) you get a permission error.

image

That is because user "nobody" has no home directory with permissions, maybe add a "/home/nobody" folder with write permissions to fix the issue.

In the laravel container the installation comes with the package-lock.json file with root permissions. I suppose that is writed by the deck application.

Same thing happens with the nginx + php container trying to connect the visual code to the remote container.

Steps to reproduce the error:

  1. Create the container and start it.
  2. Install remote-containers extension in vscode (author microsoft)
  3. Attach the container to the vscode
  4. In the terminal if you type whoami you will see that are using the root user :(
  5. Open the configuration file of the remote container and add the line -> "remoteUser": "nobody"
  6. Close remote container conecction and open it again, now will use the nobody user and give you the error.

This remoteUser variable is used to open the terminal in the remote container so you can work directly from the vscode.

I attach an image to show you the root user and the option to configure the remoteUser variable

image

Hope that help you.

PD: command from deck app write files as root, for example if i delete the vendor and click on "composer install" quick command in the deck app it will write vendor like root folder. I attach an image.

image