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

VACMS-15798 / 15791 / 15795 next preview configs + oauth key handling #15936

Merged
merged 23 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3d6ac5c
gitignore public/private key for oauth
tjheffner Oct 31, 2023
5f10440
export config for simple_oauth and next js site
tjheffner Oct 31, 2023
78d8571
use simple oauth for preview in next
tjheffner Nov 1, 2023
6723545
echo keys to files in tugboat
tjheffner Nov 1, 2023
383e2aa
add other env vars where they need to be
tjheffner Nov 1, 2023
6cc308b
[docs] Update and rename pw-dark-launch.md to dark-launch.md
jilladams Oct 31, 2023
500c3af
Bump datadog/dd-trace from 0.92.2 to 0.93.1 (#15937)
dependabot[bot] Nov 1, 2023
65d6b69
VACMS-14342: Set up `CODEOWNERS` (#15581)
ndouglas Nov 1, 2023
db5a601
Bump va-gov/content-build from 0.0.3377 to 0.0.3378 (#15938)
dependabot[bot] Nov 1, 2023
26d508f
VACMS-15721: added description field for alert blocks view and browse…
edmund-dunn Nov 1, 2023
faf0881
VACMS-15276: Adds YouTube field (#15450)
omahane Nov 1, 2023
1181bdf
VACMS-15891: Update Q&A Content Report View to use Multiple Workflow …
chri5tia Nov 1, 2023
766efbb
update perms for nextjs role
tjheffner Nov 1, 2023
ac52c8b
update perms for nextjs role
tjheffner Nov 2, 2023
a281059
fix conflict
tjheffner Nov 2, 2023
c98fef7
re-export config for correct dependencies
tjheffner Nov 2, 2023
4ab2ef2
override config for tugboat
tjheffner Nov 7, 2023
5fa02a8
include full domains in the url path...
tjheffner Nov 7, 2023
5d01d85
a couple more env vars in place
tjheffner Nov 8, 2023
6bf5949
Merge branch 'main' into VACMS-15798-next-preview-configs
tjheffner Nov 8, 2023
051dce1
env vars need added before build
tjheffner Nov 8, 2023
609901e
tweak env vars slightly
tjheffner Nov 8, 2023
5baf0f3
quote env vars
tjheffner Nov 9, 2023
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ datadog-setup.php

# Ignore Next (next-build)
next
# Ignore oauth keys used for validating next-build preview api requests
public.key
private.key

# Temporary .deb packages
*.deb
Expand Down
16 changes: 14 additions & 2 deletions .tugboat/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ services:
- cp "${TUGBOAT_ROOT}"/.tugboat/*.crt /usr/local/share/ca-certificates
- update-ca-certificates

# Write OAuth keys to files for next-build Preview Server validation
- echo "${OAUTH_PUBLIC_KEY}" >> ${TUGBOAT_ROOT}/public.key
- echo "${OAUTH_PRIVATE_KEY}" >> ${TUGBOAT_ROOT}/private.key

# Install drush-launcher, if desired.
- wget -O /usr/local/bin/drush https://github.com/drush-ops/drush-launcher/releases/download/0.6.0/drush.phar
- chmod +x /usr/local/bin/drush
Expand Down Expand Up @@ -233,9 +237,17 @@ services:
- find -L "${DOCROOT}/vendor/va-gov/content-build/node_modules/.bin" -type f -exec chmod +x {} \+
- find "${DOCROOT}/vendor/va-gov/content-build/script" -type f -exec chmod +x {} \+

# Build storybook and the frontends in parallel
# 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

# Build storybook and the frontends (web, next) in parallel
- bash -lc 'time task --taskfile=tugboat.yml'
# Build next build server

# Start the next build server
- bash -lc 'composer va:next:start'

memcache:
Expand Down
11 changes: 11 additions & 0 deletions config/sync/next.next_site.next_build_preview_server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
uuid: 75dd1bfb-8507-4981-90b6-3830400e1434
langcode: en
status: true
dependencies: { }
id: next_build_preview_server
label: 'Next Build Preview Server'
base_url: 'http://localhost:3000'
preview_url: 'http://localhost:3000/api/preview'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noting these two urls work for local testing with next-build running separately outside of ddev.
these are overwritten in settings.tugboat.php

preview_secret: secret
revalidate_url: ''
revalidate_secret: ''
4 changes: 4 additions & 0 deletions config/sync/next.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ site_previewer_configuration:
width: 100%
sync_route: false
sync_route_skip_routes: ''
preview_url_generator: simple_oauth
preview_url_generator_configuration:
secret_expiration: 300
debug: false
4 changes: 3 additions & 1 deletion config/sync/simple_oauth.settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ _core:
access_token_expiration: 300
authorization_code_expiration: 300
refresh_token_expiration: 1209600
remember_clients: true
token_cron_batch_size: 0
public_key: ../public.key
private_key: ../private.key
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

relative to docroot/

remember_clients: true
use_implicit: false
disable_openid_connect: false
11 changes: 9 additions & 2 deletions config/sync/user.role.next_js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,24 @@ langcode: en
status: true
dependencies:
module:
- content_moderation
- media
- node
- subrequests
- system
- va_gov_backend
third_party_settings:
va_gov_backend:
vgb_description: 'Role for Next.js JSON API data access.'
id: next_js
label: Next.js
weight: 8
weight: 7
is_admin: null
permissions:
- 'access content'
- 'access user profiles'
- 'bypass node access'
- 'issue subrequests'
- 'view all revisions'
- 'view any unpublished content'
- 'view latest version'
- 'view media'
6 changes: 5 additions & 1 deletion docroot/sites/default/settings/settings.tugboat.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
$config['environment_indicator.indicator']['fg_color'] = '#212121';
$config['environment_indicator.indicator']['name'] = 'Tugboat';

// Update next-build site endpoint to the appropriate tugboat alias
$config['next.next_site.next_build_preview_server']['base_url'] = 'https://next-' . getenv('TUGBOAT_SERVICE_TOKEN') . '.' . getenv('TUGBOAT_SERVICE_CONFIG_DOMAIN');
$config['next.next_site.next_build_preview_server']['preview_url'] = 'https://next-' . getenv('TUGBOAT_SERVICE_TOKEN') . '.' . getenv('TUGBOAT_SERVICE_CONFIG_DOMAIN') . '/api/preview';

$settings['trusted_host_patterns'] = [
'^localhost$',
'^.*' . getenv('TUGBOAT_SERVICE_TOKEN') . '.' . getenv('TUGBOAT_SERVICE_CONFIG_DOMAIN') . '$',
Expand Down Expand Up @@ -71,7 +75,7 @@

// PIV login does not currently work on Tugboat.
//
// To avoid confusing editors, we want to disable PIV login completely on
// To avoid confusing editors, we want to disable PIV login completely on
// Tugboat demo environments.
//
// However, we want to _preserve_ the PIV login interface on Tugboat PR
Expand Down
Loading