Having trouble deploying local Bedrock site and Sage Theme to Digitalocean Droplet

Hey everyone ! I have only been developing using the Roots stack for a few months so I appreciate all answers, no matter how obvious they may seem to a more experienced developer :slight_smile:

I successfully developed 2 separate wordpress sites (each with their own custom Sage theme) using trellis and bedrock on my local mac machine.

My file structure is a little different from the roots example project, it follows this recommendation: Multiple sites: trellis/ subfolder - meaning that i have one trellis install in the same parent directory as the two site directories. I have a separate github repository for each site directory, which does not include the trellis file.

To deploy one of the sites to production I provisioned a DigitalOcean droplet and successfully deployed using this command from my trellis folder:

> ansible-playbook deploy.yml -e "site=<domain> env=production"

I then arrived at the droplet expecting everything to look the same as my local site, but it was a fresh install of wordpress which totally freaked me out, until I read the docs more closely and realized that this was normal ! (https://roots.io/docs/trellis/master/deployments/#configuration)

Okay so then I followed this suggestion for exporting my database using wp db export from inside my vagrant box and uploading the .sql file & my /uploads folder to my Droplet using FileZilla. This all worked perfectly and now my admin panel of the fresh wordpress install on the droplet looked exactly like my local install, and my custom sage theme was showing up in the Themes dashboard. Yay!

HERE IS WHERE THE PROBLEM BEGINS: I activated my theme and now the site is completely white (white page of doom :face_vomiting:)

So I read some more discourse topics, and reviewed the docs for deploying a sage theme correctly, SURPRISE, I did it wrong, so this time:

I first deleted my sage theme from the DO Droplet. Then I went back into the theme’s folder on my local machine, ran yarn:production , then committed the site’s repo to github again (this time there is a /dist folder in my theme folder).
Based on this reply I decided to use FileZilla to simply send over my theme directory (WITHOUT the node_modules, and WITH the new /dist folder) to my digital ocean droplet’s themes folder. It sounded so simple and seemed to work perfectly! Except for the fact that the exact same white screen is appearing when I activate the theme ! again !

Some more information : I did uncomment all of the lines in thebuild-before.yml file and replace “sage” with my theme name before i ran yarn:production from inside the theme folder. I also SSH’d into my DO Droplet’s sage theme folder and ran comoser install, as per these docs.

At this point I am quite frustrated because I feel like the answer might be quite simple and I would really just love to be able to click “activate theme” and for it to appear like it does on my local machine, so ANY HELP is appreciated.

Thanks for being such an awesome community guys, I have already learned so much from you all <3

As a first step you should check the server logs. There should be the actual PHP errors logged.

great idea ! Here is what I found:
failed to open stream: Permission denied in /srv/www/<site url>/releases/20200323200212/web/app/themes/<theme name>/vendor/illuminate/filesystem/Filesystem.php

and

 122PHP message: PHP Warning:  include(/srv/www/<site>/releases/20200323200212/web/app/uploads/cache/35704efb8e1ca5ddebddb2cfb68db6923013e633.php): failed to open stream: No such file or directory in /srv/www/<site>/releases/20200323200212/web/app/themes/<theme name>/vendor/illuminate/view/Engines/PhpEngine.php on line 43PHP message:

Like I said I am a beginner so I really do not understand these errors :frowning: will keep googling while I wait for more help here! Thanks for the quick reply

from my research I gather that my site is attempting to open some files, which it cannot find. I have checked both the /cache folders (the one on my local site and the one on my DO Droplet), and neither of them seem to contain the files that illuminate is searching for… I’m still not sure how to fix this

Have you provisioned the server before (ansible-playbook), also after adding this new site to trellis config?
(The playbook can be ran as often as one likes as it is (should be) idempotent, it will only change what has to be change.)

Okay so I’ve solved this with a lot of tinkering. First of all my Sage theme has a lot of code that references the function the_field() because I use the Advanced Custom Fields plugin. And of course when trellis installed wordpress on my droplet, it did not install any plugins. So my template kept calling the_field() and without the ACF plugin it returned errors like crazy ! So I tried to install the plugin but I could not add any plugins from my wp admin ! Which drove me nuts until I realized that I need to install them using composer (composer require wpackagist-plugin/advanced-custom-fileds) which worked like a charm ! So now my site is working, and I’ve learnt so much about bedrock and trellis :slight_smile: Hopefully my errors and comments can help someone in the future !

Hm, the WordPress plugins in the composer.json of bedrock site should be automatically installed on server during deploy.

This topic was automatically closed after 42 days. New replies are no longer allowed.