How to install Bedrock onto a shared host.

I am not a developer, lets get that straight. I find solutions to problems, which may incorporate a few developments on my part. I also classify myself as a hunter gatherer of the code world and my pastures are well known WordPress sites and Google. I have a number of sites, some with original content and some arbitrage sites.

Like all of you I have been hit, hit and hit by spammers, bots etc and I have tried all different solutions, at one point I had over 30 plugins!

It was at this stage I thought I needed to do things differently, and started using Vagrant, and Valet for my local programming and development process. I then discovered Roots. This is a development process based on the 12 Factor App Methodology.

Unfortunately, they make a declaration that it can’t or shouldn’t be installed on a shared host as it prepares the server in a particular way to match your development/staging servers as part of the 12 Factor methodology by using ansible within its vagrant package process Trellis.

Which is fine if we need to go through that route and I have used it for some of my bigger sites. However, I have a multitude of small sites with little traffic but serve a purpose. I don’t want to setup a new droplet for each one, and I don’t particularly want to set up multisite for all of them as some of them are client sites.

Guru Cloud ExpertsThere is however a solution, in particular using my host Guru. They have on my reseller solution composer and WP-CLi installed which is a god save for most of us. So I have a number of sites, of which I have enabled SSH access through there cPanel. I thoroughly recommend them as a WordPress host and have had no complaints at all. Sites are fast, support is very good (although they will not support a Bedrock solution in terms of WordPress errors etc). To be honest if your installing Bedrock in this manner your pretty keyed up anyways.

Picking through the many many advice notes on how to do it, I have hand picked a process that works for me, and hopefully you.

Installation:

I downloaded the Bedrock code from Git (rather than installing it vis Curl or similar), unpacked the file into a folder and then transferred it via FTP to the folder above /public_html (in my case) ignoring the /web folder. The contents of the /web folder transferred into the /public_html folder. I did it this way so I could control where all the content was going.

However, we need to change some paths in the files. First of all in  composer.json  we need to reflect the /public_html folder we are now using, and not /web. Otherwise composer update or composer install will not work in the correct folders.

"extra": {
"installer-paths": {
"public_html/app/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"public_html/app/plugins/{$name}/": ["type:wordpress-plugin"],
"public_html/app/themes/{$name}/": ["type:wordpress-theme"]
},
"wordpress-install-dir": "public_html/wp"

The next thing to adjust is in /config/application.php.

$webroot_dir = $root_dir . '/web';

needs to change to reflect your webfoot folder in my case /public_html.

$webroot_dir = $root_dir . '/public_html';

The next thing to change is to change wp-cli.yml to reflect the new path.

I changed mine to path: public_html/wp

Now edit the .env.example file adding the database that you would have setup for the project or imported to and don’t forget to get your SALTS!

Also change the WP_HOME=http://example.com to your correct domain! Rename .env.example to .env. You may need to trigger hidden files to see it on your computer and in your FTP program.

All thats now needed is to log in via SSH and run composer install.

This should now all run installing WordPress into the /public-html/wp folder.

You should now be able to see the WordPress install page at your domain. Everything should now be running as per Bedrock and themes and plugins that you develop or use should now be in the app folder. Any future updates won’t affect your work and WordPress core updates run in the /wp folder and not your prized work, which is now in /app.

Now you should be able to SSH in and run composer update in the proper manner to update your site, if you need to, or if you add any updates to your composer.json file.

I will do an update later on using Capistrano if I can get it working and configured to do it all as above. I would also like to get Git working using Bedrocks deploy process, which I am working on now.

Let me know how you get on with this approach and if you have any other suggestions or that I have missed a glaring step out!

Leave a comment

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.