activist
activist copied to clipboard
Add process that clears `backend/media/images` on backend Docker run
Terms
- [x] I have searched open and closed feature requests
- [x] I agree to follow activist's Code of Conduct
Description
The activist community uses the backend/media/images directory in development to test the image upload functionality. It would be good if this directory was cleared on each run of the backend container so that the testing can happen without the developer getting more and more random images in their local copy of activist. This issue would add such a process to the process that spins up the backend container via a Python utility script that is ran.
[!IMPORTANT] As this issue deals with deleting files on the developers local machine on Docker runs, there must be extensive tests written for this to assure that it is deleting only the image files in
backend/media/imagesand nothing else.
Contribution
Happy to support with this and review a PR once one is opened up! 🚀
Ping @mattburnett-repo on this: Does this make sense for something that we could do for a good first issue? Obviously with extensive testing so that someone can't just change the code in a random PR, but would need to change the code and the tests, which is something that maintainers would see before it's ever merged.
Let me know what your thoughts are!
Can I give a hand in this?
Sure thing, @Joshua-Tihabwangye! Thanks for your interest in helping out here :) Please let us know if you need any support 😊
Ping @mattburnett-repo on this: Does this make sense for something that we could do for a good first issue? Obviously with extensive testing so that someone can't just change the code in a random PR, but would need to change the code and the tests, which is something that maintainers would see before it's ever merged.
Let me know what your thoughts are!
Hello @andrewtavis and @Joshua-Tihabwangye !
A few thoughts, as requested:
-
On one side, the issue is a simple matter of deleting some files as part of the development process, specifically when a developer is working on the file upload functionality. This is a simple manual task, and while it's a bit annoying it isn't anything difficult. The developer just has to remember to delete the files. If the files don't get deleted, there is no adverse impact on the way the application behaves. To be more informal about it, it's not a big deal.
-
On another side, the uploaded files are basically orphaned whenever the backend container is rebuilt, meaning they are at that point useless. In my experience this hasn't been an issue, since all you have to do is delete the files while you wait for the container to spin up. However it seems like good practice to remove these files automatically whenever the backend container is rebuilt. When you rebuild the backend, you're basically resetting the backend to a default state. With this in mind, it makes sense to automatically clear out the orphaned files.
-
As an individual developer, I wouldn't think to add this functionality to the startup process. It seems unnecessary to me. However, it makes sense from a process perspective to add it. If someone is willing to put in the time and effort, and this time and effort results in a simple, reliable solution, I'd say go ahead!
-
Agreed that this would make a good first issue. A simple Python script could/should handle this from within the docker-compose file. Not sure who the owner of the script would be, meaning I'm not sure how to configure the permissions on the script file.
- When the app goes to production, we have to make sure that this functionality is disabled. It's obvious to say this, but I just want to drop a gentle reminder about that, here. The solution should look at the environment (dev, test, prod, etc.) and not run the delete process when it shouldn't.
-
I'm not sure how you would test this, nor how extensive the testing for this would need to be. You would have to figure out how to get a test to straddle a Docker restart, and I'm not sure how to do that.
That's what I have at the moment. Let me know if there's more discussion!
Thanks for the feedback, @mattburnett-repo! Glad to hear that this makes sense as a good first issue :)
hii i have never done an issue? can i do this one?
Hey @gkau306 👋 Thanks for your interest in the platform and helping out :) @Joshua-Tihabwangye is currently working on this one, but maybe you could support or pick up another issue that you find that's of interest! There will always be more issues even if there isn't one now 😊
Closed by #1237 🚀 Thanks for the efforts to improve the developer experience, @Joshua-Tihabwangye! Looking forward to working with you again 😊
Thank you so much @andrewtavis