Saving local files via file upload and using git

Disclaimer: I am a beginner, just a highschool kid who loves to code.
I have nice blog site made with Flask and I have taken a little bit of an unusual approach. Instead of typing the contents of each blog, I create an HTML file for each. It just felt like it gives more flexibility. During upload, the app takes the following:

  1. Category (Article/ Project/ Blog) [unrelated]
  2. HTML file of the post
  3. URL for the post (unique /web_post/ for each post) [unrelated]
  4. Images in the post, these images are accessed from within the HTML file
  5. Audio version, also accessed from HTML file

Now, the HTML file is uploaded into /website/posts/ (/ is where my that runs the app is) and the images and audio are uploaded into /website/post_media
Everything works perfectly.
Since I am deploying from git, I need the empty directories “posts” and “post_media” to able to add it to the repo and the deployment. So, I have empty .gitkeep files in each.
What I am assuming is, everytime I push a commit to the repo, koyeb redeploys THE WHOLE THING, as it is in the repo and doesn’t merge with the previous deployment.

You might see where my issue lies. When I commit anything, the uploaded files in the local directories are gone and voila NO POST! It still exists in the PostgreSQL Database, but it can’t load the page, because there is no page to load from. So please help me out here…
Is there a way to keep the old files after redeployment? [maybe adding the directories to .gitignore? But as I said, I think Koyeb build the repo from scratch so this would make it worse]
Do I have to do it the very manual and very inefficient way (it also feels illegal) of also putting the files in the local directory (on my PC) and then commit and push to git along with those files?

Thank you in advance

Hi @Shashank_Shetty

Unfortunately, this is how the platform is supposed to work. There is no persistent storage (yet) associated to the workloads (the code you push to github that we use to build and run on our platform). You have two options here:

  1. Put the html content in postgres and make your application retrieve (pretty much what wordpress does)
  2. Commit everything to github

With 1. you are limited to the text content only (it’s not wise to store images and videos in a relational database), and you must find another way to serve those media (for example, here we suggest to use Cloudinary).
With 2. you are good to go (although it is always wise not to load media in a git repository, because it would become very slow). In this case, I still think that it would be better to host the media somewhere else (as described in the above link), but I don’t think that uploading your content to github would be a legal issue per se (I am no lawyer though!).

Happy hacking!

Thank you very much for your response. That illegal thing, just humor, I meant it doesn’t feel right :slight_smile:
Anyways, I did see in the request features section of Koyeb that persistent storage is marked as “In progress”. I will be waiting for that. Is there any chance you might have an idea of when it is going to be marked “Complete”
Thank you very much for your response again