owid-grapher icon indicating copy to clipboard operation
owid-grapher copied to clipboard

Replace `make sync-images` by fallback in Cloudflare worker

Open Marigold opened this issue 11 months ago • 0 comments

Currently, when creating a staging server or setting up dev environment, we have to sync all GDoc images from r2:owid-image-upload/production to r2:owid-image-upload-staging/my-env by calling make sync-images in order to make it work.

We could simplify this by having a Cloudflare worker handle requests to https://images-staging.owid.io/my-env/xxx.png and redirecting them to https://images.owid.io/production/xxx.png if the image doesn't exist. If the dev uploads an image to R2, the Cloudflare worker will use it instead of falling back to the production bucket. This would make the sync-images command and the need for rclone obsolete.

(We do it like this for Data API, and it works well. We could just copy the worker and change its config.)

@ikesau just to let you know that there's a possibility like that. Syncing images works well right now, so there's no need to change it. (Syncing images takes only ~30s so there's not much to gain either)

Marigold avatar Mar 12 '24 08:03 Marigold