Giter Club home page Giter Club logo

ministryofjustice.wp-brookhouse's Introduction

Brook house investigation site

This is the code for the Brook house investigation site.

Features

  • Based on roots/bedrock
  • Dependency management with Composer
  • Enhanced password hashing using bcrypt
  • Builds into a docker image
  • Docker-compose is used to run as a local development server

Requirements

  • PHP >= 7.1
  • Composer - Install
  • Docker & docker-compose - Install
  • Dory (docker proxy for local development) - Install

Getting Started

  1. Create a .env file by copying from .env.example:

    cp .env.example .env

    Set the SERVER_NAME variable โ€“ it should be your project name, and must always end with .docker. This is the hostname that will be used for development on your local machine.

  2. Build the project locally. This will install composer dependencies on your local filesystem.

    make build

    If you experience any errors at this point, it may be due to being unable to access the private composer repository. More details here.

  3. Start the dory proxy, if it's not already running.

    dory up

    If you get an error message when trying to start dory, make sure you have docker running.

  4. Build and run the docker image.

    make run
  5. Once the docker image has built and is running, you should be able to access the running container by going to the hostname you specified in .env using your web browser.

  6. You will now need to get a copy of the database. Refer to internal documentation on how to do this.

  7. Lastly, run git status, and then git add the .gitkeep file that's in the uploads file. This is because the WASM migration will have deleted it before the sync (but we want to keep it.)

Composer + WordPress plugins

The installation of WordPress core and plugins is managed by composer.

See composer.json for the required packages.

Plugins in the WordPress plugin repository are available from WordPress Packagist (wpackagist).

Premium and custom plugins used by MOJ are available in the private composer repository composer.wp.dsd.io.

WordPress Packagist plugins

Wpackagist plugins are named by their slug on the WordPress plugin repository, prefixed with the vendor wpackagist-plugin.

Some examples:

Plugin name WordPress plugin URL URL slug package name
Akismet https://wordpress.org/plugins/akismet/ akismet wpackagist-plugin/akismet
Hello Dolly https://wordpress.org/plugins/hello-dolly/ hello-dolly wpackagist-plugin/hello-dolly
Yoast SEO https://wordpress.org/plugins/wordpress-seo/ wordpress-seo wpackagist-plugin/wordpress-seo

Example: Installing Akismet plugin

Run the following command:

composer require "wpackagist-plugin/akismet" "*"

This will install the latest version of Akismet using the corresponding wpackagist package.

Private composer repository

The private composer repository composer.wp.dsd.io contains premium and custom WordPress plugins.

Access to this repository is restricted. Refer to internal documentation for further details.

Theme

Building theme assets

Theme assets can be built as part of the docker image. Add required commands to bin/build.sh.

To view CSS changes in the browser, if it isn't already automatically updating, you'll need to cd into web/app/themes/brookhouse and run:

npm run watch

Configure the default theme

Set your theme as the default by adding the following line to config/application.php:

define('WP_DEFAULT_THEME', 'yourthemename');

WP-CLI

The WordPress CLI is a useful tool for running commands against your WordPress installation.

To use WP-CLI, your docker container must already be running. (This will probably be running in a separate terminal session/tab.)

  1. Run:

    make bash

    A bash session will be opened in the running container.

  2. The WP-CLI will be available as wp.

    For example, to list all users in the install:

    wp user list

Email delivery

When running locally for development, emails sent by WordPress are not delivered. Instead they are captured by mailcatcher.

To see emails, go to http://mail.`SERVER_NAME` (i.e. the hostname set in your .env file) in your browser. e.g. http://mail.example.docker

This will load a webmail-like interface and display all emails that WordPress has sent.

Make commands

There are several make commands configured in the Makefile. These are mostly just convenience wrappers for longer or more complicated commands.

Command Descrption
make build Run the build script to install application dependencies and build theme assets. This will typically involve installing composer packages and compiling SASS stylesheets.
make clean Alias of git clean -xdf. Restore the git working copy to its original state. This will remove uncommitted changes and ignored files.
make run Alias of docker-compose up. Launch the application locally using docker-compose.
make bash Open a bash shell on the WordPress docker container. The WP-CLI is accessible as wp. The application must already be running (e.g. via make run) before this can be used.
make test Run tests on the application. Out of the box this will run PHP CodeSniffer (code linter).

Bedrock

This project is based on Bedrock. Therefore, much of the Bedrock documentation will be applicable.

Bedrock documentation is available at https://roots.io/bedrock/docs/.

ministryofjustice.wp-brookhouse's People

Contributors

roblowemoj avatar bnewing avatar wilson1000 avatar wilson1000-moj avatar brown-a2 avatar stephdavid avatar jsmcgd avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.