Bedrock: WordPress stack

Thanks for the quick response.

  1. I’m using nfs and also it appears to be the default now. So that might trip others up. I tried chmod locally, but now the permissions on the vagrant box are messed up. And sudo chmod from the vagrant box on /srv/www/example.dev/current fails with Operation not permitted. Puzzling.

  2. Do you mean there’s no reason to share a folder with a Vagrant instance other than for testing it out? Or do you mean there’s no reason to deploy with Capistrano to a Vagrant box other than for testing it out? To be clear, I’m envisioning a scenario where I’ve got this whole stack running and a Vagrant box for testing a theme or plugin that I’m working on. So I check in my work and then bundle exec cap development deploy and it updates the vagrant box (running, among other things, composer install, to update any dependencies) so I can test. If all is well, I bundle exec cap production deploy to digital ocean (say) and it goes on the live site. Is that not the intended workflow?

  3. Thanks for the explanation about the difference between the two dotenv implementations. However, the .env in the shared dir is just a symlink to /srv/www/example.dev/shared/.env which obviously doesn’t exist on my local machine. I think maybe this is because I just did vagrant up from within the bedrock-ansible clone and I haven’t done a cap deploy but I’m not sure.

Running vagrant up brings up the virtual machine, but then if I run vagrant provision, it fails due to the chmod problem in #1 above.

  1. Yeah I’ll have to look into this. Never had a problem like this before.

  2. There’s no reason to deploy to the Vagrant box if you’re using it for dev purposes. Unless maybe for testing out deploys once to make sure it works. But for your actual development process, you should use a synced folder since it’s was easier and seamless. If you want to add Composer packages or whatever, just run composer install manually either on your host machine (if you have Composer installed), or on the Vagrant box itself.

  3. The shared .env file should work fine without doing a deploy. What should happen is Ansible generates the .env and writes it to shared/ based on your settings, then it symlinks that file to current/. Your synced folder should be pointed there. Mine looks like:

config.vm.synced_folder '../bedrock', '/srv/www/example.dev/current'

I’m also having host permission issues since switching to NFS.

1 Like

per chance, do you know what the owner:group values are? are they 1000:_appstore per chance?

The vagrant-bindfs plugin appears to have resolved my host permission issues with NFS (host is OSX). Maybe there’s a better solution, though. Some notes and discussion at roots/bedrock-ansible#82.

Yes, this is exactly what they are.

This worked for me. I haven’t used Bedrock before now, so I don’t know of a speed difference or not, but everything seems to be very quick.

However, now I seem to get an error when I don’t use Sudo (now that I don’t have to)

file_put_contents(/Users/shutter/.composer/cache/repo/http---wpackagist.org/provider-wpackagist-plugin$woocommerce.json): failed to open stream: Permission denied

Edit:

I fixed the permission issue by clearing my composer cache. As I was installing plugins via sudo before, it was adding them as root, therefore not accessible by my system user. Clearing it, and now I’m able to do whatever I want with composer in my project.

Haven’t had this “issue” before, since I’ve kept all my project files locally, but now at work when I’m done with this project I want to remove the project files until (if) they are needed again.

The my example.dev is safely stored in my bitbucket repo, but should I (do you?) keep a copy of the bedrock-ansible files in your repo aswell? I’m still using the cap deployment method as this project got started awhile back, and I want to keep the ansible part as it was when the project got started so I’m sure everything works as it should.

Or do you guys just keep a copy of example.dev and get the latest bedrock-ansible whenever an old project is revived?

https://github.com/roots/roots-example-project.com has the structure we recommend. It follows the 12 factor app one codebase per app methodology i.e. site and server in the same repository.

Thanks! I thought it would be a problem with deployment if you had everything in the same repo as the folder structure will be different. Maybe it works fine with the ansible deploy method (which I haven’t had the chance to try yet).

Hi there,
I am trying to set-up bedrock and trellis, but I am stuck with this in bedrock:

  1. Set your site vhost document root to /path/to/site/web/ (/path/to/site/current/web/ if using deploys)

How and where do I do this? I am on a mac, if that makes a difference…

At the moment all I get when doing “vagrant up” is a HTML with “It works!”. It does not seem to load wordpress, when I type sitename.dev into the browser.

sitename.dev/wp/wp-admin is a 404.

Would love to get this working and try it out!

Trellis takes care of everything for you. Those instructions for Bedrock are if you’re just using it separately.

Definitely follow https://github.com/roots/roots-example-project.com if you’re having issues.

I followed the example exactly as you suggested, but I only get an “It Works!” again. No idea what is going wrong. It’s installing wordpress and everything in the folders, I can see that. The server obviously works by saying “It works!”, I guess. But how do I get it to load wordpress?

I just published an article with a bash script and documentation for deploying Bedrock and Sage projects to WP Engine. It’s based on user @anon66789415’s original project, and I hope to continue polishing to really make it a bullet proof solution.

https://hellojason.net/blog/deploying-bedrock-sage-wordpress-to-wp-engine/

2 Likes

If you put these IPs in the VM hosts file:

66.155.40.202   api.wordpress.org
66.155.40.249   WordPress.org www.WordPress.org api.wordpress.org www.api.wordpress.org

Problem solved.

@ibanlopez: I also just had a similar issue where wordpress.org sites/api wasn’t dns-resolvable from inside the VM. I forced the VM to use Google Public DNS (8.8.8.8 / 8.8.4.4) and resolving worked correctly. You had a similar issue? I have thought my router or ISP may be the reason instead.

I used to have this issue on every fresh WordPress install. I Googled a little and found that solution.
Since I paste those two lines in Vagrant hosts file, I’ve never had this error again.