Skip to content

Commit

Permalink
Merge pull request #66 from Crown-Commercial-Service/feature/nrmi-26-…
Browse files Browse the repository at this point in the history
…general-update

Updated manual
  • Loading branch information
reemi1510 authored Oct 17, 2024
2 parents 64d226c + 716162d commit b861ca7
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 292 deletions.
Binary file added .DS_Store
Binary file not shown.
13 changes: 5 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,14 @@ Supplier-facing application: https://reportmi.crowncommercial.gov.uk

CCS administration application: https://api.reportmi.crowncommercial.gov.uk/admin

The applications are also running in development, staging and preprod environments for testing at different stages. They can be accessed at the following URLs:
The applications are also running in development and staging environments for testing at different stages. They can be accessed at the following URLs:

- development:
* https://www.development.rmi-paas.ai-cloud.uk/
* https://api.development.rmi-paas.ai-cloud.uk/admin/
* https://www.dev.reportmi.crowncommercial.gov.uk/
* https://admin.dev.reportmi.crowncommercial.gov.uk/admin
- staging
* https://www.staging.rmi-paas.ai-cloud.uk/
* https://api.staging.rmi-paas.ai-cloud.uk/admin/
- preprod
* https://www.preprod.rmi-paas.ai-cloud.uk/
* https://api.preprod.rmi-paas.ai-cloud.uk/admin/
* https://www.staging.reportmi.crowncommercial.gov.uk/
* https://admin.staging.reportmi.crowncommercial.gov.uk/admin

## Principles
https://www.gov.uk/service-manual
Expand Down
2 changes: 0 additions & 2 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
* [Glossary](glossary.md)
* [Users](users.md)
* [Framework Definition Language](framework-definition-language.md)
* [Submissions](submissions.md)
* [Validations](validations.md)
* [Data Warehouse Export](data-warehouse-export.md)
* [Decision Records](decision-records.md)
* [Setup New Environments](new-environments.md)
* [Infrastructure](infrastructure.md)
* [Deployments](deployments.md)
23 changes: 9 additions & 14 deletions docs/deployments.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
# Release process

The platform is currently hosted on the Government Platform as a Service (GPaaS).

Cloud Foundary scripts exist within each application in the /CF directory. These scripts are responsible for infrastructure changes as a separate task.

## Migrations

Migrations are manual.

1. [get access to a rails console on the box](infrastructure.md)
1. run `bin/rails db:migrate`
1. run `cf restart ccs-rmi-api-staging` for these changes to take effect
Migrations are manual. See [infrastructure access](infrastructure.md)

## CHANGELOG

Expand All @@ -32,7 +24,6 @@ Having tested in staging, reviewed and merged the relevant Feature/* branches ba
### 1. Create a Release/* branch

- Create a branch from `develop` for the release called `Release/X` where X is the release number
- Test the release cut in the preprod environment.

### 2. Create a tag for the release:
```bash
Expand All @@ -54,16 +45,20 @@ git push origin --tags
are safe to ship and that CHANGELOG.md accurately reflects the changes
included in the release.

### 5. Make a pull request to merge Release/* branch back into develop
### 5. Deploy the master branch in Jenkins

- This is currently a separate step.

### 6. Run any new migrations if required

- Get the pull request reviewed and approved.
- See guidance on manually running migrations

### 6. Production smoke test
### 7. Production smoke test

Once the code has been deployed to production, carry out a quick smoke test to
confirm that the changes have been successfully deployed.

### 7. Update Jira
### 8. Update Jira

Update Jira to reflect the newly deployed tickets.

Expand Down
102 changes: 14 additions & 88 deletions docs/infrastructure.md
Original file line number Diff line number Diff line change
@@ -1,109 +1,35 @@
# Infrastructure access

The Data Submission Service is hosted on [GOV.UK's Platform as a Service](https://www.cloud.service.gov.uk/) which is based on [Cloud Foundry](https://www.cloudfoundry.org/).

[Documentation for interacting with the PaaS can be found on GOV.UK](https://docs.cloud.service.gov.uk/).
RMI is hosted on AWS, general documentation can be found [here](https://docs.aws.amazon.com/)

## Prerequisites

1. GOV.UK PaaS account - the lead or senior developer can create this account for you and you'll recieve an email
2. [install command line tools](https://docs.cloud.service.gov.uk/get_started.html#get-an-account) for shell access
1. AWS account - TechOps can set you up with access to RMI.
2. [install command line tools](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)

## Get shell access on a box
## Access a running instance

Login to the right Cloud Foundary account
Login via the command line
```bash
$ cf login -a api.london.cloud.service.gov.uk -u <YOUR_EMAIL_ADDRESS>
$ aws --profile <PROFILE> ecs execute-command --cluster <CLUSTER> --task <TASK> --container admin --interactive --command "/bin/sh"
```
PROFILE is as set in your ~/.aws/config file
CLUSTER can be found in the console at Amazon Elastic Container Service > Clusters, then TASK can be found by copying the arn of the appropriate task.

Select the right environment using `cf target`
To check a database migration status

```bash
$ cf target -s staging
$ rails db:migrate:status
```

SSH onto an application running within that environment
To run a database migration

```bash
$ cf ssh ccs-rmi-api-staging
$ rails db:migrate:up VERSION=<VERSION_NUMBER>
```

Start a Rails console
To start a Rails console

```bash
$ /tmp/lifecycle/shell
$ bin/rails console
```

## Viewing environment variables

The [GOV.UK PaaS documentation for viewing the current value for variables](https://docs.cloud.service.gov.uk/deploying_apps.html#environment-variables) can be used.

For example you can view staging variables by:

```
cf login -a api.london.cloud.service.gov.uk -u <YOUR_EMAIL_ADDRESS>
cf target -s staging
cf apps
cf env APP_NAME
```

## Change an environment variable

We use [user provided services](https://docs.cloudfoundry.org/devguide/services/user-provided.html) to manage environment variables on the PaaS, this is different to the [default documentation](https://docs.cloud.service.gov.uk/deploying_apps.html#environment-variables).

### Prerequisites

#### Secrets

Obtain the environment variable files. Ask a team mate for their location.

#### Scripts

The scripts that help us make these changes are found in the [frontend repository within the CF directory](https://github.com/Crown-Commercial-Service/DataSubmissionService/tree/develop/CF). You should have this repository and directory checked out to continue.

#### JSON Parser

```
brew install jq
```

### Making a change

1. Make a change to the environment variable file
2. Copy the contents into a new local file `DataSubmissionService/CF/.env.cf.staging`
3. Run the script to apply the changes `./create-user-services.sh -u <YOUR_PAAS_EMAIL_ADDRESS> -p <YOUR_PAAS_PASSWORD> -o ccs-report-management-info -s staging`

### Verify the change

```
cf apps
cf env <APP_NAME>
```

### Deploy the change

Using rolling deployment strategy (flag: --strategy rolling) with CF Cli v7, (instead of the previous V3 and the blue/green plugin), allows us to execute deployments without any downtime to the user natively.

```
cf apps
cf restart <APP_NAME>
```

### Watch the deployment progress

You should see the process count for the intended application change as new processes are spun up and handed over to. This can take a few minutes.

```
watch cf apps
```

Once this is complete the containers should be running the new environment variables.

## Restart an application

Redeploy an application from apps with downtime

```
cf apps
cf restage <APP_NAME>
```
173 changes: 0 additions & 173 deletions docs/new-environments.md

This file was deleted.

Loading

0 comments on commit b861ca7

Please sign in to comment.