Disk space alerts (production)
We have a CRON job that checks the disk space and alerts in #g_fulfillment_status
if it reaches a threshold:
Currently Slack alerts are triggered when disk space has less than 6% free space (>94% used), and it runs the check every 3 hours.
What to remove should an alert happen
Section titled “What to remove should an alert happen”sudo apt-get clean && sudo apt-get autoremove
- Old Nginx logs in
/var/log/nginx
- Old production logs in
/home/gitlab-customers/customers-gitlab-com/log
- Old Audit logs in
/var/log/audit/
- Remove old Frontend assets in
/home/gitlab-customers/customers-gitlab-com/public/packs/
and/home/gitlab-customers/customers-gitlab-com/public/assets/
(older than 5 days)
For the last point, we should precompile the assets right after removing the files with:
sudo su gitlab-customers -s /bin/bashcd ~ && customers-gitlab-com/ && env RAILS_ENV=production NODE_ENV=production ./bin/rails assets:precompile
If, at this point, we haven’t freed up enough disk space, we can get extra hints using du
or ncdu
in the command line.