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

Tugboat Next.js server can be restarted via Composer command #17400

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
29593bd
Reapply "VACMS-16853: next build branches ftw (#17154)" (#17261)
alexfinnarn Feb 19, 2024
8c68896
Update READMES/cms-content-release.md
alexfinnarn Feb 20, 2024
a6440b8
Update READMES/cms-content-release.md
alexfinnarn Feb 20, 2024
906b8ae
Apply suggestions from code review
alexfinnarn Feb 20, 2024
005f6fc
add separate frontend for next-vets-website
alexfinnarn Feb 20, 2024
a1db72c
Merge branch 'main' into VACMS-16853-next-build-branches-ftw-d
alexfinnarn Feb 20, 2024
55e3c58
change key used for next-vets-website repo
alexfinnarn Feb 20, 2024
f723624
try cloning vets-website a different way to have more git informaiton
alexfinnarn Feb 21, 2024
49d14f6
adjust unit test
alexfinnarn Feb 21, 2024
80a705a
Merge branch 'main' into VACMS-16853-next-build-branches-ftw-d
alexfinnarn Feb 21, 2024
5bc83b2
adjust code after adjusting unit test
alexfinnarn Feb 21, 2024
b2f9935
Merge branch 'main' into VACMS-16853-next-build-branches-ftw-d
alexfinnarn Feb 22, 2024
daa4ac9
add stash and pop to next build frontend script
alexfinnarn Feb 22, 2024
8e304c7
Merge branch 'main' into VACMS-16853-next-build-branches-ftw-d
alexfinnarn Feb 28, 2024
c5589e8
Merge branch 'main' into VACMS-16853-next-build-branches-ftw-d
alexfinnarn Feb 28, 2024
c4d1356
update links on next content release form
alexfinnarn Feb 29, 2024
e429472
restart next server in start command
alexfinnarn Mar 4, 2024
7b401d8
update scripts
alexfinnarn Mar 6, 2024
6b61b51
Merge branch 'main' into VACMS-17209-restart-next-server
alexfinnarn Mar 6, 2024
9e4e810
update scripts
alexfinnarn Mar 7, 2024
4a75fc2
Merge branch 'main' into VACMS-17209-restart-next-server
alexfinnarn Mar 7, 2024
9a3dabc
move around where tugboat env vars are set
alexfinnarn Mar 8, 2024
b0b2808
misspelled the damn root variable; see if can debug faster without tw…
alexfinnarn Mar 8, 2024
b8fc49c
Merge branch 'main' into VACMS-17209-restart-next-server
alexfinnarn Mar 8, 2024
c96a054
more debugging
alexfinnarn Mar 8, 2024
4e032ac
make sure that the app env var is picked up
alexfinnarn Mar 11, 2024
e319374
Merge branch 'main' into VACMS-17209-restart-next-server
alexfinnarn Mar 11, 2024
733a034
take out the debugging now that I know the server starts
alexfinnarn Mar 11, 2024
2e6c92f
Merge branch 'main' into VACMS-17209-restart-next-server
alexfinnarn Mar 11, 2024
225390f
try killing more process types
alexfinnarn Mar 12, 2024
5292ee1
Merge branch 'main' into VACMS-17209-restart-next-server
alexfinnarn Mar 12, 2024
8488432
remove Tugboat steps to make build faster
alexfinnarn Mar 12, 2024
60b8e70
debug
alexfinnarn Mar 12, 2024
241b7ab
add env vars script and set to execute script files
alexfinnarn Mar 13, 2024
1bd3741
DRY env vars
alexfinnarn Mar 13, 2024
c27a2c7
Merge main and bring up to date.
timcosgrove Sep 18, 2024
acc1805
Update Next Build on Tugboat to use proper node version for all scripts.
timcosgrove Sep 18, 2024
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ datadog-setup.php

# Ignore Next (next-build)
next
# Ignore vets-wesite that is used for next-build.
vets-website
# Ignore oauth keys used for validating next-build preview api requests
public.key
private.key
Expand Down
14 changes: 8 additions & 6 deletions .tugboat/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ services:
- mkdir -p "${TUGBOAT_ROOT}/next/public"
- ln -snf "${TUGBOAT_ROOT}/vets-website/build/localhost/generated" "${TUGBOAT_ROOT}/next/public/generated"


# https://www.drush.org/latest/deploycommand/ (updatedb, cache:rebuild, config:import, deploy:hook)
- bash -lc 'drush deploy'

Expand All @@ -226,6 +225,13 @@ services:
- mv "${TUGBOAT_ROOT}/scripts/queue_runner/queue_runner.sh" /etc/service/drupal_events/run
- chmod +x /etc/service/drupal_events/run

# Separate process for next-build preview.
- mkdir -p /etc/service/next_build
- mv "${TUGBOAT_ROOT}/scripts/queue_runner/next_queue_runner.sh" /etc/service/next_build/run
- chmod +x /etc/service/next_build/run
# Need to make build script executable so the runner can run it.
- chmod +x "${TUGBOAT_ROOT}/scripts/next-build-frontend.sh"

clone:
# This j2 command is shared in both the build & clone stages. If modifying, change the other too.
- j2 "${TUGBOAT_ROOT}/.tugboat/.env.j2" -o "${TUGBOAT_ROOT}/.env"
Expand All @@ -248,11 +254,7 @@ services:
- find "${DOCROOT}/vendor/va-gov/content-build/script" -type f -exec chmod +x {} \+

# Put necessary env variables in place for next's Drupal Preview before building server
# Need to construct this way instead of TUGBOAT_DEFAULT_SERVICE_URL in order to drop the trailing /
- echo "NEXT_PUBLIC_DRUPAL_BASE_URL=https://cms-${TUGBOAT_SERVICE_TOKEN}.${TUGBOAT_SERVICE_CONFIG_DOMAIN}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
- echo "NEXT_IMAGE_DOMAIN=https://cms-${TUGBOAT_SERVICE_TOKEN}.${TUGBOAT_SERVICE_CONFIG_DOMAIN}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
- echo "DRUPAL_CLIENT_ID=${DRUPAL_CLIENT_ID}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
- echo "DRUPAL_CLIENT_SECRET=${DRUPAL_CLIENT_SECRET}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
- ${TUGBOAT_ROOT}/scripts/next-set-tugboat-env-vars.sh

# Build storybook and the frontends (web, next) in parallel
- bash -lc 'time task --taskfile=tugboat.yml'
Expand Down
29 changes: 28 additions & 1 deletion READMES/cms-content-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ sequenceDiagram
Complete->>+Ready: Content release workflow has completed
```


# Environment specific details

## BRD Production
Expand Down Expand Up @@ -144,6 +143,34 @@ The Tugboat and local development versions of the release content page do not tr

For more information on creating or releasing content from a preview environment, see [Environments](./environments.md).

### Next Build Releases

The upcoming static frontend "next-build" can be rebuilt using different versions of next-build and vets-website. It
is a simpler process than the current content-build workflow.

1. Go to "/admin/content/deploy/next".
2. If the form elements are disabled, then a lock file exists preventing another build from being triggered. You
can skip to step #6.
2. Choose a version for next-build or leave at default.
3. Choose a version for vets-website or leave at default.
4. Click "Restart Next Build Server" to set the versions of next-build and vets-website as well as write a "buildrequest" file.
5. A `scripts/queue_runner/next_queue_runner.sh` script continuously runs in the background looking for the
"buildrequest" file and then start a build if found. Locally, the script has to be triggered manually. See the
[caveats](#caveats) section for more information.
6. Back on "/admin/content/deploy/next" you can view the server restart log via a link in the "Status" section of the
"Next Build Information" block.
7. Once the restart completes no new restart will be triggered unless you request another restart.
8. View the frontend at the provided "View Preview" link in the "Next Build Information" block.

#### Caveats

There are some caveats to the process outlined above.

- **Manually running the background script** - On `ddev` the `queue_runner` scripts aren't running continuously in
background jobs. So you must `ddev ssh && ./scripts/queue_runner/` to kick off the content build or next build
release locally. In the future, it might be a good idea to use `system.d` or `supervisor` or something else to
keep the background jobs going locally just like on Tugoboat.

## Troubleshooting

Sometimes the state gets stuck and needs to be reset. It can be done with a drush command
Expand Down
13 changes: 13 additions & 0 deletions docroot/modules/custom/va_gov_content_release/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# VA.gov Content Release

va.gov is built using two separate frontend systems with a third being built:

- content-build - This is the frontend for generating static content files. You can read more about the project here:
https://github.com/department-of-veterans-affairs/content-build
- vets-website - This is the frontend for integrating React widgets. You can read more about the project here:
https://github.com/department-of-veterans-affairs/vets-website
- next-build - This is the new frontend for generating static content files. You can read more about the project here:
https://github.com/department-of-veterans-affairs/next-build

More detailed documentation about how these frontends are build and released can be found in the main READMEs
directory on the [CMS Content Release](../../../../READMES/cms-content-release.md) page.
Loading
Loading