A starter repository for WordPress websites for organisers, campaigns and anyone else who finds it useful.
This folder structure uses the Bedrock pattern, a modern WordPress stack.
- Docker installed
- PHP and Composer installed locally. If not, you can use them in containers provided, prefixing all Composer commands below with
docker compose run composer <command>
- Generate a repository from this template
- If you have PHP and Composer installed locally you can run from this directory
composer install
. Otherwise runcomposer install
via Docker withdocker compose run composer install
. - Copy
.env.example
to.env
, runningcp .env.example .env
. The example file contains variables required for this Docker Compose setup but modify details appropriately as per the Bedrock documentation as required. - Start up all containers with:
docker compose up
- You can access the site at http://localhost:8082. You can install WordPress automatically by running
docker compose run wordpress wp core install --url=http://localhost:8082 --title='WordPress Starter Template' --admin_user=ck_admin --admin_email=hello@commonknowledge.coop
This template comes with some useful development tools for use within WordPress itself.
Crucial. Save off block themes that you are making in the full site editor to the theme on disk. Add fonts direct from the WordPress backend, including Google Fonts.
Create WordPress patterns from within the WordPress backend. They are automatically saved to the theme on disk, with appropriate metadata and can also be modified in this way.
Generate a lot of dummy content to see how the website looks and feels with full content in it.
Again for creating dummy data, this allows quick duplication of posts to fill things out.
- Run
composer outdated
to verify any dependencies that require updating. - Run
composer bump
to bump minor versions and save results tocomposer.json
. - Update within
composer.json
. For example thewordpress
package. - Run
composer update
. - Commit the result.
WP-CLI is installed in the wordpress
container.
docker compose run wordpress wp --allow-root <command>
Note WP-CLI will not work on the host machine, as WordPress configuration refers to databases within the Docker network, not the host machine.
Run docker compose run composer require wpackagist-plugin/plugin-name
.
Documentation for Bedrock is available at https://roots.io/bedrock/docs/.
The following are instructions on how to setup a new site on Kinsta.
You will need to have "Company developer" or above permissions in order to create a site.
These are exhaustive manual instructions, but should not be required after initial setup.
- Log in to your Kinsta account and create a new site.
- Select “Don’t install WordPress” and choose the London data center.
- The provisioning process will take about 10 minutes.
Once the site is created, you will have both Live and Staging environments. Start with the Live environment, and you can later create a Staging environment as needed.
You will use the same SSH key to connect to Kinsta and pull from GitHub.
-
Generate an SSH Key Pair (if you don’t already have one)
-
On your local machine, generate a new SSH key pair:
ssh-keygen -t rsa -b 4096 -C "your-email@example.com"
This will create two files: id_rsa (private key) and id_rsa.pub (public key).
- In Kinsta, navigate to Sites > Live Environment > Info.
- Under SSH Access, click “Add SSH Key” and paste the contents of the id_rsa.pub file.
- Go to your GitHub profile > Settings > SSH and GPG keys.
- Click New SSH key, paste the contents of the id_rsa.pub file, and save it.
You need to set up SSH forwarding so that you can connect to Kinsta and GitHub using the same key.
-
Open or create the ~/.ssh/config file and add the following block:
Host <your_site>_live User <Kinsta SSH username from Live Environment> Hostname <Kinsta SSH hostname> Port <Kinsta SSH port> IdentityFile <path_to_your_private_key> ForwardAgent yes
-
Replace the placeholders (<your_site>, , , , <path_to_your_private_key>) with the actual details from the SFTP/SSH section of your Live Environment in Kinsta’s dashboard.
-
Start the SSH agent and add your GitHub SSH key:
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa
-
SSH into the Live environment with the following command:
ssh <your_site>_live
-
Test the GitHub SSH connection by running:
ssh -T git@github.com
After accepting the host authenticity, you should see a confirmation message from GitHub.
-
Remove the Existing public Directory Once logged into the Live environment, remove the default public directory:
rm -r public
-
Clone Your WordPress Theme from GitHub
git clone git@github.com:<your_repo>.git public
-
Install Dependencies with Composer Navigate to the public directory and install the dependencies:
cd public composer install --no-dev
-
Set Up the .env File Copy the .env.example file to .env:
cp .env.example .env
Modify the .env file as per the Bedrock documentation. Update the database and other environment details You can find database credentials in the Kinsta dashboard under Database Access. Set the WP_HOME to http://localhost.
-
Install WordPress
Run the following command to install WordPress and create the necessary database tables:
wp core install --url=<Kinsta Primary Domain URL> --title=<Site Title> --admin_user=<Admin Username> --admin_email=<Admin Email>
This command will output the password for the new admin user. Save this password for later.
-
Ask Kinsta support (via Intercom chat) to update the NGINX configuration to point to public/web.
-
Follow Kinsta’s guide to point your domain to the Kinsta environment.
-
Set Up SSL and Force HTTPS
• Go to the Tools section in the Kinsta dashboard for the live environment.
• Generate a new Let’s Encrypt SSL certificate.
• Enable Force HTTPS by selecting “Force all traffic to the primary domain”.
-
In the Kinsta Domains section, make sure your primary domain is selected and marked as primary.
-
You can use the same SSH key you generated for both Kinsta and this repository's GitHub Actions deploy workflow.
-
Ensure the public key (id_rsa.pub) has been added to the SSH Access section for the Live environment in the Kinsta dashboard (as shown in the previous steps).
-
Add the SSH Key as a Secret in GitHub
• In your repository, go to Settings > Secrets and variables > Actions.
• Click New repository secret and create the following secrets:
• SSH_PRIVATE_KEY: Paste the contents of your id_rsa (private key).
• SSH_USER_HOST: Enter the username and hostname from Kinsta’s SFTP/SSH details
• SSH_PORT: Enter the SSH port number from Kinsta’s SFTP/SSH details