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

Watch action: restart #11062

Closed
Korijn opened this issue Oct 3, 2023 · 5 comments · Fixed by compose-spec/compose-spec#423
Closed

Watch action: restart #11062

Korijn opened this issue Oct 3, 2023 · 5 comments · Fixed by compose-spec/compose-spec#423

Comments

@Korijn
Copy link

Korijn commented Oct 3, 2023

Description

Right now I believe the docker compose watch command supports two action types, rebuild and sync. I'd like to see one more option: restart.

There are application binaries (in my case it's the python framework celery) which don't support hot reloading when source code files change. So sync is not enough to pick up the changed source code, and rebuild is overkill because the dependencies did not change.

All I need is a quick restart!

@rollsover
Copy link

rollsover commented Oct 6, 2023

I would also like this feature, but I think just docker compose restart {SERVICE} is not enough, since file synchronization is also needed.

For this reason I use reduild in such cases. Just put COPY of the source code as low as possible in the Dockerfile chain.

But rebuild has a problem - during build it does not restart the build due to repeated changes in the given context. Therefore, updating two files in a row we will not get the result we need.

What to do? – Use sync and detect changes at the application level.
Or wait for this feature, but I don’t see an adequate implementation. The only thing in my mind is sync-and-restart.

@Korijn
Copy link
Author

Korijn commented Oct 6, 2023

Restart could be enough combined with a bind mount though right?

@rollsover
Copy link

@Korijn in my paradigm for using volumes: their use should be exclusively anonymous and only the data generated and used by the application (not code) should be mounted (for example, a database, logs, etc.).

Why?: The compose configuration can spread to server environments, and there volumes of code are very dangerous, so I think the guys will allocate a separate develop block within which we will work locally.

@Korijn
Copy link
Author

Korijn commented Oct 8, 2023

Ah okay. We only use compose in local development and testing scenarios.

@Korijn
Copy link
Author

Korijn commented Oct 17, 2023

Wow, quick! Nice work! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants