VilnaCRM-Org / user-service

Creative Commons Zero v1.0 Universal
5 stars 1 forks source link

Error occurs after the `make start` command, when trying to start project in local environment #32

Closed paaneko closed 1 month ago

paaneko commented 1 month ago

Description

While following Installation Instructions, step 3 an error dependency failed to start: container user-service-php-1 is unhealthy occurs after the make start command.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Clone the Repository
  2. Configuration
  3. Start the project make start
  4. See error

Screenshots

Screenshot 2024-07-16 at 21 18 53

Environment

Kravalg commented 1 month ago

Can you show the logs of the php container ?

paaneko commented 1 month ago

2024-07-16 21:42:40 setfacl: var/cache/dev/translations/catalogue.en.UjF8dBz.php.meta: Not supported 2024-07-16 21:42:40 setfacl: var/cache/dev/App_Shared_KernelDevDebugContainerDeprecations.log: Not supported 2024-07-16 21:42:40 setfacl: var/cache/dev/App_Shared_KernelDevDebugContainer.php.lock: Not supported 2024-07-16 21:42:40 setfacl: var/cache/dev/App_Shared_KernelDevDebugContainer.php.meta: Not supported 2024-07-16 21:42:40 setfacl: var/log: Not supported 2024-07-16 21:43:32 Installing dependencies from lock file (including require-dev) 2024-07-16 21:43:32 Verifying lock file contents can be installed on current platform. 2024-07-16 21:43:32 Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run composer update or composer update <package name>. 2024-07-16 21:43:32 Nothing to install, update or remove 2024-07-16 21:43:32 Package sebastian/phpcpd is abandoned, you should avoid using it. No replacement was suggested. 2024-07-16 21:43:32 Package qossmic/deptrac-shim is abandoned, you should avoid using it. Use qossmic/deptrac instead. 2024-07-16 21:43:32 Generating optimized autoload files 2024-07-16 21:43:34 composer/package-versions-deprecated: Generating version class... 2024-07-16 21:43:34 composer/package-versions-deprecated: ...done generating version class 2024-07-16 21:43:34 173 packages you are using are looking for funding. 2024-07-16 21:43:34 Use the composer fund command to find out more! 2024-07-16 21:43:34 CaptainHook Composer Plugin 2024-07-16 21:43:34 Using CaptainHook config: /srv/app/captainhook.json 2024-07-16 21:43:34 ✔ commit-msg installed 2024-07-16 21:43:34 ✔ pre-push installed 2024-07-16 21:43:34 ✔ pre-commit installed 2024-07-16 21:43:34 ✔ prepare-commit-msg installed 2024-07-16 21:43:34 ✔ post-commit installed 2024-07-16 21:43:34 ✔ post-merge installed 2024-07-16 21:43:34 ✔ post-checkout installed 2024-07-16 21:43:34 ✔ post-rewrite installed 2024-07-16 21:43:34 2024-07-16 21:43:34 Run composer recipes at any time to see the status of your Symfony recipes. 2024-07-16 21:43:34 2024-07-16 21:43:37 Executing script cache:clear [OK] 2024-07-16 21:43:37 Executing script assets:install public [OK] 2024-07-16 21:43:37 > php bin/console lexik:jwt:generate-keypair --skip-if-exists 2024-07-16 21:43:37 2024-07-16 21:43:37 2024-07-16 21:43:37 // Your key files already exist, they won't be overriden.
2024-07-16 21:43:37 2024-07-16 21:43:37 Waiting for db to be ready... 2024-07-16 21:43:37 The db is now ready and reachable 2024-07-16 21:43:38 2024-07-16 21:43:38 [OK] Already at the latest version ("DoctrineMigrations\Version20240122085853") 2024-07-16 21:43:38 2024-07-16 21:43:38 setfacl: var: Not supported 2024-07-16 21:43:38 setfacl: var/cache: Not supported 2024-07-16 21:43:38 setfacl: var/cache/dev: Not supported 2024-07-16 21:43:38 setfacl: var/cache/dev/url_generating_routes.php.meta: Not supported 2024-07-16 21:43:38 setfacl: var/cache/dev/App_Shared_KernelDevDebugContainerCompiler.log: Not supported 2024-07-16 21:43:38 setfacl: var/cache/dev/pools: Not supported

paaneko commented 1 month ago

This is just a small part. Also i mentioned that after running make install it returns Error 137 (memory exceeds). And user-service-php-1 restarts again and again in loop.

➜ user-service git:(main) ✗ make install Installing dependencies from lock file (including require-dev) Verifying lock file contents can be installed on current platform. Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run composer update or composer update <package name>. Nothing to install, update or remove Package sebastian/phpcpd is abandoned, you should avoid using it. No replacement was suggested. Package qossmic/deptrac-shim is abandoned, you should avoid using it. Use qossmic/deptrac instead. Generating optimized autoload files composer/package-versions-deprecated: Generating version class... composer/package-versions-deprecated: ...done generating version class 173 packages you are using are looking for funding. Use the composer fund command to find out more! CaptainHook Composer Plugin Using CaptainHook config: /srv/app/captainhook.json ✔ commit-msg installed ✔ pre-push installed ✔ pre-commit installed ✔ prepare-commit-msg installed ✔ post-commit installed ✔ post-merge installed ✔ post-checkout installed ✔ post-rewrite installed

Run composer recipes at any time to see the status of your Symfony recipes.

make: *** [install] Error 137

paaneko commented 1 month ago

container_logs.txt

Kravalg commented 1 month ago

It seems that you have troubles with the permissions for the var directory Please follow this document and let’s try to fix them

https://symfony.com/doc/current/setup/file_permissions.html

Kravalg commented 1 month ago

@Derane please take a look and prepare the fix

paaneko commented 1 month ago

Never mind, I found the problem. I fix this error by removing:

64: setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var
65: setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var

from infrastructure/docker/php/docker-entrypoint.sh file.

I suppose this change can cause problems in prod env or on other platforms like Linux, Windows.

paaneko commented 1 month ago

I certainly don't understand why E2E testing-mac container goes down, when on my side everything runs well. However, I would like to propose to close this issue with this code:

  if [ "$APP_ENV" = 'prod' ]; then
    setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX var
    setfacl -dR -m u:www-data:rwX -m u:"$(whoami)":rwX var
  else
    chmod -R 755 var
  fi

As I understand, the problem is that the setfacl command runs inside the container on linux without issues, but when Docker wants to synchronize a folder between host machine and container, a bug occures. But with chmod - R 775 var command, and even without it, everything works fine for me. Also I think for the other OS too.

The ideal solution would be to check in the container on which OS the host machine running, but this is technically impossible.

I assume that docker in production environment will never run on a windowsOS or macOS server. And during dev environment, container runs fine with chmod -R 755 var. So it shouldn't affect prod and dev work in any way.

WDYT @Kravalg @Derane?

Kravalg commented 1 month ago

Thanks for your help and involvement in this issue I think we should prioritize completing the GitHub action for end-to-end tests on macOS to ensure our service functions effectively on macOS as it does on Ubuntu to have the best developer experience that we can provide