-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from Crown-Commercial-Service/feature/nrmi-26-…
…general-update Updated manual
- Loading branch information
Showing
8 changed files
with
38 additions
and
292 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
``` |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.