Bedrock: WordPress stack

Hi Scott,

Using bedrock and loving it.

One thing - I’m seeing the following intermittent error:

"Warning: An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the support forums. (WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.) in /media/sf_project/wp/wp-includes/update.php on line 120 ".

It’s always thrown by update.php and I’m wondering if it is related to:

define(‘AUTOMATIC_UPDATER_DISABLED’, true);

in application.php

Just a thought.

Haven’t experienced that error myself but it doesn’t look like it’s related define('AUTOMATIC_UPDATER_DISABLED', true);. That error occurs when WP can’t successfully make an HTTP call to their servers so could be a PHP setup issue or some networking problem.

Thanks Scott. For what it’s worth there are quite a lot of reports of this error around. I’m keeping an eye out for a solution.

1 Like

Hi there !

I have a doubt about the workflow i should adopt after downloading Bedrock.

Usually when i start developing a new wordpress-based website, i create a projectname-core custom plugin to handle all the logic that is specific to my project but is not related to the theme (custom post types definition, etc…)

How should i handle this king of custom plugins that are not meant to be an external ressource ? Should i directly write my plugin into the app/plugins directory and remove it from .gitignore ?

I also have the same question about adding specific languages files, i used to this with svn:externals :

languages   http://i18n.svn.wordpress.org/fr_FR/branches/3.8/messages/

But now i don’t know how i should add this to composer so it downloads it to the app/languages folder ?

Thanks for helping and thanks for taking Wordpress to the next level :slight_smile:

Not sure about the language files but I can help with your custom plugin question.

There are quite a few plugins that I use that are not available from the wpackagist repo, so I’ve set up my own repository online (packages.example.com) and then put all of the plugins in there. I find it makes sense to add a .htaccess file that restricts access by ip. Each time you need another site to have access, add the new ip to the .htaccess file.

Once you have your plugins in the repo, you can then add them to your composer.json file in much the same way as Wordpress is added, that is by defining a custom package repository for each plugin and then adding them to the list of required packages.

HTH

2 Likes

hi
thanks for the idea it is indeed a good practice that i should apply to plugins i developed myself or premium plugins i bought.
Nevertheless i was thinking about plugins that would only exist and make sense in the context of the current project (defining books CPT and Author taxonomy for example) so i would better have them versioned with the project itself…

If you want to use composer then you have to make your plugins accessible so composer can reference them. It makes no real difference if you wrote the plugins or not, and it doesn’t matter if you use a plugin on one site or a thousand.

Because it’s app specific, I would register CPTs and taxonomies etc in mu-plugins and add an exception to the .gitignore like we do here.

1 Like

Sorry tcharbit, I stand corrected!

I should learn to keep quiet at least until I’ve built a few more sites with roots/bedrock.

Thanks everybody for the tips ! This is how i am going to do it from now :wink:

So I have a machine that has two Apache vhosts for staging & production. I noticed out-of-the-box Bedrock wants to deploy_to /srv/www/… but my box serves out of /var/www/…

So I updated the line to read:
set :deploy_to, "/var/www/#{fetch(:application)}"

where application is set to:
set :application, 'thisisreneruiz.com'

At this point, I wasn’t and am not sure how it’s going to distinguish /var/www/thisisreneruiz.com from /var/www/staging.thisisreneruiz.com, but whatever—I’ll figure that out next.

So I ran
$ cap staging deploy:check

But all that did was make a thisisreneruiz.com folder under /tmp/ and all it puts in there is a git-ssh.sh file.

Here is the full output of $ cap staging deploy: check:

 INFO [c95f0e31] Running /usr/bin/env mkdir -p /tmp/thisisreneruiz/ on staging.thisisreneruiz.com
 INFO [c95f0e31] Finished in 0.550 seconds with exit status 0 (successful).
 INFO Uploading /tmp/thisisreneruiz/git-ssh.sh 100.0%
 INFO [02d1a2d8] Running /usr/bin/env chmod +x /tmp/thisisreneruiz/git-ssh.sh on staging.thisisreneruiz.com
 INFO [02d1a2d8] Finished in 0.039 seconds with exit status 0 (successful).

