Skip to content

Local development

Adam Brown edited this page May 21, 2024 · 29 revisions

Setup your environment

                        _______
                       | ___  o|
                       |[_-_]_ |
    ______________     |[_____]|
   |.------------.|    |[_____]|
   ||            ||    |[====o]|
   ||            ||    |[_.--_]|
   ||            ||    |[_____]|
   ||            ||    |      :|
   ||____________||    |      :|
.==.|""  ......    |.==.|      :|
|::| '-.________.-' |::||      :|
|''|  (__________)-.|''||______:|
`""`_.............._\""`______
  /:::::::::::'':::\`;'-.-.  `\
 /::=========.:.-::"\ \ \--\   \
 \`""""""""""""""""`/  \ \__)   \
  `""""""""""""""""`    '========'

Authentication needed to run locally:

  • CloudPlatform k8s cluster
  • Hale platform namespace (via GitHub jotw group)
  • Packagist token via Composer auth.json
  • ACF token via Composer auth.json

Allow access to private repositories

We need access on our local machine to our private plugins and themes when we run make build.

  1. Login to 1Password - Private Packagist and ACF Pro secrets. Get the composer username, token and licence key from the secrets.

  2. Run composer config --global --auth http-basic.repo.packagist.com <composer username> <token> to authenticate your machine to Private Packagist (packagist.com).

  3. Run composer config --global --auth http-basic.connect.advancedcustomfields.com <licence key> <domain> to authenticate your machine to the ACF PRO private repo.

If these commands don't work, you can try adding manually to .composer/auth.json

Create, install TLS certs

  1. Run brew install mkcert to install the mkcert app.
  2. Run mkdir -r /bin/certs in the root of this repository, to create a new /certs folder in the bin/ directory.
  3. In the /certs folder run mkcert hale.docker to create the certificates.
  4. Run mkcert -install to apply certificates to your mac.

Make sure to run make run after these steps to ensure the certs get pulled into the Docker container and used.

Install Dory (Reverse proxy for running a domain locally)

brew install dory

Further info can be found on the github.com/FreedomBen/dory page.

Run locally using Docker

Once you have the above setup and configured, follow the steps below.

  1. Run dory up - Make sure to run this command from within the root of the hale-platform repository (it uses the .dory config file).
  2. Run make build. This builds the images required and all assets. WARNING this wipes any previous install.
  3. Run make run to launch the site on https://hale.docker

Optional

If you have additional params you want to pass the build, you can put them in a .env.local file in the root of this repository.

Developing on themes and plugins

WordPress themes and plugins are loaded as part of the Docker image build. They are pulled into the build using PHP's Composer dependancy manager. To add or remove plugins, modify the composer.json file in the root of this directory.

Clone the repos you wish to edit

Once the site is up and running, if you want to edit code and push it to GitHub, you will need to replace the plugin or theme with a git cloned version. These cloned repositories will be wiped out whenever you run make build so make sure any changes are pushed to the remote branch on GitHub.

Clone this wiki locally