Previously I setup radicle with Local on my machine, but am trying a different approach on a different machine.
I have setup Laravel Herd on my main mac machine. I am not native PHP dev, so haven’t used much of composer. I am trying to figure out how to setup Radicle locally with laravel Herd. I have also setup a database with Dbngin. I looked up online and the default DB connection for DBngin is root username and blank password.
Here is my radicle .env
and yes I spelled raidcle wrong here but it is spelled wrong (the same) in the database
DB_NAME='raidcle'
DB_USER='root'
DB_PASSWORD=''
# Optionally, you can use a data source name (DSN)
# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables
# DATABASE_URL='mysql://database_user:database_password@database_host:database_port/database_name'
# Optional database variables
# DB_HOST='localhost'
# DB_PREFIX='wp_'
WP_ENV='development'
WP_HOME='http://example.com'
WP_SITEURL="${WP_HOME}/wp"
# Specify optional debug.log path
# WP_DEBUG_LOG='/path/to/debug.log'
# Generate your keys here: https://roots.io/salts.html
AUTH_KEY='generateme'
SECURE_AUTH_KEY='generateme'
LOGGED_IN_KEY='generateme'
NONCE_KEY='generateme'
AUTH_SALT='generateme'
SECURE_AUTH_SALT='generateme'
LOGGED_IN_SALT='generateme'
NONCE_SALT='generateme'
ACORN_ENABLE_EXPIRIMENTAL_ROUTER='True'
I have run yarn && yarn build and composer install
Did you create a database? https://sequel-ace.com/ is pretty good. “raidcle” from your screenshot is just a friendly name for the database server in DBngin it’s self and is not relevent.
I haven’t tried Radicle with Herd yet but looking at your site paths, something seems off with both the Herd paths and the Site paths.
As you can see with the other Herd Paths, this part is looking for projects in a parent directory. In your case it seems like that’s /Users/anderskitson/acorn.
I’m confused why there are 3 separate sites for, what looks like, the same project. Assuming it’s just one project, I think your Site Path should look like /Users/anderskitson/acorn/radicle-main rather than adding /public/content, /public/dist, or /public/wp.
*corrected above. I originally made a mistake with the recommended site path
In your General Settings → Herd Paths, it should be /Users/anderskitson/acorn.
That being said, I would probably put the project in the Herd directory or valet/Sites rather than acorn, especially if you’re developing anything other than websites in that directory.
also, if you use valet/Sites you can always switch to valet at any time, if it’s already installed.
Hmm, yes just tried that per your suggestion, and still getting the same 404. Tried restarting Herd as well. How do I run it with Valet since you said that is installed?
One last thing you can try with Herd is to add a local radicle driver to the project. I have valet installed so this may or may not work for you, but here’s what you can try:
Add a LocalRadicleDriver.php file to the root of your project /radicle-main and add the following to that file:
<?php
use Valet\Drivers\LaravelValetDriver;
class LocalRadicleDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return bool
*/
public function serves(string $sitePath, string $siteName, string $uri): bool
{
return file_exists($sitePath . '/public/content/mu-plugins/bedrock-autoloader.php') &&
file_exists($sitePath . '/public/wp-config.php') &&
file_exists($sitePath . '/bedrock/application.php');
}
/**
* Determine if the incoming request is for a static file.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string|false
*/
public function isStaticFile(string $sitePath, string $siteName, string $uri)/*: string|false */
{
$staticFilePath = $sitePath . '/public' . $uri;
if ($this->isActualFile($staticFilePath)) {
return $staticFilePath;
}
return false;
}
/**
* Get the fully resolved path to the application's front controller.
*
* @param string $sitePath
* @param string $siteName
* @param string $uri
* @return string
*/
public function frontControllerPath(string $sitePath, string $siteName, string $uri): string
{
$_SERVER['PHP_SELF'] = $uri;
if (strpos($uri, '/wp/') === 0) {
return is_dir($sitePath . '/public' . $uri)
? $sitePath . '/public' . $this->forceTrailingSlash($uri) . '/index.php'
: $sitePath . '/public' . $uri;
}
return $sitePath . '/public/index.php';
}
/**
* Redirect to uri with trailing slash.
*
* @param string $uri
* @return string
*/
private function forceTrailingSlash(string $uri)
{
if (substr($uri, -1 * strlen('/wp/wp-admin')) == '/wp/wp-admin') {
header('Location: ' . $uri . '/');
die;
}
return $uri;
}
}
I have setup Valet, parked a new folder for wordpress sites, and put the radicle-main in that folder and visited http://radicle-main.test but I get this error now
% valet --version
Laravel Valet 4.5.0
% php --version
PHP 8.2.11 (cli) (built: Sep 29 2023 00:10:16) (NTS)
DB_NAME='radicle-db'
DB_USER='root'
DB_PASSWORD=''
# Optionally, you can use a data source name (DSN)
# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables
# DATABASE_URL='mysql://database_user:database_password@database_host:database_port/database_name'
# Optional database variables
# DB_HOST='localhost'
# DB_PREFIX='wp_'
WP_ENV='development'
WP_HOME='http://radicle-main.test'
WP_SITEURL="${WP_HOME}/wp"
Oh Man, that was it the DB_HOST that worked for valet. However I am really keen to get it working with Herd, so I uninstalled Valet and am back to trying to get it to work with Herd. Now getting a 404 on Herd, any idea why that may be? if I can’t get it by the EOD I will go back to valet, but I want to try Herd because it will be easier to introduce the Local environment setup to the rest of my team.
This worked, I had named the file LocalRadicleDriver.php as per @csorrentino comment earlier but it didn’t recognize it until I named in LocalValetDriver.php I used @ogamacheDev Driver for now. I did test Bedrock while I was waiting and it worked out of the box without a driver.
Anyways thanks so much for all the help everyone it is working now.
Thanks for this tip, I figured that out after I uninstalled it, that I just need to stop it. I am so much in the javasScript NPM world, I get lost on this side. Thanks for the help.