Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: dev-portal preview shell #25

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 10 additions & 44 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,16 @@
WEBSITE_REPO=github.com/hashicorp/terraform-website
WEBSITE_BRANCH=master
.DEFAULT_GOAL := website

CURRENT_GIT_REPO=$$(basename `git rev-parse --show-toplevel`)
CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)

WEBSITE_DOCKER_IMAGE="hashicorp/terraform-website:full"
WEBSITE_DOCKER_IMAGE_LOCAL="hashicorp-terraform-website-local"
WEBSITE_DOCKER_RUN_FLAGS=--interactive \
--rm \
--tty \
--workdir "/website" \
--volume "$(shell pwd)/website:/website/preview" \
--publish "3000:3000" \
-e "IS_CONTENT_PREVIEW=true" \
-e "PREVIEW_FROM_REPO=$(CURRENT_GIT_REPO)" \
-e "NAV_DATA_DIRNAME=./preview/data" \
-e "CONTENT_DIRNAME=./preview/docs" \
-e "CURRENT_GIT_BRANCH=$(CURRENT_GIT_BRANCH)"


# Run the terraform.io website to preview local content changes
# Default: run this if working on the website locally to run in watch mode.
.PHONY: website
website:
@echo "==> Downloading latest Docker image..."
@docker pull ${WEBSITE_DOCKER_IMAGE}
@echo "==> Starting website in Docker..."
@docker run ${WEBSITE_DOCKER_RUN_FLAGS} ${WEBSITE_DOCKER_IMAGE} npm start
$(MAKE) -C website website

# Run the terraform.io website via a locally built docker image
#
# This is useful for development as you may be building an image
# with local changes from the `terraform-website` repo.
# Use this if you have run `website/build-local` to use the locally built image.
.PHONY: website/local
website/local:
@echo "==> Starting website in Docker..."
@docker run ${WEBSITE_DOCKER_RUN_FLAGS} ${WEBSITE_DOCKER_IMAGE_LOCAL} npm start
$(MAKE) -C website website/local

# Build the terraform.io image using `terraform-website` git repo as the build context
# 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/terraform-website.git\#$(WEBSITE_BRANCH) \
-t $(WEBSITE_DOCKER_IMAGE_LOCAL)

# Updates various markdown blocks
# <!-- BEGIN: [...] -->
# <!-- END: [...] -->
gen/readme:
@echo "==> Generating README.md"
@npx -p @hashicorp/platform-cli next-hashicorp markdown-blocks ./README.md

.PHONY: website website/local website/build-local gen/readme
$(MAKE) -C website website/build-local
51 changes: 51 additions & 0 deletions website/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.DEFAULT_GOAL := website

# Set the preview mode for the website shell to "developer" or "io"
PREVIEW_MODE?=developer
REPO?=terraform-docs-agents

# Enable setting alternate docker tool, e.g. 'make DOCKER_CMD=podman'
DOCKER_CMD ?= docker

CURRENT_GIT_BRANCH=$$(git rev-parse --abbrev-ref HEAD)
PWD=$$(pwd)

DOCKER_IMAGE="hashicorp/dev-portal"
DOCKER_IMAGE_LOCAL="dev-portal-local"
DOCKER_RUN_FLAGS=-it \
--publish "3000:3000" \
--rm \
--tty \
--volume "$(PWD)/docs:/app/docs" \
--volume "$(PWD)/img:/app/public" \
--volume "$(PWD)/data:/app/data" \
--volume "$(PWD)/redirects.js:/app/redirects.js" \
--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=../docs" \
-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_CMD) pull $(DOCKER_IMAGE)
@echo "==> Starting website..."
@$(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_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_CMD) build https://github.com/hashicorp/dev-portal.git\#main \
-t $(DOCKER_IMAGE_LOCAL)
7 changes: 1 addition & 6 deletions website/docs/cloud-docs/agents/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: >-
infrastructure. Learn to install, configure, and manage cloud agents.
---

# Terraform Cloud Agents
# Terraform Cloud Agents TEST CHANGE

> **Hands-on:** Try the [Manage Private Environments with Terraform Cloud Agents](https://learn.hashicorp.com/tutorials/terraform/cloud-agents?in=terraform/modules&utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial.

Expand All @@ -28,8 +28,3 @@ Agents allow you to run Terraform operations from a Terraform Cloud workspace on
- Connecting Terraform Cloud workspaces to VCS instances that do not allow access from the public internet. For example, you cannot use agents to connect to a GitHub Enterprise Server instance that requires access to your VPN.

For these use cases, we recommend you leverage the information provided by the [IP Ranges documentation](/cloud-docs/architectural-details/ip-ranges) to permit direct communication from the appropriate Terraform Cloud service to your internal infrastructure.





Loading