Create & Deploy Prototype Sites
Pre-requisites
To complete the steps in this guide, you will need:
- To be a member of the OPG GitHub team in the MoJ GitHub Organisation
- The Cloud Platform CLI installed
- A local development environment including a terminal and a git client
1. Clone the opg-org-infra
repository
To create a repository, you need to raise a pull request against the opg-org-infra repository.
Start by checking out a copy of the repository:
git clone git@github.com:ministryofjustice/opg-org-infra.git
cd opg-org-infra
2. Create your prototype kit repository
Under services/
find the team which you are working on and create a file called: component_prototype.tf
Open the component_prototype.tf
file you just created and add the following Terraform code:
Make sure you replace
<TEAM_NAME>
with your team name!
module "opg-<TEAM_NAME>-prototypes" {
source = "../../modules/repository"
name = "opg-<TEAM_NAME>-prototypes"
developer_team = data.github_team.opg.id
default_branch_name = "main"
delete_branch_on_merge = true
has_issues = false
has_projects = false
has_wiki = false
require_ci_pass = false
template_repository = "moj-prototype-template"
visibility = "public"
}
3. Raise a PR
After you have created that file and added the Terraform config, create a new branch,
git add
the new file and then raise a pull request.
Once a member of the WebOps team has approved your PR, merge it.
When you merge the PR, a GitHub Action will apply the Terraform.
Your new prototype repository has a deployment workflow, implemented as a GitHub Action, which will
continuously deploy any changes made to the main
branch of the repository to the Cloud Platform.
4. Clone the environments
repository
To create resources on the Cloud Platform, you need to raise a pull request against the cloud-platform-environments repository.
Start by checking out a copy of the repository:
git clone git@github.com:ministryofjustice/cloud-platform-environments.git
cd cloud-platform-environments
5. Create your namespace in Cloud Platform
To create your namespace, run:
cloud-platform environment prototype create
You will be asked several questions, the most important of which is the name of your prototype kit project.
This name will be used as:
- The name of the [namespace] which will be created on the cloud platform
- The name of the GitHub repository which will be created, and which will contain your prototype kit source code
- The hostname of your prototype kit website
You must ensure that there is not already a namespace with this name
For example, if you choose my-prototype
as the name, you will create:
- A namespace on the Cloud Platform called
my-prototype
…and your prototype kit website will be available at the URL:
https://my-prototype.apps.live-1.cloud-platform.service.justice.gov.uk
6. Raise a PR
After you have answered all the questions, the cloud-platform CLI will create several files in a folder called:
namespaces/live-1.cloud-platform.service.justice.gov.uk/[name you chose]
Inside this folder you’ll find a
github.tf
folder, ensure that you delete this before raising pull request.
Create a new branch, git add
the new folder and then raise a pull request.
Once a member of the Cloud Platform team has approved your PR, merge it.