I’m running 8 rather small websites on a single server and I notice I’m running out of disk space unusually quick. While the size of database and uploads folders of each site are actually pretty small. Upon investigating disk space usage, I notice that all the different site folders are nested within each other in the shared/source/sites folder. So disk usage seems to grow exponentially.
For example the folder: /srv/www/site1/shared/source/sites contains the folders and content of all of the other sites, including site1. The same goes for /srv/www/site2/shared/source/sites, /srv/www/site3/… etcetera.
My local project structure looks like this:
- sites
– site1 (with Bedrock subfolders: config, vendor, web, etcetera)
– site2
– site3
– etcetera
- trellis
I’ve provisioned this server earlier this year on Trellis 0.9.6, I’m just not sure if this is a bug, expected behavior, or a misconfiguration somewhere on my part. Let me know if you need more info.
Another small question, is it safe to manually delete the content of the releases folders (/srv/www/site/releases)? Or is there another way (perhaps better) to clean this up?
At first glance, this doesn’t strike me as a bug nor as a misconfiguration.
/srv/www/site_name/shared/source
contains only the cloned files of your repo
. Thus its size will correspond to the size of your repo’s files. I tested deploying the example project repo and I see that the shared/source
file size is small and the shared/source/site
size is trivial:
# repo size
$du -hs /srv/www/example.com/shared/source
2.3M /srv/www/example.com/shared/source
# bedrock-based site size (with sage theme)
$du -hs /srv/www/example.com/shared/source/site
440K /srv/www/example.com/shared/source/site
Your repo will be larger, with the 8 sites and a probably few committed theme files, but unless you’re committing your node_modules
(and maybe dist
), I can’t imagine these project files being too big.
What dir size do you get from du -hs /srv/www/example.com/shared/source
? If it is extremely large, does your repo contain a ton of files or deps, and/or unusually large files?
You can delete the releases
dir but I think that will break your site till you deploy again. To avoid downtime, you could just delete the inactive items within releases
. You can see which is active:
$ ls -l /srv/www/example.com
lrwxrwxrwx 1 web www-data 44 Aug 28 17:42 current -> /srv/www/example.com/releases/20160828174203
You can adjust how many releases will be kept (default is 5) by specifying keep_releases
with the “Finalize the deploy” task (credit):
- name: Finalize the deploy
deploy_helper:
current_path: "{{ project_current_path }}"
path: "{{ project_root }}"
release: "{{ deploy_helper.new_release }}"
state: finalize
+ keep_releases: 2
2 Likes
Thank you for your elaborate reply!
The source folder of each site is huge (1,1G) and the exact same size for each site.
I do keep some plugins in my repo’s, but that doesn’t account for this large disk usage. Which still leads me to suspect I’ve maybe misconfigured something somewhere, which causes an cumulative inception of every site nested within the source folder of each individual site.
On the remote server, the shared/source folder of each of the 8 sites contains all of the other 8 sites folders and their contents, plus the trellis folder:
/srv/www/site1(to 8)/shared/source >
- site1
- site2
- site3
- …
- site8
I hope you see what I mean? Should the source folder of each site contain trellis + every other sites contents?
Thank for the keep_releases tip! Adjusting it to 2 should be fine.
As far as I can tell, the contents are the same between your repo and each source
dir:
- sites
- site1
- site2
- site3
- …
- site8
- trellis
Or do the contents differ between repo and source
? If contents differ,
- what is in your repo and
- what is extra in the
source
dirs?
If source
seems bigger than your repo, I suggest you try digging into the source
dir to find what the extra and big files are.
If it turns out your repo and the source
dirs are the same content, I don’t see a bug nor a misconfiguration. Trellis is set up to give each /srv/www/site
source
dir with the repo contents.
If it turns out you will indeed want to use Trellis with a repo that has 8+ sites and the repo is 1+ GB in size, some adjustments will be required for the large repo/project size. Either Trellis will need to adjust its handling of the source
dir, or you’ll need to split your sites into separate repos, or just bump up the storage specs of your server.
1 Like