There’s something I’m missing and would appreciate any help in the right direction.

deploy:check should create the entire folder structure in your deploy_to so it does look like it’s missing something. Can you change the log_level to debug and run it again and provide the output? https://github.com/roots/bedrock/blob/master/config/deploy.rb#L17

Also, for your server with both staging and production, you’ll want to set deploy_to in the staging and production configs under config/deploy/. Anything environment/server specific goes in there.

Yeah, I just came here to post that adding this line to staging.rb fixed it:

set :deploy_to, "/var/www/staging.thisisreneruiz.com"

As for capistrano exiting early and not creating the folder structure, it seems to be doing that properly now. I think I may not have been at the project root when running $ cap staging deploy:check.

Either way, it’s working now. :smile:

Can I use bedrock to handle multiple site? I mean one wp/bedrock core but multiple site with different plugins, themes, database, etc and also different domains. Thanks.

It’s not designed for that. Not really sure how it could work either.

Hello,
I have installed and run the bedrock-ansible with the Roots WP theme.
All seemed to run smoothly, with no errors, but when I go to http://192.168.50.5/ I can see the site in plain html only (no css, scripts, plugins etc.) and when I go to example.dev I am getting the “page could not be found” error. When I visit any link on the example page I can see it in plain html only if I replace the example.dev domain with the ip address above. Please, see the screenshot:

Any help greatly appreciated.
Cheers

Going by your console errors (thanks for that!), example.dev can’t be resolved. You need to add it to your local /etc/hosts file (see: localhost - Changing hosts file in Ubuntu - Stack Overflow)

192.168.50.5 example.dev

Can also look into using https://github.com/cogitatio/vagrant-hostsupdater and have it done automatically.

Thanks so much @swalkinshaw. Change in the /etc/hosts file did the trick. Seems so obvious now. The vagrant-hostupdater is cool too. Would be nice to have it come pre-installed with vagrant.
Now then, as I am VERY new to roots and WP development/deployment in general, how do I go about customising/developing the Roots theme? The Bedrock theme above isn’t Roots, so how do I go about replacing it with roots, and make sure it is deployed to the vagrant-ansible box?

New to bedrock, ansible, vagrant and composer, been avid about roots for a couple years. I’ve cloned bedrock into ~/example.dev and bedrock-ansible into ~/ansible-playbook, then ran vagrant up and all works, I can navigate to http://example.dev/wp/wp-admin/ and it’s all good. However, I’m puzzled about some things:

  1. The permissions on ~/example.dev have changed so my local OSX user no longer has read/write access to them
  2. I don’t understand how to deploy to the vagrant box using capistrano as you demoed in the video. I’m having trouble visualizing how it would work because isn’t ~/example.dev/ now a shared directory? Do I need to actually have a separate working example.dev directory that’s not linked to the vagrant box to do the actual work? Can’t all of the ansible playbook stuff just live in ~/example.dev too, why the need for a separate directory?
  3. .env is a symlink to /srv/www/example.dev/shared/.env on the vagrant box (doesn’t exist on my cat ~/example.dev/.env yields No such file or directory. I also see a python dotenv in bedrock-ansible and a php dotenv in bedrock, is one of them deprecated?

Thanks again, you guys rock, hoping I can just get my head around the intended development workflow.

  1. Are you using nfs or the default? We recently switched which might have caused this.
  2. If you’re trying to deploy with Capistrano to the Vagrant box, you shouldn’t even share a folder at that point. You’d really only do this to test it out though as there’s no other reason to.
  3. Ansible has a dotenv module which generates a .env file into the shared/ dir. This would live on the Vagrant VM but I think you’d see it in your local folder as well. Ansible symlinks it from shared/ to current/ and current/ is where your shared dir should point to. The PHP dotenv library is for loading/parsing the .env file. So both have their purpose and are completely different basically.

Hope this helps.