Commit 3c32d48
authored
Setup Azure storage for ActiveStorage (#8531)
## Trello card URL
- https://trello.com/c/UtzBnbCV/2097-move-from-aws-s3-to-azure-storage
## Changes in this PR:
This PR sets and backfills the synchronisation between AWS S3 and Azure
Storage for all the service attachments.
### Sets up the connection to Azure storage services:
- Include the necessary gem (azure-blob)
- Set env variables from Terraform module.
- Use env variables and configure storage in Rails Active Storage.
### Sets up mirroring between S3 and Azure storage
- Define and point to [mirror
services](https://guides.rubyonrails.org/active_storage_overview.html#mirror-service)
so any new attachments will be pushed to S3 and also to Azure. So all
new uploads will be sync.
### Add backfill task for existing attachments
- A rake task will re-point all the existing attachments to the mirror
services and then trigger a mirror request for all of them. This will do
a backfill, syncing all the existing attachments into Azure.
## What will need to come as a follow-up
After we are satisfied with the backfill, we will need to push a further
PR:
- Removing S3 and Mirror services and pointing instead to Azure
services.
- Adding a rake task to repoint all the existing blobs to the Azure
services.
## Screenshots of UI changes:
After setting up mirrors and backfilling with the rake task. The blobs
in both storages match:
### For documents
<img width="1559" height="733" alt="image"
src="https://github.com/user-attachments/assets/2556e4ec-3cfd-47ef-9ef7-3581c70edeaa"
/>
### For images and logos
<img width="1397" height="1093" alt="image"
src="https://github.com/user-attachments/assets/04ad0637-91a5-4569-b671-503fe6320fe3"
/>
## Checklists:
### Data & Schema Changes
If this PR modifies data structures or validations, check the following:
- [ ] Adds/removes model validations
- [ ] Adds/removes database fields
- [ ] Modifies Vacancy enumerables (phases, working patterns, job roles,
key stages, etc.)
<details>
<summary>If any of the above options has changed then the author must
check/resolve all of the following...</summary>
### Integration Impact
Does this change affect any of these integrations?
- [ ] DfE Analytics platform
- [ ] Legacy imports mappings
- [ ] DWP Find a Job export mappings
- [ ] Publisher ATS API (may require mapping updates or API versioning)
### User Experience & Data Integrity
Could this change impact:
- [ ] Existing subscription alerts (will legacy subscription search
filters break?)
- [ ] Legacy vacancy copying (will copied vacancies fail new
validations?)
- [ ] In-progress drafts for Vacancies or Job Applications
</details>1 parent 38ec388 commit 3c32d48
File tree
16 files changed
+402
-10
lines changed- app
- jobs/active_storage
- models
- config
- environments
- storage
- lib/tasks
- spec
- jobs/active_storage
- lib/tasks
- terraform/app/modules/paas
16 files changed
+402
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
991 | 994 | | |
992 | 995 | | |
993 | 996 | | |
| 997 | + | |
994 | 998 | | |
995 | 999 | | |
996 | 1000 | | |
| |||
1153 | 1157 | | |
1154 | 1158 | | |
1155 | 1159 | | |
| 1160 | + | |
1156 | 1161 | | |
1157 | 1162 | | |
1158 | 1163 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
| 90 | + | |
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
| 95 | + | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
9 | 25 | | |
10 | 26 | | |
11 | 27 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
0 commit comments