Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[doctrine-bundle] v. 2.4 file does not exists docker-compose.yml #1120

Closed
Chris53897 opened this issue Aug 23, 2022 · 11 comments
Closed

[doctrine-bundle] v. 2.4 file does not exists docker-compose.yml #1120

Chris53897 opened this issue Aug 23, 2022 · 11 comments

Comments

@Chris53897
Copy link

I get the warning that the file does not exists docker-composeyml. (Missing .). Mac M1.
The file docker-compose.yml does exist in my project.
As it is correct in https://github.com/symfony/recipes/blob/b3395a2477b6d58089f92ef3a0d2e58226825a3a/doctrine/doctrine-bundle/2.4/manifest.json it is maybe a problem of the system itself?

`composer recipes:update doctrine/doctrine-bundle
Updating recipe for doctrine/doctrine-bundle...

Yes! Recipe updated!

The recipe was updated but with one or more conflicts.
Run git status to see them.
After resolving, commit your changes like normal.

NOTE:
The file docker-composeyml was not updated because it doesn't exist in your app.

Would you like to save the "diff" to a file so you can review it? (Y/n) Y

Saved diff to doctrine.doctrine-bundle.updates-for-deleted-files.patch

P.S. The post-install notice should be updated to postgres 14 as well.
https://github.com/symfony/recipes/blob/b3395a2477b6d58089f92ef3a0d2e58226825a3a/doctrine/doctrine-bundle/2.4/post-install.txt

Maybe this Line too. https://github.com/symfony/recipes/blob/main/doctrine/doctrine-bundle/2.4/config/packages/doctrine.yaml#L7

@maxhelias
Copy link
Contributor

As you said, this is a warning and not an error. The docker-compose.yml file is not needed all the time.
And for the doctrine.yaml file, the line is commented and as indicated above it is better to configure in the variable DATABASE_URL : https://github.com/symfony/recipes/blob/main/doctrine/doctrine-bundle/2.4/config/packages/doctrine.yaml#L5-L6

@Chris53897
Copy link
Author

But the file docker-compose.yml is changed for this recipe update.
https://github.com/symfony/recipes/pull/1115/files#diff-165a659908533726dd8891a603861852a2dbb90d0cb5cd90045f1723acfe3e18

@maxhelias
Copy link
Contributor

Do you use docker and docker-compose on your project?

@Chris53897
Copy link
Author

Yes

@maxhelias
Copy link
Contributor

So you should have a docker-compose.yml file at the root of your project. See more info : https://symfony.com/doc/current/setup/docker.html#flex-recipes-docker-configuration

@Chris53897
Copy link
Author

Chris53897 commented Aug 23, 2022

Please see above The file docker-compose.yml does exist in my project.
I guess that symfony/flex has an error with detect the correct filename.
docker-composeyml vs docker-compose.yml

Maybe i am wrong. But the console output does say that.

@OskarStark OskarStark changed the title [doctrine-bundle] v. 2.4 file does not exists docker-composeyml [doctrine-bundle] v. 2.4 file does not exists docker-compose.yml Aug 30, 2022
@mahono
Copy link

mahono commented Jul 29, 2023

I tried to upgrade from Symfony 6.2 to 6.3. The problem still exists. I already have a docker-composer.yml in the project root. Fortunatly a diff file is (or can be) created. But this also contains the filename without dot. Maybe someone has an idea why this happens.

diff --git a/docker-composeyml b/docker-composeyml
index 8aa1121..1067b9c 100644
--- a/docker-composeyml
+++ b/docker-composeyml
@@ -3,19 +3,19 @@ version: '3'
 services:
 ###> doctrine/doctrine-bundle ###
   database:
-    image: postgres:${POSTGRES_VERSION:-14}-alpine
+    image: postgres:${POSTGRES_VERSION:-15}-alpine
     environment:
       POSTGRES_DB: ${POSTGRES_DB:-app}
       # You should definitely change the password in production
       POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-!ChangeMe!}
       POSTGRES_USER: ${POSTGRES_USER:-app}
     volumes:
-      - db-data:/var/lib/postgresql/data:rw
+      - database_data:/var/lib/postgresql/data:rw
       # You may use a bind-mounted host directory instead, so that it is harder to accidentally remove the volume and lose all your data!
       # - ./docker/db/data:/var/lib/postgresql/data:rw
 ###< doctrine/doctrine-bundle ###
 
 volumes:
 ###> doctrine/doctrine-bundle ###
-  db-data:
+  database_data:
 ###< doctrine/doctrine-bundle ###%

@mahono
Copy link

mahono commented Jul 29, 2023

This must be a general issue. I also get it when upgrading the symfony/mailer recipe. It then says:

The file docker-composeoverrideyml was not updated because it doesn't exist in your app.

For some reason, all dots are removed from the file name.

So, I suppose the recipe update system is broken.

@weaverryan
Copy link
Member

weaverryan commented Jul 31, 2023

yea, that's super weird. It, indeed, looks like something with the recipe update system is losing the . in some cases... and only under some conditions. I believe the diff you posted is generated here - https://github.com/symfony/flex/blob/2.x/src/Update/RecipePatcher.php#L109 - so it's generated FROM git, so it's hard to imagine how it would generate a diff that's missing the . in the filenames... and this is so rarely reported, it makes me think that it works on most systems, but breaks on just a few.

EDIT: Nevermind, I see this locally as well...

@weaverryan
Copy link
Member

Fixed at symfony/flex#987

@Chris53897
Copy link
Author

Thanks @weaverryan

fabpot added a commit to symfony/flex that referenced this issue Aug 2, 2023
…rom the filename (weaverryan)

This PR was merged into the 1.x branch.

Discussion
----------

Fixing problem where rootDir is ".", which strips all dots from the filename

Fixes symfony/recipes#1120

In a normal siutation, `$rootDir` is `.`. The intention of this code is to strip the "rootDir" from the START of the `$file` path, so that we are left with only the relative path. The `.` + `str_replace()` was too greedy, and was causing things like `docker-composeryaml`.

The test uses an absolute root dir, and replicating the `.` would be tricky. But I tested this locally and the fix works.

Cheers!

Commits
-------

55d088e Fixinb problem where rootDir is ".", which strips all dots from the filename
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants