lacqueristas / universe

It started with a ❗
1 stars 1 forks source link

Google Cloud #25

Open krainboltgreene opened 7 years ago

krainboltgreene commented 7 years ago

Google Cloud potentially offers greater cost reduction and a significant increase in performance.

We're currently using Google Cloud for

We theoretically want to use it for:

krainboltgreene commented 7 years ago

While heroku and gcloud are similar, one missing piece is environment variables. Heroku lets us create key/values that are available on the servers. gcloud has no such feature and instead encourages you to use KMS (Key Management Server, a secrets handler). Right now that's far beyond our ability to do so the alternative is to use Metadata. Metadata is a key/value system accessible from instances. It sounds just like Heroku's environments, but different enough to cause issue. Here's some sample code:

JSON.parse(HTTP.get("http://metadata.google.internal/computeMetadata/v1/instance/attributes/?recursive=true", headers: {"Metadata-Flavor: Google"}).body).each do |(key, value)|
  ENV[key] = value
end
krainboltgreene commented 7 years ago

Right now while a push triggers a new build, it actually fails because it's missing our secrets file:

Create a build task for the docker to google stuff
  docker tag universe_www us.gcr.io/lacqueristas/www
  gcloud docker -- push us.gcr.io/lacqueristas/www
  staging postgres password nFvM3O3wAx78iNBx
  Step 15/18 : COPY googleCloud.secret.json $APPLICATION/
  lstat googleCloud.secret.json: no such file or directory
  ERROR
  ERROR: build step "gcr.io/cloud-builders/docker@sha256:fce1af538beb95a225fb841ccbecf6fa064e639a64f6ae8352337992e9e01d4a" failed: exit status 1