-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
🔨 store grapher configs in R2 when edited in the admin #3827
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
d4d178b
to
f68729d
Compare
2829093
to
e9eace9
Compare
f68729d
to
cdec57d
Compare
cdec57d
to
8dd207b
Compare
e9eace9
to
9105d37
Compare
8dd207b
to
33d7608
Compare
33d7608
to
8dd207b
Compare
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 35 (9a4c56) ❌ Edited: 2024-09-09 12:02:51 UTC |
8dd207b
to
f6f1013
Compare
f6f1013
to
37608e3
Compare
7c77d87
to
ff63d5d
Compare
37608e3
to
faf7504
Compare
faf7504
to
c69a797
Compare
5609c8c
to
6c1fec3
Compare
99ac520
to
7e12f2a
Compare
7e12f2a
to
33169ff
Compare
6c1fec3
to
36d9326
Compare
33169ff
to
e355de1
Compare
36d9326
to
f704dff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a good sense of how we can reconstruct chart revisions if we're only serializing the patch?
Without inheritance it's the same as before but with inheritance it's true that this becomes a bit more tricky. Let's chat about it a bit today. I think storing the full config wouldn't be better though.
ec770cf
to
bec18e8
Compare
1321bc7
to
8b8ab75
Compare
4250978
to
4aba1f2
Compare
8b8ab75
to
690986c
Compare
4aba1f2
to
73d29e8
Compare
56646bf
to
065c651
Compare
5187516
to
6bacddb
Compare
1483820
to
d629147
Compare
5db2dfb
to
e097788
Compare
691b7ea
to
47ccc78
Compare
b6ffcc0
to
c32a418
Compare
and a sync tool
c32a418
to
64bf832
Compare
This PR does 2 things at the high level: it stores grapher configs in R2 when they are edited in the admin, and it adds a tool for syncing the content of the
chart_configs
table into R2 (adding/updating missing ones and deleting superfluous ones).Charts are stored in R2 in two folders for now: one that is used for all configs addressed by chart UUID, and one addressed by slug for only published standalone charts.
This PR adds a hash of the full config in the
chart_configs
table. I started out using a SHA-1 and was happy that R2 supports those in addition to MD5, only to discover later on when I wrote the sync tool that the S3 API list operation has no support for hashes other than MD5. Since the main point of the hash is facilitate efficient comparison between set of configs in the DB and those in R2 I then rewrote the hash to be md5. The hash is stored in base64 encoding since this is also what is used and returned in most api calls (the only exception is the ETAG where a hex serialization in double quotes is used 🤷)We already have a key configured for interacting with R2 so I renamed the settings related to this key to have a generic (non-image specific) name.
To test this:
owid-grapher-configs-staging
bucket (CF dashboard -> R2 -> manage api tokens in the top right)owid-grapher-configs-staging
and GRAPHER_CONFIG_R2_BUCKET_PATH todevs/YOURNAME
Then when you interact with the admin and save graphers, you should see these charts show up as json files in the R2 bucket in the
owid-grapher-configs-staging
bucket.