GlusterFS and uploads folder

Hi all, I’m not sure if this is the correct category for my question but I’ll try.

We run two geographically distant webservers, connected over OpenVPN, they both host some WP sites.
Some of those sites are in common this means that the are deployed to both servers and can be used e.g. using haproxy. In order to have the same data on both sides we’ve setup MySQL Master-Master replication, for files I’ve just installed GlusterFS which works fine.

/mnt/glusterfs/gvol0/brick1/uploads/site1
/mnt/glusterfs/gvol0/brick1/uploads/site2

brick1 is shared between the two servers via GlusterFS so what I write/delete on one site is replicated to the other, mutual. As you can see the idea is to keep uploaded stuff in this folder, how can I tell bedrock deployed WP sites that they should use such folders? The original upload folder in our setup for e.g. site1 is in:

/var/www/vhosts/site1/shared/web/app/uploads/

I was also considering symlinking but maybe there’s a better solution.
Thanks in advance for support,

I.

There’s an UPLOADS constant and additional options that can you set as well:

1 Like

in config/environments/staging.php

I’ve defined:

define('UPLOADS', '/mnt/glusterfs/gvol0/brick1/uploads/site1' );

seems to work, testing in staging right now, thanks @swalkinshaw!

mmmh, I think this won’t work, it’s a folder outside the vhost.

Can shared/web/app/uploads eventually just be a symlink to /mnt/glusterfs/gvol0/brick1/uploads/site1?

Just tested: uploads -> /mnt/glusterfs/gvol0/brick1/uploads/site1/, this works, but how can we tell capistrano to set this link during deploy? Thanks.

set :linked_dirs, %w{web/app/uploads}

This already exists by default. Easiest solution is to just make your GlusterFS dir be at /srv/www/site1/shared/uploads (or whatever the path is) and it would just work.

1 Like

I would like to get this:

/srv/www/site1/shared/uploads -> /mnt/glusterfs/gvol0/brick1/uploads/site1/

which should work. Has this symlink set to be inside my project (git), in Capistrano deploy.rb or should I set it e.g. using ansible provisioner? Thanks.

Seems like server configuration (Ansible) would be the best place.

I’ve just set in my project:

web/app/uploads -> /mnt/glusterfs/gvol0/brick1/uploads/site1

and committed this to git, then deployed. It works fine but in local dev I loose uploads/.gitkeep as far as uploads was a directory before inside the git repo, now it’s a symlink.

Is this OK according to you? Locally uploads points to nowhere but It’s not important as far as we develop in share paths mounted inside Vargrant boxes which then have set /mnt/glusterfs/gvol0/brick1/uploads/site1 as it should.

Thanks @swalkinshaw!

If it works then it’s fine with me :smile:

1 Like