From 6fa522d872a6bfc0de284a700bb39ba58f72547d Mon Sep 17 00:00:00 2001 From: Will Holcomb Date: Thu, 25 Mar 2021 14:01:37 -0400 Subject: [PATCH] Deploy frontend through render.yaml (#421) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * addin' frontend to render.yaml 🐂 * settin' node version 🐀 * tweakin' build step 🐾 * alt specification of graphql endpoint 🦡 * no interpolation in render.yaml 🌮 * tryin' static specification 🧁 * printin' URI 🖨 * pushin' just to see the value 🚡 * printin' the right value 💅 * debuggin' hasura 🐜 * tryin' to capture port 🚢 * tryin' w/o port 🌅 * redeployin' altered render.yaml 🥦 * resettin' yarn.lock 🔒 * fixin' name preface so it is passed 🏀 --- packages/web/config.ts | 14 ++++++++++++-- render.yaml | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/packages/web/config.ts b/packages/web/config.ts index de5650da..d64bbd28 100644 --- a/packages/web/config.ts +++ b/packages/web/config.ts @@ -1,6 +1,16 @@ export const CONFIG = { - graphqlURL: - process.env.NEXT_PUBLIC_GRAPHQL_URL || 'http://localhost:8080/v1/graphql', + graphqlURL: ((() => { + const { + NEXT_PUBLIC_GRAPHQL_URL: url, + NEXT_PUBLIC_GRAPHQL_HOST: host, + } = process.env; + + if (url) return url; + if (host) { + return `https://${host}.onrender.com/v1/graphql`; + } + return 'http://localhost:8080/v1/graphql'; + })()), infuraId: process.env.NEXT_PUBLIC_INFURA_ID || '781d8466252d47508e177b8637b1c2fd', openseaApiKey: process.env.NEXT_OPENSEA_API_KEY || undefined, diff --git a/render.yaml b/render.yaml index e1894504..07aaa76e 100644 --- a/render.yaml +++ b/render.yaml @@ -1,3 +1,4 @@ +previewsExpireAfterDays: 3 # automatically remove preview instances services: # A Docker web service - type: web @@ -20,6 +21,10 @@ services: property: hostport - key: HASURA_GRAPHQL_SERVER_PORT value: 10000 + - key: HASURA_GRAPHQL_ENABLE_CONSOLE + value: true + - key: PORT + value: 10000 # backend - type: pserv @@ -40,6 +45,21 @@ services: type: web property: host + - type: web + name: mymeta + env: node + plan: starter + buildCommand: yarn && yarn web:build + startCommand: yarn --cwd packages/web/ start + envVars: + - key: NODE_VERSION + value: 12.18.3 + - key: NEXT_PUBLIC_GRAPHQL_HOST + fromService: + name: hasura + type: web + property: host + databases: - name: metagame-db plan: starter