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 /var/www mkdir /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 apt install php libapache2-mod-php php-mysql
Set “hunter2” as your password, of course.
(Another note: Please don’t do that. Because this is a temporary project, we’ll be using the root MySQL server account for WordPress. In production instances, this is highly not recommended.)
Login to the MySQL server.
Create a database and user for WordPress.
CREATE DATABASE wp; CREATE USER 'wpuser'@'localhost'; GRANT ALL PRIVILEGES ON wp.* TO 'wpuser'@'localhost'; FLUSH PRIVILEGES
service apache2 restart
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.
Navigate to your site and setup the DB credentials and site.
WordPress should be installed!
Is it fast? Well….
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.