Skip to content

Commit

Permalink
Debug adding ORIGIN and BASE_PATH env vars
Browse files Browse the repository at this point in the history
  • Loading branch information
benface committed Jan 28, 2025
1 parent f1ed4f6 commit b09a4e3
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
cache-to: type=inline
build-args: |
ENVIRONMENT=production
ORIGIN=https://thegraph.com
tags: |
${{ env.BASE_IMAGE }}:${{ github.sha }}
${{ env.BASE_IMAGE }}:latest
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,5 @@ jobs:
cache-from: type=registry,ref=${{ env.BASE_IMAGE }}:latest
build-args: |
ENVIRONMENT=staging
ORIGIN=https://staging.thegraph.com
push: false
1 change: 1 addition & 0 deletions .github/workflows/ci-cd-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
cache-to: type=inline
build-args: |
ENVIRONMENT=staging
ORIGIN=https://staging.thegraph.com
tags: |
${{ env.BASE_IMAGE }}:${{ github.sha }}
${{ env.BASE_IMAGE }}:latest
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
FROM node:20-alpine as builder

ARG ENVIRONMENT
ARG ORIGIN

ENV ENVIRONMENT=$ENVIRONMENT
ENV ORIGIN=$ORIGIN

ENV PNPM_HOME="/usr/bin"

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"dev": "turbo run dev --parallel",
"build": "NODE_OPTIONS='--max_old_space_size=4096' turbo run build",
"docker:build": "source ./website/.env.local && DOCKER_BUILDKIT=1 docker build . -t docs --no-cache --build-arg ENVIRONMENT=$ENVIRONMENT",
"docker:build": "source ./website/.env.local && DOCKER_BUILDKIT=1 docker build . -t docs --no-cache --build-arg ENVIRONMENT=$ENVIRONMENT --build-arg ORIGIN=$ORIGIN",
"docker:clean": "docker builder prune",
"docker:up": "docker run --rm -it -p 3000:80 -v \"$(pwd)/nginx.conf:/etc/nginx/nginx.conf\" docs",
"check": "pnpm typecheck && pnpm lint && pnpm prettier:check",
Expand Down
3 changes: 2 additions & 1 deletion website/.env
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ENVIRONMENT=local
ORIGIN=http://localhost:3000
BASE_PATH=/docs
ALGOLIA_API_KEY=9a358df50b02a5b66efeecbc0a2cab3d
ALGOLIA_APP_ID=WQ5FYJCL00
SITE_URL=https://thegraph.com/docs
2 changes: 1 addition & 1 deletion website/next-sitemap.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @type {import('next-sitemap').IConfig} */
export default {
siteUrl: process.env.SITE_URL,
siteUrl: '/',
generateIndexSitemap: false,
}
3 changes: 2 additions & 1 deletion website/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import nextra from 'nextra'

