Categories
Guides

Using Google Drive as a WordPress Filesystem

Is using Google Drive as a filesystem for web hosting feasible?

In this post, we’ll be looking at the feasibility of hosting a WordPress site on a VPS, with Google Drive mounted as a filestore that contains the WordPress files.

We’ll be using the Google Drive Ocamlfuse library to mount a GDrive to a Linux instance via API.

We installed it using the following commands:

sudo add-apt-repository ppa:alessandro-strada/ppa
sudo apt-get update
sudo apt-get install google-drive-ocamlfuse

Once it’s installed, we created the directory to mount GDrive on.

mkdir -p /var/www/html

And we mounted the filesystem using our GDrive Oauth credentials.

google-drive-ocamlfuse /var/www/html -headless -id XXXXXXXXXXXXX.apps.googleusercontent.com -secret XXXXXXX -o allow_other

We now have Google Drive mounted as a filesystem! The next step is to set up the environment WordPress will run on. We’ll be using Apache, MariaDB, and PHP 7.4 for this.

We can run some benchmarks to test the performance:

Tests #1 and #4 are read and write speeds of the local filesystem, while #2 and #3 are the mounted, Google Drive.

(Note: it might seem like a good idea to throw MariaDB’s data directory on Google Drive, but this is a very, very poor decision for latency reasons.)

apt-get install apache2 mariadb-server mariadb-client php libapache2-mod-php php-mysql

Setup MySQL:

mysql_secure_installation

Set “hunter2” as your password, of course.

(Another note: Please don’t do that.)

Login to the MySQL server.

mysql

Create a database and user for WordPress.

CREATE DATABASE wp;
CREATE USER 'wpuser'@'localhost';
GRANT ALL PRIVILEGES ON wp.* TO 'wpuser'@'localhost';
FLUSH PRIVILEGES

Restart apache.

service apache2 restart

Install WordPress

wget https://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz

(Yes, this will take a long time.)

Remove the default Apache index file.

rm /var/www/html/index.html

Navigate to your site and setup the DB credentials and site.

WordPress should be installed!

Is it fast? Well….

Local Filesystem
Google Drive networked filesystem

Not bad – keep in mind, the files are most likely getting cached locally by the filesystem.

Is it feasible?

Short answer is no.

Network latency is a big concern and factor, especially for a CMS that loads thousands of files per page load, like WordPress. Google Drive also imposes transfer and access limits on your files, so sudden waves of traffic could result in temporary site unavailability.

You’re much better off purchasing a shared hosting plan or VPS that utilizes local or Network-Attached Storage (NAS) for hosting your site.

Leave a Reply

Your email address will not be published. Required fields are marked *