Front-end templating, build, and deploy for VA.gov CMS content.
Prerequisites
- VA SOCKS access
- NVM for node version management
- Yarn for package management
You should set these up before attempting to install the repo.
-
Clone the repo if you haven't.
git@github.com:department-of-veterans-affairs/next-build.git
-
Clone the vets-website repo adjacent to next-build in the same parent directory.
git@github.com:department-of-veterans-affairs/vets-website.git
-
In vets-website, set node and yarn to the required versions:
nvm use 14.15.0
&&yarn set version 1.19.1
-
yarn install
andyarn build
. You are now done in vets-website. -
In the next-build directory,
nvm use 18
&&yarn set version stable
-
Run
yarn install
. -
Copy
envs/.env.example
toenvs/.env.local
. This is a reasonable set of environment defaults for local development. -
Make sure your SOCKS access is running. (e.g.
vtk socks on
) -
Run
yarn dev
.
You will now have a Next.js development server running at http://localhost:3000, which will refresh with changes to your local environment.
The APP_ENV flag can be used to designate which .env file you want to use. Ensure your env files are in ./envs
, and then run your build or dev command with a leading APP_ENV=local
.
ie APP_ENV=local yarn dev
Ensure the value passed into APP_ENV matches the file name of the .env file you wish to use.
If no value is passed .env.local
will be used as the default
To use the local CMS as an endpoint, follow the install directions for the CMS repo here.
While installing those dependencies, you will run mkcert -install
. This certificate is used by ddev, and also
needs to be used by next-build to enable connections over https://
locally.
Steps to do so:
mkcert -CAROOT
to find where the rootCA.pem was installed
cp the/above/directory/rootCA.pem path/to/next-build/certs/rootCA.pem
This certificate should be git ignored by default. In your .env.local
file, update the endpoints to:
# This is the standard lower environment for Content API.
#NEXT_PUBLIC_DRUPAL_BASE_URL=https://content-build-medc0xjkxm4jmpzxl3tfbcs7qcddsivh.ci.cms.va.gov
#NEXT_IMAGE_DOMAIN=https://content-build-medc0xjkxm4jmpzxl3tfbcs7qcddsivh.ci.cms.va.gov
# If running va.gov-cms locally
NEXT_PUBLIC_DRUPAL_BASE_URL=https://va-gov-cms.ddev.site
NEXT_IMAGE_DOMAIN=https://va-gov-cms.ddev.site
Now you can run yarn dev
and data will be coming from your local CMS environment instead.