const env = {
ENVIRONMENT: process.env.ENVIRONMENT,
BASE_PATH: process.env.NODE_ENV === 'production' ? '/docs' : '',
ORIGIN: process.env.ORIGIN,
BASE_PATH: process.env.BASE_PATH || '/docs',
ALGOLIA_API_KEY: process.env.ALGOLIA_API_KEY,
ALGOLIA_APP_ID: process.env.ALGOLIA_APP_ID,
MIXPANEL_TOKEN:
Expand Down
23 changes: 23 additions & 0 deletions website/route-lockfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
/ar/subgraphs/cookbook/grafting/
/ar/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/ar/subgraphs/cookbook/near/
/ar/subgraphs/cookbook/polymarket/
/ar/subgraphs/cookbook/pruning/
/ar/subgraphs/cookbook/secure-api-keys-nextjs/
/ar/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -115,6 +116,7 @@
/cs/subgraphs/cookbook/grafting/
/cs/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/cs/subgraphs/cookbook/near/
/cs/subgraphs/cookbook/polymarket/
/cs/subgraphs/cookbook/pruning/
/cs/subgraphs/cookbook/secure-api-keys-nextjs/
/cs/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -192,6 +194,7 @@
/de/subgraphs/cookbook/grafting/
/de/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/de/subgraphs/cookbook/near/
/de/subgraphs/cookbook/polymarket/
/de/subgraphs/cookbook/pruning/
/de/subgraphs/cookbook/secure-api-keys-nextjs/
/de/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -271,6 +274,7 @@
/en/subgraphs/cookbook/grafting/
/en/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/en/subgraphs/cookbook/near/
/en/subgraphs/cookbook/polymarket/
/en/subgraphs/cookbook/pruning/
/en/subgraphs/cookbook/secure-api-keys-nextjs/
/en/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -355,6 +359,7 @@
/es/subgraphs/cookbook/grafting/
/es/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/es/subgraphs/cookbook/near/
/es/subgraphs/cookbook/polymarket/
/es/subgraphs/cookbook/pruning/
/es/subgraphs/cookbook/secure-api-keys-nextjs/
/es/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -434,6 +439,7 @@
/fr/subgraphs/cookbook/grafting/
/fr/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/fr/subgraphs/cookbook/near/
/fr/subgraphs/cookbook/polymarket/
/fr/subgraphs/cookbook/pruning/
/fr/subgraphs/cookbook/secure-api-keys-nextjs/
/fr/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -513,6 +519,7 @@
/hi/subgraphs/cookbook/grafting/
/hi/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/hi/subgraphs/cookbook/near/
/hi/subgraphs/cookbook/polymarket/
/hi/subgraphs/cookbook/pruning/
/hi/subgraphs/cookbook/secure-api-keys-nextjs/
/hi/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -592,6 +599,7 @@
/it/subgraphs/cookbook/grafting/
/it/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/it/subgraphs/cookbook/near/
/it/subgraphs/cookbook/polymarket/
/it/subgraphs/cookbook/pruning/
/it/subgraphs/cookbook/secure-api-keys-nextjs/
/it/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -671,6 +679,7 @@
/ja/subgraphs/cookbook/grafting/
/ja/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/ja/subgraphs/cookbook/near/
/ja/subgraphs/cookbook/polymarket/
/ja/subgraphs/cookbook/pruning/
/ja/subgraphs/cookbook/secure-api-keys-nextjs/
/ja/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -748,6 +757,7 @@
/ko/subgraphs/cookbook/grafting/
/ko/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/ko/subgraphs/cookbook/near/
/ko/subgraphs/cookbook/polymarket/
/ko/subgraphs/cookbook/pruning/
/ko/subgraphs/cookbook/secure-api-keys-nextjs/
/ko/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -827,6 +837,7 @@
/mr/subgraphs/cookbook/grafting/
/mr/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/mr/subgraphs/cookbook/near/
/mr/subgraphs/cookbook/polymarket/
/mr/subgraphs/cookbook/pruning/
/mr/subgraphs/cookbook/secure-api-keys-nextjs/
/mr/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -904,6 +915,7 @@
/nl/subgraphs/cookbook/grafting/
/nl/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/nl/subgraphs/cookbook/near/
/nl/subgraphs/cookbook/polymarket/
/nl/subgraphs/cookbook/pruning/
/nl/subgraphs/cookbook/secure-api-keys-nextjs/
/nl/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -981,6 +993,7 @@
/pl/subgraphs/cookbook/grafting/
/pl/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/pl/subgraphs/cookbook/near/
/pl/subgraphs/cookbook/polymarket/
/pl/subgraphs/cookbook/pruning/
/pl/subgraphs/cookbook/secure-api-keys-nextjs/
/pl/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1060,6 +1073,7 @@
/pt/subgraphs/cookbook/grafting/
/pt/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/pt/subgraphs/cookbook/near/
/pt/subgraphs/cookbook/polymarket/
/pt/subgraphs/cookbook/pruning/
/pt/subgraphs/cookbook/secure-api-keys-nextjs/
/pt/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1137,6 +1151,7 @@
/ro/subgraphs/cookbook/grafting/
/ro/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/ro/subgraphs/cookbook/near/
/ro/subgraphs/cookbook/polymarket/
/ro/subgraphs/cookbook/pruning/
/ro/subgraphs/cookbook/secure-api-keys-nextjs/
/ro/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1216,6 +1231,7 @@
/ru/subgraphs/cookbook/grafting/
/ru/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/ru/subgraphs/cookbook/near/
/ru/subgraphs/cookbook/polymarket/
/ru/subgraphs/cookbook/pruning/
/ru/subgraphs/cookbook/secure-api-keys-nextjs/
/ru/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1295,6 +1311,7 @@
/sv/subgraphs/cookbook/grafting/
/sv/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/sv/subgraphs/cookbook/near/
/sv/subgraphs/cookbook/polymarket/
/sv/subgraphs/cookbook/pruning/
/sv/subgraphs/cookbook/secure-api-keys-nextjs/
/sv/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1372,6 +1389,7 @@
/sw/subgraphs/cookbook/grafting/
/sw/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/sw/subgraphs/cookbook/near/
/sw/subgraphs/cookbook/polymarket/
/sw/subgraphs/cookbook/pruning/
/sw/subgraphs/cookbook/secure-api-keys-nextjs/
/sw/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1451,6 +1469,7 @@
/tr/subgraphs/cookbook/grafting/
/tr/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/tr/subgraphs/cookbook/near/
/tr/subgraphs/cookbook/polymarket/
/tr/subgraphs/cookbook/pruning/
/tr/subgraphs/cookbook/secure-api-keys-nextjs/
/tr/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1528,6 +1547,7 @@
/uk/subgraphs/cookbook/grafting/
/uk/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/uk/subgraphs/cookbook/near/
/uk/subgraphs/cookbook/polymarket/
/uk/subgraphs/cookbook/pruning/
/uk/subgraphs/cookbook/secure-api-keys-nextjs/
/uk/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1607,6 +1627,7 @@
/ur/subgraphs/cookbook/grafting/
/ur/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/ur/subgraphs/cookbook/near/
/ur/subgraphs/cookbook/polymarket/
/ur/subgraphs/cookbook/pruning/
/ur/subgraphs/cookbook/secure-api-keys-nextjs/
/ur/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1684,6 +1705,7 @@
/vi/subgraphs/cookbook/grafting/
/vi/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/vi/subgraphs/cookbook/near/
/vi/subgraphs/cookbook/polymarket/
/vi/subgraphs/cookbook/pruning/
/vi/subgraphs/cookbook/secure-api-keys-nextjs/
/vi/subgraphs/cookbook/subgraph-debug-forking/
Expand Down Expand Up @@ -1763,6 +1785,7 @@
/zh/subgraphs/cookbook/grafting/
/zh/subgraphs/cookbook/immutable-entities-bytes-as-ids/
/zh/subgraphs/cookbook/near/
/zh/subgraphs/cookbook/polymarket/
/zh/subgraphs/cookbook/pruning/
/zh/subgraphs/cookbook/secure-api-keys-nextjs/
/zh/subgraphs/cookbook/subgraph-debug-forking/
Expand Down
3 changes: 1 addition & 2 deletions website/scripts/sitemap-ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ async function main() {

const d = parser.parse(await fs.readFile(sitemapPath, 'utf8'))

// TODO: `process.env.SITE_URL` never seems to be set here, so it always falls back to the default value
const routes = d.urlset.url.map((url) => url.loc.replace(process.env.SITE_URL || 'https://thegraph.com/docs', ''))
const routes = d.urlset.url.map((url) => url.loc.replace(/^\//, ''))

const redirectsPointingToNonExistingStuff = []

Expand Down

0 comments on commit b09a4e3

Please sign in to comment.