Skip to content

Commit ba007a6

Browse files
tjheffnerjilladamsdependabot[bot]ndouglasedmund-dunn
authored
VACMS-15798 / 15791 / 15795 next preview configs + oauth key handling (#15936)
* gitignore public/private key for oauth * export config for simple_oauth and next js site * use simple oauth for preview in next * echo keys to files in tugboat * add other env vars where they need to be * [docs] Update and rename pw-dark-launch.md to dark-launch.md * Bump datadog/dd-trace from 0.92.2 to 0.93.1 (#15937) Bumps [datadog/dd-trace](https://github.com/DataDog/dd-trace-php) from 0.92.2 to 0.93.1. - [Release notes](https://github.com/DataDog/dd-trace-php/releases) - [Commits](DataDog/dd-trace-php@0.92.2...0.93.1) --- updated-dependencies: - dependency-name: datadog/dd-trace dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * VACMS-14342: Set up `CODEOWNERS` (#15581) * VACMS-14342: Set up CODEOWNERS * h/t Dave * h/t Tanner * h/t Dave * Update .github/CODEOWNERS * Apply suggestions from code review h/t @swirtSJW * Bump va-gov/content-build from 0.0.3377 to 0.0.3378 (#15938) Bumps [va-gov/content-build](https://github.com/department-of-veterans-affairs/content-build) from 0.0.3377 to 0.0.3378. - [Release notes](https://github.com/department-of-veterans-affairs/content-build/releases) - [Commits](department-of-veterans-affairs/content-build@v0.0.3377...v0.0.3378) --- updated-dependencies: - dependency-name: va-gov/content-build dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * VACMS-15721: added description field for alert blocks view and browser (#15927) * VACMS-15276: Adds YouTube field (#15450) * VACMS-15276: Adds YouTube field * VACMS-15276: Adding field storage for YouTube * VACMS-15891: Update Q&A Content Report View to use Multiple Workflow Filter (#15896) * VACMS-15891: Update workflow filter to multiple * VACMS-15891: Updated the filter machine name too because Jill is smart. * VACMS-15891: Style-Guide-Related edits to view * VACMS-15891: Added section filter * VACMS-15891: Fix caption * VACMS-15891: Caption and tab * VACMS-15891: Copying new settings from view family * VACMS-15891: Fix pager back to 25 for cypress test * update perms for nextjs role * update perms for nextjs role * re-export config for correct dependencies * override config for tugboat * include full domains in the url path... * a couple more env vars in place * env vars need added before build * tweak env vars slightly * quote env vars --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Jill Adams <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Nate Douglas <[email protected]> Co-authored-by: Edmund Dunn <[email protected]> Co-authored-by: Christian Burk <[email protected]> Co-authored-by: Christia Troyer <[email protected]>
1 parent 87c41e5 commit ba007a6

7 files changed

+48
-5
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ datadog-setup.php
104104

105105
# Ignore Next (next-build)
106106
next
107+
# Ignore oauth keys used for validating next-build preview api requests
108+
public.key
109+
private.key
107110

108111
# Temporary .deb packages
109112
*.deb

.tugboat/config.yml

+14-2
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ services:
104104
- cp "${TUGBOAT_ROOT}"/.tugboat/*.crt /usr/local/share/ca-certificates
105105
- update-ca-certificates
106106

107+
# Write OAuth keys to files for next-build Preview Server validation
108+
- echo "${OAUTH_PUBLIC_KEY}" >> ${TUGBOAT_ROOT}/public.key
109+
- echo "${OAUTH_PRIVATE_KEY}" >> ${TUGBOAT_ROOT}/private.key
110+
107111
# Install drush-launcher, if desired.
108112
- wget -O /usr/local/bin/drush https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar
109113
- chmod +x /usr/local/bin/drush
@@ -233,9 +237,17 @@ services:
233237
- find -L "${DOCROOT}/vendor/va-gov/content-build/node_modules/.bin" -type f -exec chmod +x {} \+
234238
- find "${DOCROOT}/vendor/va-gov/content-build/script" -type f -exec chmod +x {} \+
235239

236-
# Build storybook and the frontends in parallel
240+
# Put necessary env variables in place for next's Drupal Preview before building server
241+
# Need to construct this way instead of TUGBOAT_DEFAULT_SERVICE_URL in order to drop the trailing /
242+
- echo "NEXT_PUBLIC_DRUPAL_BASE_URL=https://cms-${TUGBOAT_SERVICE_TOKEN}.${TUGBOAT_SERVICE_CONFIG_DOMAIN}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
243+
- echo "NEXT_IMAGE_DOMAIN=https://cms-${TUGBOAT_SERVICE_TOKEN}.${TUGBOAT_SERVICE_CONFIG_DOMAIN}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
244+
- echo "DRUPAL_CLIENT_ID=${DRUPAL_CLIENT_ID}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
245+
- echo "DRUPAL_CLIENT_SECRET=${DRUPAL_CLIENT_SECRET}" >> ${TUGBOAT_ROOT}/next/envs/.env.tugboat
246+
247+
# Build storybook and the frontends (web, next) in parallel
237248
- bash -lc 'time task --taskfile=tugboat.yml'
238-
# Build next build server
249+
250+
# Start the next build server
239251
- bash -lc 'composer va:next:start'
240252

241253
memcache:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
uuid: 75dd1bfb-8507-4981-90b6-3830400e1434
2+
langcode: en
3+
status: true
4+
dependencies: { }
5+
id: next_build_preview_server
6+
label: 'Next Build Preview Server'
7+
base_url: 'http://localhost:3000'
8+
preview_url: 'http://localhost:3000/api/preview'
9+
preview_secret: secret
10+
revalidate_url: ''
11+
revalidate_secret: ''

config/sync/next.settings.yml

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ site_previewer_configuration:
66
width: 100%
77
sync_route: false
88
sync_route_skip_routes: ''
9+
preview_url_generator: simple_oauth
10+
preview_url_generator_configuration:
11+
secret_expiration: 300
12+
debug: false

config/sync/simple_oauth.settings.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ _core:
33
access_token_expiration: 300
44
authorization_code_expiration: 300
55
refresh_token_expiration: 1209600
6-
remember_clients: true
76
token_cron_batch_size: 0
7+
public_key: ../public.key
8+
private_key: ../private.key
9+
remember_clients: true
810
use_implicit: false
911
disable_openid_connect: false

config/sync/user.role.next_js.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ langcode: en
33
status: true
44
dependencies:
55
module:
6+
- content_moderation
7+
- media
68
- node
79
- subrequests
10+
- system
811
- va_gov_backend
912
third_party_settings:
1013
va_gov_backend:
1114
vgb_description: 'Role for Next.js JSON API data access.'
1215
id: next_js
1316
label: Next.js
14-
weight: 8
17+
weight: 7
1518
is_admin: null
1619
permissions:
20+
- 'access content'
1721
- 'access user profiles'
18-
- 'bypass node access'
1922
- 'issue subrequests'
23+
- 'view all revisions'
24+
- 'view any unpublished content'
25+
- 'view latest version'
26+
- 'view media'

docroot/sites/default/settings/settings.tugboat.php

+4
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
$config['environment_indicator.indicator']['fg_color'] = '#212121';
3838
$config['environment_indicator.indicator']['name'] = 'Tugboat';
3939

40+
// Update next-build site endpoint to the appropriate tugboat alias
41+
$config['next.next_site.next_build_preview_server']['base_url'] = 'https://next-' . getenv('TUGBOAT_SERVICE_TOKEN') . '.' . getenv('TUGBOAT_SERVICE_CONFIG_DOMAIN');
42+
$config['next.next_site.next_build_preview_server']['preview_url'] = 'https://next-' . getenv('TUGBOAT_SERVICE_TOKEN') . '.' . getenv('TUGBOAT_SERVICE_CONFIG_DOMAIN') . '/api/preview';
43+
4044
$settings['trusted_host_patterns'] = [
4145
'^localhost$',
4246
'^.*' . getenv('TUGBOAT_SERVICE_TOKEN') . '.' . getenv('TUGBOAT_SERVICE_CONFIG_DOMAIN') . '$',

0 commit comments

Comments
 (0)