Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replicate data from staging, not integration #763

Closed
wants to merge 2 commits into from

Conversation

ChrisBAshton
Copy link
Contributor

Since the env sync was ported over to govuk-helm-charts, not all apps have backups saved to s3 on integration (e.g. note the lack of backup operation here). This means that the data replication scripts fail, as they're looking for a bucket that does not exist.

In contrast, all data is backed up to s3 on staging, so it should be safe to pull from there by default. The only downside is that integration access is given to devs by default, but that access to staging and production required Production Admin access. This is something that can hopefully be ironed out in the move to using govuk-helm-charts for local development, over the coming months. For now it seems better to fix the script for prod-admin users than to have it broken for everyone.

NB I've also removed the unnecessary duplication of replication examples where one used a readonly role and one used a poweruser role. We should use principle of least privilege, so only show the readonly example.

Since the env sync was ported over to govuk-helm-charts, not all
apps have backups saved to s3 on integration (e.g. note the lack
of `backup` operation [here](https://github.com/alphagov/govuk-helm-charts/blob/cae5e10baf0f67423bbebf66454da737da787d37/charts/db-backup/values.yaml#L767-L773)).
This means that the data replication scripts fail, as they're
looking for a bucket that does not exist.

In contrast, all data is backed up to s3 on staging, so it should
be safe to pull from there by default. The only downside is that
integration access is given to devs by default, but that access to
staging and production required Production Admin access. This is
something that can hopefully be ironed out in the move to using
govuk-helm-charts for local development, over the coming months.
For now it seems better to fix the script for prod-admin users
than to have it broken for everyone.

NB I've also removed the unnecessary duplication of replication
examples where one used a readonly role and one used a poweruser
role. We should use principle of least privilege, so only show
the readonly example.
The 180m value was failing with:

```
$ gds aws govuk-production-poweruser --assume-role-ttl 180m ./bin/replicate-mysql.sh whitehall
aws-vault: error: invalid input duration string, try --help
```

A bit of searching suggests that the maximum TTL is now 1 hour:
99designs/aws-vault#263
@kevindew
Copy link
Member

This feels like something that'll make it harder for any new starters and also creates an increased risk of sensitive data being on the dev machines given staging dbs aren't scrubbed.

Can we not just fix the integration backups?

Failing that could we have an env var of the environment that defaulted to integration, and if necessary, someone could change that to pull from staging/prod for a db backup (Is there a reason we'd actually want staging over prod?)

ChrisBAshton added a commit to alphagov/govuk-helm-charts that referenced this pull request Jul 24, 2024
What:

Ensures that every application has its database data backed up
to S3 in integration, for continued compatibility with
govuk-docker.

Why:

Since the env sync was ported over to govuk-helm-charts, not all
apps have backups saved to s3 on integration. This means that the
data replication scripts in govuk-docker fail, as they're looking
for a bucket that does not exist.

Whilst we could configure govuk-docker to pull from production or
staging instead (and indeed explored the idea in
alphagov/govuk-docker#763), this has the
downside of requiring that engineers have
[Production Admin access](https://docs.publishing.service.gov.uk/manual/rules-for-getting-production-access.html#production-admin-access),
so new starters would be unable to easily get production-like
data for local development (new starters are only granted
Integration Admin access).
@ChrisBAshton
Copy link
Contributor Author

Agreed. Superseded by alphagov/govuk-helm-charts#2200

@ChrisBAshton ChrisBAshton deleted the replicate-from-staging branch July 24, 2024 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants