t3easy / docker-typo3

Environment to develop and run TYPO3 in Docker containers
https://packagist.org/packages/t3easy/typo3-bootcamp
17 stars 6 forks source link

touch: cannot touch '/app/public/FIRST_INSTALL': Permission denied #14

Closed nitsan-technologies closed 4 years ago

nitsan-technologies commented 4 years ago

Hey!

First of all, Thanks for your great efforts to this fantastic Docker TYPO3 Project. Can you please try to guide us why following errors occur?

docker-compose exec -u www-data typo3 touch /app/public/FIRST_INSTALL
touch: cannot touch '/app/public/FIRST_INSTALL': Permission denied

https://i.imgur.com/FqrEaIY.png

FYI: We have tried to setup your docker TYPO3 from the root and normal user, in both case got the same error.

We appreciate your quick feedback, Cheers!

nitsan-technologies commented 4 years ago

Hey Me Again!

Above test-case was with "development mode .env.dev template"

We are also facing an issue with "production mode .env.prod template", Got error The directory "/app/var/cache/code/cache_core/" can not be created.

It seems something needs to care about "permission". Do you have any idea?

Cheers!

t3easy commented 4 years ago

Thanks for your feedback! I just tested with dev-master (which installs TYPO3 9.5). I had no problem beside that the readme contains a wrong path. It has to be:

docker-compose exec -u www-data typo3 touch /app/private/FIRST_INSTALL

Because of helhum/typo3-secure-web and "root-dir": "private".

I could not reproduce any write issues to /app/var/cache in current (master) production images. Maybe update to dev-master. See: https://github.com/t3easy/docker-typo3/commit/95137994bb83c02c23a05192c292203773aabc75#diff-f2106c11316f66d83e30c53c12f2644f I fixed it some days ago but did not tag a bugfix because I'm restructuring the stack at the moment.

nitsan-technologies commented 4 years ago

Hey Jan @t3easy

Thank you very much for your so quick feedback.

Hmm, I've tried with dev-master too, But getting the same error in both installation way (web browser and console), Here are the steps to reproduce the error.

Step 1: composer create-project t3easy/typo3-bootcamp=dev-master t3site Step 2: cd t3site Step 3: Renamed .env.dev to .env Step 4: Added VHOST and TRUSTED_HOSTS_PATTERN

Step 5: docker-compose up -d

Step 5: Tried to run following commands and got same error.

docker-compose exec -u www-data typo3 touch /app/private/FIRST_INSTALL touch: cannot touch '/app/private/FIRST_INSTALL': Permission denied

docker-compose exec -u www-data typo3 vendor/bin/typo3cms install:setup [ TYPO3\CMS\Core\Error\Exception ]
Warning: touch(): Unable to create file /app/private/FIRST_INSTALL because
Permission denied in /app/vendor/helhum/typo3-console/Classes/Console/Insta
ll/Action/PrepareInstallAction.php line 53

IMPORTANT: I'm trying to setup this live server (not in localhost PC/Network). Is there any special configuration for www-data USER in docker at such server?

What do you think?

Cheers, Sanjay

t3easy commented 4 years ago

It could be several things. First the dev setup is ment for development use. The current folder is mounted to /app/ in web and typo3 container (https://github.com/t3easy/docker-typo3/blob/master/.docker/env.dev.yml). Therefore the permissions of the folder you are in could be a problem. The DOCKER_CACHE_CONFIG=:cached is only for macOS (https://github.com/t3easy/docker-typo3/blob/master/.env.dev#L9-L10) and I don't know how linux will handle that setting.

In production, I recommend using named docker volumes like in https://github.com/t3easy/docker-typo3/blob/master/.docker/env.prod.yml

Switching between dev and prod config is not possible, because of the different volume configuration. The idea is to develop local with dev environment, add all nessesary files to git, build the docker images with prod environmend on a clean checkout, e.g. with a CI job, and start the container on the production docker host. Therefore TYPO3 is installed in the web and typo3(php) container during the build and just data folders are mounted as a named volume.

That it works in general you can see in the travis build log https://travis-ci.org/t3easy/docker-typo3/jobs/588396779