From 9123551390fb253703b07b38b9afeeaa018d84a2 Mon Sep 17 00:00:00 2001 From: HashiBot <62622282+hashibot-web@users.noreply.github.com> Date: Wed, 19 Oct 2022 11:20:29 -0500 Subject: [PATCH] chore: Update Digital Team Files + clear redirects (#2547) This is in support of the Boundary GA rollout to https://developer.hashicorp.com --- website/Makefile | 31 ++- website/redirects.js | 317 +------------------------------ website/scripts/should-build.sh | 9 +- website/scripts/website-build.sh | 23 ++- website/scripts/website-start.sh | 21 +- 5 files changed, 76 insertions(+), 325 deletions(-) diff --git a/website/Makefile b/website/Makefile index 9d3bdf176..1eb66cef0 100644 --- a/website/Makefile +++ b/website/Makefile @@ -1,10 +1,21 @@ +###################################################### +# NOTE: This file is managed by the Digital Team's # +# Terraform configuration @ hashicorp/mktg-terraform # +###################################################### + .DEFAULT_GOAL := website -# "developer" | "io" -PREVIEW_MODE?=io -REPO?=boundary +# Set the preview mode for the website shell to "developer" or "io" +PREVIEW_MODE ?= developer +REPO ?= boundary +# Enable setting alternate docker tool, e.g. 'make DOCKER_CMD=podman' +DOCKER_CMD ?= docker + +CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD) +LOCAL_CONTENT_DIR= PWD=$$(pwd) + DOCKER_IMAGE="hashicorp/dev-portal" DOCKER_IMAGE_LOCAL="dev-portal-local" DOCKER_RUN_FLAGS=-it \ @@ -14,31 +25,35 @@ DOCKER_RUN_FLAGS=-it \ --volume "$(PWD)/content:/app/content" \ --volume "$(PWD)/public:/app/public" \ --volume "$(PWD)/data:/app/data" \ - --volume "$(PWD)/../internal/gen:/internal/gen" \ --volume "$(PWD)/redirects.js:/app/redirects.js" \ + --volume "$(PWD)/../internal/gen:/internal/gen" \ --volume "next-dir:/app/website-preview/.next" \ --volume "$(PWD)/.env:/app/.env" \ -e "REPO=$(REPO)" \ + -e "PREVIEW_FROM_REPO=$(REPO)" \ + -e "IS_CONTENT_PREVIEW=true" \ + -e "LOCAL_CONTENT_DIR=$(LOCAL_CONTENT_DIR)" \ + -e "CURRENT_GIT_BRANCH=$(CURRENT_GIT_BRANCH)" \ -e "PREVIEW_MODE=$(PREVIEW_MODE)" # Default: run this if working on the website locally to run in watch mode. .PHONY: website website: @echo "==> Downloading latest Docker image..." - @docker pull $(DOCKER_IMAGE) + @$(DOCKER_CMD) pull $(DOCKER_IMAGE) @echo "==> Starting website..." - @docker run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE) + @$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE) # Use this if you have run `website/build-local` to use the locally built image. .PHONY: website/local website/local: @echo "==> Starting website from local image..." - @docker run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE_LOCAL) + @$(DOCKER_CMD) run $(DOCKER_RUN_FLAGS) $(DOCKER_IMAGE_LOCAL) # Run this to generate a new local Docker image. .PHONY: website/build-local website/build-local: @echo "==> Building local Docker image" - @docker build https://github.com/hashicorp/dev-portal.git\#main \ + @$(DOCKER_CMD) build https://github.com/hashicorp/dev-portal.git\#main \ -t $(DOCKER_IMAGE_LOCAL) diff --git a/website/redirects.js b/website/redirects.js index 8dd72b81f..6cca771cb 100644 --- a/website/redirects.js +++ b/website/redirects.js @@ -1,315 +1,10 @@ module.exports = [ // define your custom redirects within this file. // vercel's redirect documentation: https://vercel.com/docs/project-configuration#project-configuration/redirects - - // Top level redirect - { - source: '/home', - destination: '/', - permanent: true, - }, - { - source: '/help/admin-ui', - destination: '/docs', - permanent: false, - }, - { - source: '/help/admin-ui/downloads', - destination: '/downloads', - permanent: true, - }, - - // `//index.html` to / - { - source: '/:splat*/index.html', - destination: '/:splat*', - permanent: true, - }, - - ///////////////////////////////// - // DESKTOP CLIENT - ///////////////////////////////// - { - source: '/help/desktop/targets', - destination: '/docs/api-clients/desktop#connect', - permanent: false, - }, - { - source: '/help/desktop/sessions', - destination: '/docs/api-clients/desktop#connect', - permanent: false, - }, - { - source: '/docs/api-clients/desktop', - destination: - 'https://learn.hashicorp.com/tutorials/boundary/getting-started-desktop-app', - permanent: true, - }, - { - source: '/help/admin-ui/getting-started/desktop', - destination: - 'https://learn.hashicorp.com/tutorials/boundary/getting-started-desktop-app', - permanent: true, - }, - - ///////////////////////////////// - // API CLIENT - ///////////////////////////////// - { - source: '/help/admin-ui/api-client/cli', - destination: '/docs/api-clients/cli', - permanent: true, - }, - { - source: '/help/admin-ui/api-client/api', - destination: '/docs/api-clients/api', - permanent: true, - }, - - ///////////////////////////////// - // DOMAIN MODEL CONCEPTS - ///////////////////////////////// - { - source: '/help/admin-ui/orgs', - destination: '/docs/concepts/domain-model/scopes#organizations', - permanent: false, - }, - { - source: '/help/admin-ui/projects', - destination: '/docs/concepts/domain-model/scopes#projects', - permanent: false, - }, - { - source: '/help/admin-ui/users', - destination: '/docs/concepts/domain-model/users', - permanent: false, - }, - { - source: '/help/admin-ui/groups', - destination: '/docs/concepts/domain-model/groups', - permanent: false, - }, - { - source: '/help/admin-ui/roles', - destination: '/docs/concepts/domain-model/roles', - permanent: false, - }, - { - source: '/help/admin-ui/auth-methods', - destination: '/docs/concepts/domain-model/auth-methods', - permanent: false, - }, - { - source: '/help/admin-ui/accounts', - destination: '/docs/concepts/domain-model/accounts', - permanent: false, - }, - { - source: '/help/admin-ui/projects', - destination: '/docs/concepts/domain-model/scopes#projects', - permanent: false, - }, - { - source: '/help/admin-ui/grants', - destination: '/docs/concepts/domain-model/grants', - permanent: false, - }, - { - source: '/help/admin-ui/host-catalogs', - destination: '/docs/concepts/domain-model/host-catalogs', - permanent: false, - }, - { - source: '/help/admin-ui/host-sets', - destination: '/docs/concepts/domain-model/host-sets', - permanent: false, - }, - { - source: '/help/admin-ui/hosts', - destination: '/docs/concepts/domain-model/hosts', - permanent: false, - }, - { - source: '/help/admin-ui/targets', - destination: '/docs/concepts/domain-model/targets', - permanent: false, - }, - { - source: '/help/admin-ui/sessions', - destination: '/docs/concepts/domain-model/sessions', - permanent: false, - }, - { - source: '/help/admin-ui/credential-stores', - destination: '/docs/concepts/domain-model/credential-stores', - permanent: false, - }, - { - source: '/help/admin-ui/credential-libraries', - destination: '/docs/concepts/domain-model/credential-libraries', - permanent: false, - }, - { - source: '/help/admin-ui/credentials', - destination: '/docs/concepts/domain-model/credentials', - permanent: false, - }, - { - source: '/help/admin-ui/worker-filters', - destination: '/docs/concepts/filtering/worker-tags', - permanent: false, - }, - { - source: '/help/admin-ui/managed-groups', - destination: '/docs/concepts/domain-model/managed-groups', - permanent: false, - }, - { - source: '/help/admin-ui/dynamic-host-catalogs-on-aws', - destination: - 'https://learn.hashicorp.com/tutorials/boundary/aws-host-catalogs#configure-an-iam-user', - permanent: false, - }, - { - source: '/help/admin-ui/dynamic-host-catalogs-on-azure', - destination: - 'https://learn.hashicorp.com/tutorials/boundary/azure-host-catalogs#register-a-new-azure-ad-application', - permanent: false, - }, - { - source: '/help/admin-ui/dynamic-host-catalogs-on-azure-client-secret-value', - destination: - 'https://learn.hashicorp.com/tutorials/boundary/azure-host-catalogs#generate-a-client-secret-for-the-application', - permanent: false, - }, - { - source: '/help/admin-ui/dynamic-host-catalogs-on-aws-region', - destination: - 'https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Concepts.RegionsAndAvailabilityZones.html', - permanent: false, - }, - { - source: '/help/admin-ui/targets/worker-filters', - destination: '/docs/concepts/filtering/worker-tags#target-worker-filtering', - permanent: false, - }, - { - source: '/help/admin-ui/workers', - destination: '/docs/configuration/worker', - permanent: false, - }, - { - source: '/help/admin-ui/workers/manage-workers-on-hcp', - destination: - 'https://learn.hashicorp.com/tutorials/boundary/hcp-manage-workers', - permanent: false, - }, - - //////////////////////////////////////////// - // Adding sub-resources to existing resource - //////////////////////////////////////////// - // below for add principals workflow within roles - { - source: '/help/admin-ui/roles/add-principals', - destination: '/docs/common-workflows/manage-identities', - permanent: false, - }, - // below for add members workflow within groups - { - source: '/help/admin-ui/groups/add-members', - destination: '/docs/common-workflows/manage-identities', - permanent: false, - }, - { - source: '/help/admin-ui/targets/add-host-sets', - destination: '/docs/concepts/domain-model/host-sets', - permanent: false, - }, - - //////////////////////////////////////////// - // Creating new resources - //////////////////////////////////////////// - - // below is for adding new accounts to an auth-method - { - source: '/help/admin-ui/accounts/new', - destination: '/docs/common-workflows/manage-identities#create-account', - permanent: false, - }, - // below for adding new scopes - { - source: '/help/admin-ui/orgs/new', - destination: '/docs/common-workflows/manage-scopes', - permanent: false, - }, - { - source: '/help/admin-ui/projects/new', - destination: '/docs/common-workflows/manage-scopes', - permanent: false, - }, - { - source: '/help/admin-ui/targets/new', - destination: '/docs/common-workflows/manage-targets', - permanent: false, - }, - { - source: '/help/admin-ui/host-catalogs/new', - destination: '/docs/common-workflows/manage-targets', - permanent: false, - }, - { - source: '/help/admin-ui/host-sets/new', - destination: '/docs/common-workflows/manage-targets#define-a-host-set', - permanent: false, - }, - { - source: '/help/admin-ui/host-sets/preferred-endpoints', - destination: - 'https://www.boundaryproject.io/docs/concepts/domain-model/host-sets#preferred_endpoints', - permanent: false, - }, - { - source: '/help/admin-ui/host-sets/sync-interval-seconds', - destination: - 'https://www.boundaryproject.io/docs/concepts/domain-model/host-sets#sync_interval_seconds', - permanent: false, - }, - { - source: '/help/admin-ui/host-sets/add-hosts', - destination: '/docs/concepts/domain-model/hosts', - permanent: false, - }, - { - source: '/help/admin-ui/hosts/new', - destination: '/docs/common-workflows/manage-targets#define-a-host', - permanent: false, - }, - - //////////////////////////////////////////// - // OSS content migration - //////////////////////////////////////////// - - // below is for moved /installing to /oss/installing - - { - source: '/docs/installing/:splat*', - destination: '/docs/oss/installing/:splat*', - permanent: true, - }, - - // below is for moved /operations to /oss/operations - - { - source: '/docs/operations/:splat*', - destination: '/docs/oss/operations/:splat*', - permanent: true, - }, - - // below is for moved /developing to /oss/developing - - { - source: '/docs/developing/:splat*', - destination: '/docs/oss/developing/:splat*', - permanent: true, - }, + // example redirect: + // { + // source: '/boundary/docs/some/path', + // destination: '/boundary/docs/some/other/path', + // permanent: true, + // }, ] diff --git a/website/scripts/should-build.sh b/website/scripts/should-build.sh index 75fb37074..b2c0146c1 100644 --- a/website/scripts/should-build.sh +++ b/website/scripts/should-build.sh @@ -1,4 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash + +###################################################### +# NOTE: This file is managed by the Digital Team's # +# Terraform configuration @ hashicorp/mktg-terraform # +###################################################### # This is run during the website build step to determine if we should skip the build or not. # More information: https://vercel.com/docs/platform/projects#ignored-build-step @@ -10,4 +15,4 @@ if [[ "$VERCEL_GIT_COMMIT_REF" == "stable-website" ]] ; then else # Check for differences in the website directory git diff --quiet HEAD^ HEAD ./ ../internal/gen/controller.swagger.json -fi +fi \ No newline at end of file diff --git a/website/scripts/website-build.sh b/website/scripts/website-build.sh index f64627d32..79599488d 100755 --- a/website/scripts/website-build.sh +++ b/website/scripts/website-build.sh @@ -1,3 +1,8 @@ +###################################################### +# NOTE: This file is managed by the Digital Team's # +# Terraform configuration @ hashicorp/mktg-terraform # +###################################################### + # Repo which we are cloning and executing npm run build:deploy-preview within REPO_TO_CLONE=dev-portal # Set the subdirectory name for the base project @@ -7,7 +12,14 @@ CLONE_DIR=website-preview # The product for which we are building the deploy preview PRODUCT=boundary # Preview mode, controls the UI rendered (either the product site or developer). Can be `io` or `developer` -PREVIEW_MODE=io +PREVIEW_MODE=developer + +# Get the git branch of the commit that triggered the deploy preview +# This will power remote image assets in local and deploy previews +CURRENT_GIT_BRANCH=$VERCEL_GIT_COMMIT_REF + +# This is where content files live, relative to the website-preview dir. If omitted, "../content" will be used +LOCAL_CONTENT_DIR= from_cache=false @@ -30,4 +42,11 @@ fi cd "$PREVIEW_DIR" # Run the build:deploy-preview start script -PREVIEW_MODE=$PREVIEW_MODE REPO=$PRODUCT HASHI_ENV=project-preview npm run build:deploy-preview +PREVIEW_FROM_REPO=$PRODUCT \ +IS_CONTENT_PREVIEW=true \ +PREVIEW_MODE=$PREVIEW_MODE \ +REPO=$PRODUCT \ +HASHI_ENV=project-preview \ +LOCAL_CONTENT_DIR=$LOCAL_CONTENT_DIR \ +CURRENT_GIT_BRANCH=$CURRENT_GIT_BRANCH \ +npm run build:deploy-preview \ No newline at end of file diff --git a/website/scripts/website-start.sh b/website/scripts/website-start.sh index 0cac7aefa..c66af8013 100755 --- a/website/scripts/website-start.sh +++ b/website/scripts/website-start.sh @@ -1,3 +1,8 @@ +###################################################### +# NOTE: This file is managed by the Digital Team's # +# Terraform configuration @ hashicorp/mktg-terraform # +###################################################### + # Repo which we are cloning and executing npm run build:deploy-preview within REPO_TO_CLONE=dev-portal # Set the subdirectory name for the dev-portal app @@ -5,7 +10,14 @@ PREVIEW_DIR=website-preview # The product for which we are building the deploy preview PRODUCT=boundary # Preview mode, controls the UI rendered (either the product site or developer). Can be `io` or `developer` -PREVIEW_MODE=io +PREVIEW_MODE=developer + +# Get the git branch of the commit that triggered the deploy preview +# This will power remote image assets in local and deploy previews +CURRENT_GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + +# This is where content files live, relative to the website-preview dir. If omitted, "../content" will be used +LOCAL_CONTENT_DIR= should_pull=true @@ -24,4 +36,9 @@ if [ "$should_pull" = true ]; then fi # Run the dev-portal content-repo start script -REPO=$PRODUCT PREVIEW_MODE=$PREVIEW_MODE npm run start:local-preview +REPO=$PRODUCT \ +PREVIEW_FROM_REPO=$PRODUCT \ +LOCAL_CONTENT_DIR=$LOCAL_CONTENT_DIR \ +CURRENT_GIT_BRANCH=$CURRENT_GIT_BRANCH \ +PREVIEW_MODE=$PREVIEW_MODE \ +npm run start:local-preview \ No newline at end of file