Skip to content
This repository has been archived by the owner on Aug 18, 2021. It is now read-only.

Use google drive to get images #26

Merged
merged 6 commits into from
Oct 3, 2020
Merged

Use google drive to get images #26

merged 6 commits into from
Oct 3, 2020

Conversation

zephraph
Copy link
Contributor

@zephraph zephraph commented Oct 3, 2020

cc @ansor4 (this is the finished work we were pairing on initially)

The previous approach for grabbing images was a little overly complex and faulty. Previously we were doing a get request for the image and piping that to s3. While it should've worked well enough, some images were getting gated behind a redirect that even will the follow option the fetch call wasn't able to resolve.

Instead of that approach I configured our gcloud service account to directly access the drive folder w/ our team nav photos. This has the added benefit that we don't need to have that folder public.

Setting up the permissions for the drive were a bit finicky because it expects google permissions to be provided via a file. So, I added a script to write the file from our saved env var. A bit of an ugly hack, but we can revisit that.


Given that the gcloud credentials are needed at build time, it took a few manual config updates:

  1. Adding the G_CREDS environment variable to vars.yml. This is a bit of a manual process
aws s3 cp s3://artsy-citadel/team/vars.yml vars.yml    # Copy down the vars file locally
open vars.yml                                          # Add the env var to the file
aws s3 cp vars.yml s3://artsy-citadel/team/vars.yml    # Re-upload the vars file
  1. Adding an ARG entry to the dockerfile so it's properly available at build time
  2. Adding an entry to build.yml so that env vars from the vars.yml are supplied to the dockerfile

@zephraph zephraph self-assigned this Oct 3, 2020
"start": "next start",
"predev": "dotenv yarn write-creds",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any command with pre prefixed to it will run before it's postfix (in this case dev). When we're running dev we want to read from the .env file, but when we're starting the service it'll come from an actual env var file.

@zephraph zephraph merged commit 87f0b8e into master Oct 3, 2020
@zephraph zephraph deleted the direct-drive-access branch October 3, 2020 05:59
@artsy-peril artsy-peril bot mentioned this pull request Oct 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant