Output log project size

Heey there!

Recently i had an issue that my project apparently ran out of space. This was solved gladly!
However i noticed it happen again very shortly after (apparently my git section was taking tons of space so i wiped it clean)

So the question raised for me, is there a way with a bit of code to see what the project size is?
This is so i can let my bot send me a message that the project size is getting on the large size so i can prevent
it from going haywire again :smile:

Previously i tried to only check my personal log file size (that i have currently disabled with the above reason)
but this turns out not to be the major issue (at least not right now, unless the git saves every tiny change to the auto-logger?)

Thanks in advance!

We have plans to expose disk usage in the editor UI soon, so it’s easier to keep tabs on. But you can run df from the console and see the usage for the /app directory at the moment. However, it sounds like you should look into what’s causing your project to fill up so quickly.

Make sure you have any frequently changing data files like databases and log files listed in a .gitignore file, or stored in a directory called .data (which will automatically gitignore them) along with any generated binary files. As this is likely what’s causing your .git directory to grow as it’s storing all changes to them.

1 Like

I thought i’ve read somewhere before that you guys mentioned working on something like an UI :smile:

Ah, mostly the latter seems to be the issue! I have indeed a database that frequently update (as well as logs before that)

I have 2 questions (one of them i can probably figure out but want to be sure)

  1. the .data folder, is that accessable from the list in the glitch editing? This is mostly for things like my database & / or logs so i can read / change them where needed.
  2. How do i add something to the .gitignore list? :smile:

Thanks in advance once again!

All folders starting with . are hidden from the filetree, so no, you can’t view the contents. If you’re using something like a sqlite database, then this shouldn’t be too much of a problem as it isn’t human-readable. But you might want to avoid logs if the utility of being able to manually edit is better than having to clear your project.

To gitignore something, create a file called .gitignore in the editor and then list out the directories or files you want ignored. Note that files added to this list are also not shown in the editor. You can see examples here: https://git-scm.com/docs/gitignore

1 Like

Ah i see, then i might need alternative ways to store my database or logs…
Considering my database currently is just a JSON structure, i’m not really home in sqlite (tho i might invest some time doing this)

What would your suggestion be? Alternatively i could just add them to the ignore list (or add them to the .data folder) and download the project whenever i would need any of these files but that’s quite inconvenient over time.

Thanks again!

How often are you changing the files directly? You can always temporarily remove them from the gitignore list and refresh so they’re visible and re-add them. Not ideal, but if it’s not too often then that might be alright?

1 Like

It has a possibility to be updated every 5 mins (depending if anything changed or not) so your solution might actually be a good bandage fix for now! Overal i shouldn’t need to access the file at all unless something gets messed up during the saving (or a user did something that isn’t fixable with self-made commands :smile:)

Thanks for helping :smile: Tho i got 1 last question that isn’t persee related to the above issues;
Considering i have a self expanding database based on discord servers and the users storing their data… You think something else then JSON might be a good solution? I remember you mention sqlite database!

Just looking at alternative ways to perhaps more securely store my data in the long end :smile:

There are a few options here with working examples: https://glitch.com/storage

There are some libraries which make working with JSON files as a database easier, like low-db. But a more robust solution would be something like SQLite for sure.

1 Like

Alright! Thanks for the info, i’ll definitely check out the other glitch projects :smile:

I’ll for sure look some more into SQLite then, might be an interesting project :smile:

PS: I did end up gitignoring the database & log file, so far i have no complaints! Ty for this :smile:

1 Like