We're assuming here that both your Storage bucket and virtual machine are BOTH hosted in GCP
Make sure that your uploads directory is EMPTY
You can usually change the owner of the folder to root to prevent WordPress's pesky folder creation
- Visit Google Cloud Storage
- Create bucket
- Name your bucket: similar to website name (i.e. "google" for google.com)
- Choose where to store your data: region, usually
- Choose a default storage class for your data: standard
- Choose how to control access to objects: uniform
- Go to Permissions
- Add Members -> give access to Storage Object Viewer, Storage Legacy Object Reader, Storage Legacy Bucket Reader
Make sure that your VM has Read/Write access for the Storage cloud API scope
export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee
/etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get update
sudo apt-get install gcsfuse
Then, edit fuse.conf -- uncomment "user_allow_other" and save
cd /var/www/example.com/public_html/wp-content/
chmod a+w uploads
gcsfuse --dir-mode "777" -o allow_other BUCKET_NAME_HERE uploads
in your /etc/fstab. be careful with this!
BUCKET_NAME_HERE /var/www/example.com/public_html/wp-content/uploads gcsfuse rw,allow_other,dir_mode=777,_netdev
you can test using this
fusermount -zu uploads
mount uploads
if you encounter issues, well..... fix them]
thank you so much you save the day......