Set up Bedrock

Bedrock is a WordPress boilerplate with a more modern folder structure that can make life easier for developers.

You can follow this guide to set up Bedrock on Templ.

Install Bedrock on Templ

Firstly, you would need to either upload your existing Bedrock site to Templ or create a new Bedrock project.

To create a new Bedrock project using composer, connect to your site using SSH and run:

composer create-project roots/bedrock

"Change" web root directory

The web root folder on Templ is fixed as /home/user_xxxx/app_xxxx.

To be able to serve our Bedrock site, which is placed outside of the web root folder, we can replace the web root folder with a symbolic link pointing to Bedrock.

Remove your current web root directory together with its content:

rm -rf app_xxxx

Then we need to create a relative symbolic link pointing the web root folder to the folder inside Bedrock where index.php and wp-config.php is located, e.g.:

ln -s bedrock/web/ app_xxxx

For this change to take effect, you also have to restart your website in the Templ Panel.

Update credentials in .env

Lastly you also need to update the credentials inside of the .env file that's inside the Bedrock folder.

You typically need to update at least the following credentials:

  • DB_NAME
  • DB_USER
  • DB_PASSWORD
  • WP_HOME

You can find your site's database credentials as well as its domain name in the Templ Panel.

Limitations

A Bedrock project keeps most of its files, including .env and config/, outside the webroot (app_xxxx). Templ's staging, backup, and domain features only touch the webroot and the database, so each one needs manual steps from you.

Domain changes

Changing a website's domain in the Templ Panel runs a search-replace in the database, but Bedrock defines its site URL as constants from WP_HOME and WP_SITEURL in .env, and those constants win over the database values. The site keeps using the old domain until you edit .env yourself.

After changing the domain in the Panel, connect over SSH, set WP_HOME (and WP_SITEURL if you set it explicitly) to the new domain, and restart the website.

Staging websites

Staging copies the webroot and the database in both directions - creating a staging site and copying staging to production. Everything outside the webroot, including composer.json, config/ and vendor/, is left behind, so a freshly created staging site has no Bedrock project to serve.

To finish the setup yourself, connect over SSH and:

  1. Copy the bedrock/ folder from production to the staging site's home directory.
  2. Recreate the symbolic link on staging: ln -s bedrock/web/ app_xxxx.
  3. Update .env on staging with the staging site's database credentials and WP_HOME.
  4. Restart the staging website.

Keep deploying outside-webroot changes with git or SSH in both directions, since copying staging to production won't move them either.

If you'd rather not do this yourself, contact support and we'll set it up for you.

Backup restore

Backups cover the webroot and the database, so restoring a backup brings back bedrock/web/ content such as app/uploads plus your database. Files outside the webroot - composer.json, config/, vendor/ and .env - are not backed up and won't be restored. Keep them under version control and redeploy them with git and composer install.

After a restore, verify that app_xxxx is still a symbolic link pointing to bedrock/web/ and recreate it if it isn't.