How to install bedrock with Local by Flywheel

Hey !,
I have been trying to search the net for some tutorial for installing bedrock and sage with Local by Flywheel and sadly I have not come across any solution where I can do this.

Can someone please help/guide me in setting up bedrock + sage work flow with Local?

Thank you very much :pray:t4:

I too am interested in this.

I’m looking to move to a Bedrock setup and want to use Local instead of Trellis so any thoughts on how to use Bedrock with Local would be appreciated.

I apologize in advanced for not going to great depths in this reply, but here are some pointers that should get you going in the right direction:

  1. Use the Custom environment (nginx, PHP 5.6 or greater, and MySQL 5.6 are ideal) so you can edit the config files directly in the site’s conf folder
  2. Put all of Bedrock into the site’s app directory. Delete the public directory
  3. Open up the appropriate nginx.conf file and change the web root to /app/web
  4. Change the appropriate Bedrock config file to use the following database info:
    • User: root
    • Password: root
    • Database: local
  5. Restart the site

If you wish to set up the paths differently, you can use https://github.com/getflywheel/local-addon-volumes to expose the folders to the site’s Docker container.

Thanks Clay, I look forward to checking this out.

Hi!

I would really love a more detailed guide for this. I managed to get the site up and running with bedrock and Local by following these steps but there are a few questions…maybe someone can point me in the right direction?

  • I cannot get wp-cli to work, error - cannot find DB.
  • The paths to the database constants (in tab database) is still /public/wp-config and I cannot find where this path is set. Can’t use the Adminer, only sequel pro.

Any help? Sorry i’m very new to both Local and Bedrock so it would be great if someone could help further. Thank you.

1 Like

Hi Alejoa

I’m up and running with a Bedrock structure in Local by Flywheel.

  1. Are you running your wp cli commands in the docker container via Site SSH? You can’t run it in your local filesystem. You need to ctrl-click on the app in Local and access “Site SSH” to run any commands that involve the database.

  2. I’m not seeing path errors in the database tab. Depending on what server you setup (Nginx or Apache) you need to edit the relevant file in /conf/. For me that was /conf/nginx/site.conf and I had to set “root /app/web/;”

Let me know how you go. I know how frustrating it is to try and get a solid, modern workflow happening.

For now, I’m looking forward to using a Bedrock structure with Local by Flywheel and deploying with bedrock Capistrano.

Hi

  1. Got it, did not find the right-click shortcut, thanks!
  2. Did just that in my site.conf, have ngnix just as you recommended in post before. But still getting Unable to find DB_HOST in app/public/wp-config and all the other variables as well. Change of siteurl does not affect the DB either. I also did a restart the server to se if the database tab would update when I updated the conf file, but no. Even stopped site and quit local and the restarted everything again. Do I need to change anything else?

Im missing something but I dont know what.

1 Like

Did you set the environment variables in /app/.env file?

I have this at the top of that file:

DB_NAME=local
DB_USER=root
DB_PASSWORD=root

corresponding to the database settings within Local by Flywheel.

For reference, this is step 2 on the bedrock installation steps: GitHub - roots/bedrock: WordPress boilerplate with Composer, easier configuration, and an improved folder structure

Oh, and you shouldn’t have an app/public folder if you are setting up Bedrock — see Clay’s step 2 above in which /app/public is deleted.

The only wp-config.php file should be in /app/web and is a very minimal and bedrock-specific:

<?php
/**
 * Do not edit this file. Edit the config files found in the config/ dir instead.
 * This file is required in the root directory so WordPress can find it.
 * WP is hardcoded to look in its own directory or one directory up for wp-config.php.
 */
require_once(dirname(__DIR__) . '/vendor/autoload.php');
require_once(dirname(__DIR__) . '/config/application.php');
require_once(ABSPATH . 'wp-settings.php');

Here’s a screenshot of my ~/Local Sites/bedrock_test/ directory:

Hi

Thanks for trying to help!

  • Yes .env is updated with the settings as you explained, just like yours. The site works and runs on the database. I know that because If I make changes to the database (which i can only access via sequel pro, not via adminer) it makes changes to the site.

  • I don’t have the app/public folder. I did just as I should. But Local still looks for a public folder even though I changed root and restarted server.

  • Thats the exact wp-config I have as well (bedrock, as you say)

  • My structure looks exactly like yours

I have doubled checked everything, even made this process twice now to see if there is something small im doing wrong. But i cannot get it to work.

As I said everything is up and running It would just be nice to access database via adminer if thats meant to work.
My problem is

  • I cannot access adminer. Database tab in Local Flywheel saying: Unable to find DB_HOST in app/public/wp-config even though I changed the .conf file in ngnix->site.conf to root /app/web/.
  • Also the nice feature to change domainname and database just follows is not avalible.

But maybe im trying to fix something that should not work? It’s ok to use sequel pro and everything is up and running so, it would just be nice to use all the features Local has to offer.

To fix WP CLI you need to:

  • right click on the Wordpress install in local and open Site SSH
  • rewrite the path via command line like so: nano /wp-cli.yml
  • replace /app/public with /app/web/wp
  • hit CTRL+X to exit followed by Y and than enter to save changes

To fix Adminer:

  • just try to launch it once. it will error 404
  • it will generate a adminer php file into the public folder.
  • Copy it into your web folder of Bedrock

It will still not detect wordpress and database in Local GUI

I’ve created a blueprint of a Bedrock installation for Local.

Easy 6 steps to get a clean WordPress Bedrock installation site on Local.

2 Likes