Skip to Content
🚫
Important

To ensure a smooth editing process and avoid potential issues, make sure you are working with the latest files from Git.
If you have already cloned the repository, don’t forget to run git git pull origin "Branch_Name".You can skip step 1.

Run Wordpress Bedrock Site Locally

In this example, we will be setting up training-ap-panorama.

Step 1: Given that you have not cloned the existing repository yet.

terminal
git clone [email protected]:training/training-ap-panorama.git

Video Link here

Step 2: Create a Branch.

🚫
Important

Follow Naming Guidelines.

terminal
git checkout -b 'Branch_Name'

Step 3: Setup .env

In Bedrock, environment variables (ENV) are used to configure various aspects of your WordPress installation, especially sensitive information like database credentials and site URLs. Bedrock uses a .env file to store these variables.

Here’s how to set up the .env file for Bedrock:

  1. Create the .env file or you can just copy the .env.example and rename it to .env.

  2. Configure the .env file:

  3. Open the .env file and fill in the necessary environment variables:

.env
DB_NAME='database_name' DB_USER='database_user' DB_PASSWORD='database_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" # WP Media Offload AS3CF_KEY_ID='' AS3CF_ACCESS_KEY='' AS3CF_BUCKET='' AS3CF_REGION='' AS3CF_ENDPOINT='' AS3CF_DELIVERY='' AS3CF_DELIVERY_DOMAIN='' # License Keys WPMDB_LICENCE='' AS3CFPRO_LICENCE='' # 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'
  1. Database Credentials:

Create database on laragon

alt text

Ensure the database credentials (DB_NAME, DB_USER, DB_PASSWORD) are correct for your local environment.

.env
DB_NAME='database_name' DB_USER='database_user' DB_PASSWORD='database_password'
  1. Set WordPress Salts:

    Generate WordPress salts from https://roots.io/salts.html and replace the placeholders in the .env file.

.env
# 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'
  1. Set credentials and license keys

Credentials

License Keys

Note

To obtain the ID for AS3CF_OBJECT_PREFIX, navigate to the dashboard of your staging or live site, and follow these steps: Settings > WP Offload Media > Media look for Add Prefix to Bucket Path

.env
# WP Media Offload AS3CF_KEY_ID='' AS3CF_ACCESS_KEY='' AS3CF_BUCKET='' AS3CF_REGION='' AS3CF_ENDPOINT='' AS3CF_OBJECT_PREFIX='<your_site_id>/' AS3CF_DELIVERY='' AS3CF_DELIVERY_DOMAIN='' # License Keys WPMDB_LICENCE='' AS3CFPRO_LICENCE=''

Video link here

Step 4: Create auth.json.

  1. Creating auth.json is required to download AIOS packages and Delicious Brains plugins through Composer.

  2. Create a file named auth.json on the same folder where composer.json is located.

  3. Copy and paste the content of https://gitlab.forge99.com/standards/premium-plugin-credentials/-/snippets/57 into auth.json

This is how auth.json is look like.

auth.json
{ "http-basic": { "composer.deliciousbrains.com": { "username": "GET_TOKEN_ON_:https://gitlab.forge99.com/standards/premium-plugin-credentials/-/snippets/57", "password": "GET_TOKEN_ON_:https://gitlab.forge99.com/standards/premium-plugin-credentials/-/snippets/57" } }, "gitlab-token": { "gitlab.forge99.com": { "username": "GET_TOKEN_ON_:https://gitlab.forge99.com/standards/premium-plugin-credentials/-/snippets/57", "token": "GET_TOKEN_ON_:https://gitlab.forge99.com/standards/premium-plugin-credentials/-/snippets/57" } } }

Step 5: Once you are done setting up env you can run the composer.

terminal
composer install

Then

terminal
composer update

Video link here

Step 6: Importing Database

For importing database we are using WP Migrate DB Pro.

Once you’ve successfully set up your site after running composer install.

To Pull Database follow this steps.

  1. Visit your localhost site.
  2. Set up a temporary account on your local WordPress installation.
  3. Navigate to Dashboard > Plugins > activate WP Migrate DB Pro.
  4. Go to the live or staging site. (Note: The live site is always the source of the latest database. If the live site isn’t available yet, the staging site holds the latest database.)
  5. Navigate to Dashboard > Tools > WP Migrate > Migrate Tab > Settings > Connection Info > press Copy to Clipboard.
  6. Return to your localhost site.
  7. Go to Dashboard > Tools > WP Migrate > Migrate Tab > Pull > insert the connection info.
  8. Click Pull.
  9. Close the window, and you’re ready to go.

Video link here

Step 7: You can now start editing the site.

Note

If you have already cloned the repository, don’t forget to run git git pull origin "Branch_Name". You can skip step 1.

Step 8: Once you are done editing the files, add or stage your changes.

terminal
git add .

Step 9: Commit the changes you’ve made.

terminal
git commit -m '<commit_message>'

Step 10: Push your changes.

terminal
git push origin 'Branch_Name'

Step 11: Create Merge Request.

https://gitlab.forge99.com/your_project_group/your_project_url
Last updated on