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.
git clone [email protected]:training/training-ap-panorama.git
Step 2: Create a Branch.
Follow Naming Guidelines.
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:
-
Create the .env file or you can just copy the .env.example and rename it to .env.
-
Configure the .env file:
-
Open the .env file and fill in the necessary environment variables:
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'
- Database Credentials:
Create database on laragon
Ensure the database credentials (DB_NAME, DB_USER, DB_PASSWORD) are correct for your local environment.
DB_NAME='database_name'
DB_USER='database_user'
DB_PASSWORD='database_password'
-
Set WordPress Salts:
Generate WordPress salts from https://roots.io/salts.html and replace the placeholders in the .env file.
# 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'
- Set credentials and license keys
Credentials
- WP Offload Media CDN : https://gitlab.forge99.com/standards/wp-offload-media-pro
License Keys
- AS3CFPRO_LICENCE : https://gitlab.forge99.com/standards/wp-offload-media-pro
- WPMDB_LICENCE : https://gitlab.forge99.com/standards/wp-migrate-db-pro
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
# 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=''
Step 4: Create auth.json.
-
Creating auth.json is required to download AIOS packages and Delicious Brains plugins through Composer.
-
Create a file named auth.json on the same folder where composer.json is located.
-
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.
{
"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.
composer install
Then
composer update
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.
- Visit your localhost site.
- Set up a temporary account on your local WordPress installation.
- Navigate to
Dashboard
>Plugins
> activate WP Migrate DB Pro. - 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.)
- Navigate to
Dashboard
>Tools
> WP Migrate > Migrate Tab > Settings > Connection Info > press Copy to Clipboard. - Return to your localhost site.
- Go to
Dashboard
>Tools
> WP Migrate > Migrate Tab > Pull > insert the connection info. - Click Pull.
- Close the window, and you’re ready to go.
Step 7: You can now start editing the site.
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.
git add .
Step 9: Commit the changes you’ve made.
git commit -m '<commit_message>'
Step 10: Push your changes.
git push origin 'Branch_Name'
Step 11: Create Merge Request.
https://gitlab.forge99.com/your_project_group/your_project_url