CCS Scale CaT Buyer UI - ‘Contract a Thing’ (CaT)/'Create and award a contract'.
Running the application requires the following tools to be installed in your environment:
- Node.js v12.0.0 or later
Install dependencies by executing the following command:
$ npm install
$ npm configure
Run:
$ npm start
Or
$ npm start:win
The applications's home page will be available at https://localhost:3000
We use ESLint alongside sass-lint
Running the linting with auto fix:
$ yarn lint --fix
This template app uses Jest as the test engine. You can run unit tests by executing the following command:
Running accessibility tests:
$ yarn test:a11y
Make sure all the paths in your application are covered by accessibility tests (see a11y.ts).
The application exposes a health endpoint (https://localhost:3000/health), created with the use of Nodejs Healthcheck library. This endpoint is defined in health.ts file. Make sure you adjust it correctly in your application. In particular, remember to replace the sample check with checks specific to your frontend app, e.g. the ones verifying the state of each service it depends on.
The Terraform CaT infra and CaT Service API should have been provisioned against the target environment(s) prior to provisioning of this UI component.
Terraform state for each space (environment) is persisted to a dedicated AWS account. Access keys for an account in this environment with the appropriate permissions must be obtained before provisioning any infrastructure from a local development machine. The S3 state bucket name and Dynamo DB locaking table name must also be known.
-
The AWS credentials, state bucket name and DDB locking table name must be supplied during the
terraform init
operation to setup the backend.cd
to theiac/environments/{env}
folder corresponding to the environment you are provisioning, and execute the following command to initialise the backend:terraform init \ -backend-config="access_key=ACCESS_KEY_ID" \ -backend-config="secret_key=SECRET_ACCESS_KEY" \ -backend-config="bucket=S3_STATE_BUCKET_NAME" \ -backend-config="dynamodb_table=DDB_LOCK_TABLE_NAME"
Note: some static/non-sensitive options are supplied in the
backend.tf
file. Any sensitive config supplied via command line only (this may change in the future if we can use Vault or similar).This will ensure all Terraform state is persisted to the dedicated bucket and that concurrent builds are prevented via the DDB locking table.
-
cd
to./iac/environments/{env}
-
We use Terraform to provision the underlying service infrastructure in a space. We will need to supply the Cloud Foundry login credentials for the user who will provision the infrastructure.
These credentials can be supplied in one of 3 ways:
- via a
secret.tfvars
file, e.g.terraform apply -var-file="secret.tfvars"
(this file should not be committed to Git) - via input variables in the terminal, e.g.
terraform apply -var="cf_username=USERNAME" -var="cf_password=PASSWORD"
- via environment variables, e.g.
$ export TF_VAR_cf_username=USERNAME
Assume one of these approaches is used in the commands below (TBD)
- via a
-
Run
terraform plan
to confirm the changes look ok -
Run
terraform apply
to deploy to UK.Gov PaaS
The main environments are provisioned automatically via Travis CI. Merges to key branches will trigger an automatic deployment to certain environments - mapped below:
develop
branch ->development
spacerelease/int
branch ->int
spacerelease/nft
branch ->nft
spacerelease/uat
branch ->uat
space
- other environments TBD (these mappings may change as we evolve the process as more environments come online)
- feature branches can be deployed to specific sandboxes by making minor changes in the
travis.yml
file (follow instructions)
This project is licensed under the MIT License - see the LICENSE file for details