lighthouse-ci icon indicating copy to clipboard operation
lighthouse-ci copied to clipboard

Builds clean up. Too much space taken

Open KoderFPV opened this issue 2 years ago • 8 comments

Hi, We are using lighthouse CI for quite long now. Is it possible to clean/remove old builds from database? We need last 2 months, other than that should be removed

Thanks!

KoderFPV avatar May 13 '22 10:05 KoderFPV

This is an important feature in terms of administrating the CI server

riginoommen avatar Sep 07 '22 03:09 riginoommen

this would be indeed very handy, since the database-size can grow very large very fast.

a manual workaround for now is to call these SQL-statemens on LHCI's SQLite database:

DELETE FROM statistics
WHERE createdAt < date('now', '-2 month')

DELETE FROM runs
WHERE createdAt < date('now', '-2 month')

DELETE FROM builds
WHERE createdAt < date('now', '-2 month')

you might have to compress the database afterwards to free up the space.

codeflorist avatar Feb 02 '23 09:02 codeflorist

Actually, i just discovered, that this feature is already implemented. Take a look at the deleteOldBuildsCron in the config.


Here's some more thoughts:

One run uses about 550kb disk space in the db. So if you have configured numberOfRuns to 3 (which is the default for lhci --collect calls), about 1.5mb is used. With psiCollectCron the default numberOfRuns is 5, resulting in 2.8mb per collection. If you want to monitor multiple sites/urls daily, this ramps up to the gigabytes very fast.

Of the 550kb of one run, the screenshots use about 360kb. So an option to exclude the screenshots from the result would dramatically decrease disk-usage.

Furthermore, it's questionable, if you need to keep all runs, since only one of them is marked as representative and used in the UI anyway. A way to do this via SQL is described here.

codeflorist avatar Feb 03 '23 09:02 codeflorist

Would be great if the deleteOldBuildsCron had an option to filter those representative when pruning.

uncaught avatar Feb 10 '23 07:02 uncaught

Is there a way to delete screenshots of old builds instead of deleting them altogether? I'd prefer to keep the statistic data at low data cost.

uncaught avatar Feb 13 '23 07:02 uncaught

Is there a way to delete screenshots of old builds instead of deleting them altogether? I'd prefer to keep the statistic data at low data cost.

Interested in this too - did you find a way?

lbriet avatar May 23 '23 08:05 lbriet

Interested in this too - did you find a way?

No, unfortunately not.

uncaught avatar May 23 '23 10:05 uncaught

some steps to manage the data base will also be helpful

riginoommen avatar May 23 '23 11:05 riginoommen