pullpreview / action

A GitHub Action that starts preview deployments for your pull requests and branches. It can work with any application that has a valid Docker Compose file.
https://pullpreview.com
Other
164 stars 13 forks source link

Replace the app files atomically and docker stop first before starting up for succeeding commits #70

Open asakapab0i opened 8 months ago

asakapab0i commented 8 months ago

In django application, everytime a commit is added and the action triggers the script it loses the link to the original files and I think its because in the script it deletes and replace the app files.

So I added two things to ensure that the refreshed files are properly loaded.

Let me know your thoughts.

crohr commented 8 months ago

Hi @asakapab0i, and thanks for the contribution. Could you just explain what problem you encountered in your case, due to the removal and replacement of the /app folder?

Regarding the compose restart, I'm afraid it would not work in all cases, especially if a previous commit made the stack unstable. In this case a restart is not enough to get the services back up.

asakapab0i commented 8 months ago

Hi @asakapab0i, and thanks for the contribution. Could you just explain what problem you encountered in your case, due to the removal and replacement of the /app folder?

Regarding the compose restart, I'm afraid it would not work in all cases, especially if a previous commit made the stack unstable. In this case a restart is not enough to get the services back up.

Hi @crohr , thanks for looking into this PR,

So what happens is whenever a new commit / build is triggered it creates an error where it says the template files are not found I suspect it is because during the build process it deletes the files and recreates the app.

It does work when the docker is restarted or stopping and starting the docker-compose manually.

As for the docker restart, I figured it wouldn't work since it wouldn't be able to apply the new changes since it requires a --build parameter to rebuild.

crohr commented 8 months ago

So what happens is whenever a new commit / build is triggered it creates an error where it says the template files are not found I suspect it is because during the build process it deletes the files and recreates the app.

When you say "it" creates an error, do you mean your application, or the pullpreview action?

It does work when the docker is restarted or stopping and starting the docker-compose manually.

Maybe we should instead docker compose stop before updating code, but I never encountered this issue. Would be nice to get some more detail so that I can reproduce.

asakapab0i commented 8 months ago

When you say "it" creates an error, do you mean your application, or the pullpreview action?

The application fails to recognize the change in the application files. It says it cannot find the expected template files.

Maybe we should instead docker compose stop before updating code, but I never encountered this issue. Would be nice to get some more detail so that I can reproduce.

I'll spend some time reproducing it and maybe it just works for all other applications except ours, if that's the case I'll just include the docker stop on this PR.