From 87205c6ce35f0f0e8c31f7419a6ef56053a6ed8f Mon Sep 17 00:00:00 2001 From: Josh Heyer Date: Thu, 7 Nov 2024 21:37:36 +0000 Subject: [PATCH] upm link updates - use perma-urls --- .../creating_cluster/creating_a_cluster.mdx | 12 +++- .../connecting_azure.mdx | 1 + .../connecting_to_your_cloud/index.mdx | 1 - .../your_cloud_account/managing_regions.mdx | 3 + .../preparing_cloud_account/index.mdx | 1 - .../preparing_azure/index.mdx | 1 + .../backup_and_restore.mdx | 2 + .../05_db_configuration_parameters.mdx | 2 + .../periodic_maintenance.mdx | 2 + .../distributed_highavailability.mdx | 2 + .../supported_database_versions.mdx | 4 ++ .../connect_from_a_client/index.mdx | 3 + .../connecting_your_cluster/index.mdx | 1 - .../using_cluster/faraway_replicas.mdx | 2 + .../other_monitoring/index.mdx | 4 ++ .../database_authentication.mdx | 6 ++ .../organizations/identity_provider/index.mdx | 4 ++ .../console/using/projects/index.mdx | 1 - .../console/using/projects/users.mdx | 2 + gatsby-node.js | 54 +++++++++++++-- product_docs/docs/pgd/5.6/cli/index.mdx | 2 + src/components/index.js | 2 + src/components/layout.js | 2 + src/components/purl-anchor.js | 68 +++++++++++++++++++ 24 files changed, 169 insertions(+), 13 deletions(-) create mode 100644 src/components/purl-anchor.js diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/creating_cluster/creating_a_cluster.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/creating_cluster/creating_a_cluster.mdx index 23927134752..f4fd50a94fb 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/creating_cluster/creating_a_cluster.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/creating_cluster/creating_a_cluster.mdx @@ -7,8 +7,6 @@ redirects: - /purl/upm/cluster-settings-tab/ - /purl/upm/read-only-connections/ - /purl/upm/csp-auth/ - - /purl/upm/csp-azure-ad-usermanagement/ - - /purl/upm/csp-aws-ad-usermanagement/ - /purl/upm/create-a-cluster/ - /purl/upm/private-endpoints-info/ - /purl/upm/read-only-workloads/ @@ -173,7 +171,7 @@ The following options aren't available when creating your cluster: When provisioning database storage, not all of the storage space you specify is available for holding your data. Some space is reserved for other purposes. For a full explanation of the structure of a Postgres data directory, see [Database File Layout](https://www.postgresql.org/docs/current/storage-file-layout.html). You can make more storage space available for data if you specify separate storage for write ahead logs (WAL). -8. In the **Network, Logs, & Telemetry** section: +8. In the **Network, Logs, & Telemetry** section: In **Connectivity Type**, specify whether to use private or public networking. Networking is set to **Public** by default. Public means that any client can connect to your cluster’s public IP address over the internet. Optionally, you can limit traffic to your public cluster by specifying an IP allowlist, which allows access only to certain blocks of IP addresses. To limit access, select **Use allowlists** and add one or more classless inter-domain routing (CIDR) blocks. CIDR is a method for allocating IP addresses and IP routing to a whole network or subnet. If you have any CIDR block entries, access is limited to those IP addresses. If none are specified, all network traffic is allowed. @@ -224,8 +222,12 @@ For more information, see [Periodic maintenance](/edb-postgres-ai/cloud-service/ ### Connections + + #### Read-only workloads + + !!! Note The **Read-only Workloads** option is not available on single node clusters. @@ -259,6 +261,8 @@ Use the **PgBouncer Configuration Settings** menu to set PgBouncer-specific sett #### Identity and Access Management (IAM) Authentication + + Enable **Identity and Access Management (IAM) Authentication** to turn on the ability to log in to Postgres using your AWS IAM credentials. For this feature to take effect, after you create the cluster, you must add each user to a role that uses AWS IAM authentication in Postgres. For details, see [IAM authentication for Postgres](/edb-postgres-ai/cloud-service/using_cluster/postgres_access/database_authentication/#iam-authentication-for-postgres). #### Superuser Access @@ -267,6 +271,8 @@ Enable **Superuser Access** to grant superuser privileges to the edb_admin role. ### Security + + Enable **Transparent Data Encryption (TDE)** to use your own encryption key. This option is available for EDB Postgres Advanced Server and EDB Postgres Extended Server for version 15 and later. Select an encryption key from your project and region to encrypt the cluster with TDE. To learn more about TDE support, see [Transparent Data Encryption](/edb-postgres-ai/cloud-service/security/security/#your-own-encryption-key---transparent-data-encryption-tde). !!!Note "Important" diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/connecting_azure.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/connecting_azure.mdx index 6dfa692e370..5366d01c476 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/connecting_azure.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/connecting_azure.mdx @@ -2,6 +2,7 @@ title: Connecting your Azure cloud navTitle: Azure redirects: + - /purl/upm/azure-subscription/ - /biganimal/latest/getting_started/02_connecting_to_your_cloud/connecting_azure/ #generated for BigAnimal URL path removal branch - /biganimal/latest/getting_started/02_azure_market_setup/ --- diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/index.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/index.mdx index c252d8bed0b..f0958c08f43 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/index.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/connecting_to_your_cloud/index.mdx @@ -2,7 +2,6 @@ title: Connecting your cloud description: How to connect your own cloud account to the Cloud Service redirects: - - /purl/upm/azure-subscription/ - /purl/upm/connect-your-cloud-overview/ - /purl/upm/connect-your-cloud/ - /biganimal/latest/getting_started/02_connect_cloud_account/ diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/managing_regions.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/managing_regions.mdx index e937591a253..569be52702d 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/managing_regions.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/managing_regions.mdx @@ -36,6 +36,9 @@ You can activate a region ahead of time using the Regions page. ## Suspend, reactivate, or delete a region + + + Before you suspend or delete a region, you must delete all clusters in that region. 1. On the left panel, select **Regions**. diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/index.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/index.mdx index 63e27c31d4f..80b01550dc3 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/index.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/index.mdx @@ -4,7 +4,6 @@ indexCards: simple description: When using Your Cloud Account, how to ensure its readiness to work with EDB Postgres AI. redirects: - /purl/upm/cloud-readiness/ - - /purl/upm/azure-raise-resource-limits/ - /biganimal/latest/getting_started/01_check_resource_limits/ - /biganimal/latest/getting_started/preparing_cloud_account/ #generated for BigAnimal URL path removal branch navigation: diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/preparing_azure/index.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/preparing_azure/index.mdx index 6578a8dc1ad..874b307e4de 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/preparing_azure/index.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/getting_started/your_cloud_account/preparing_cloud_account/preparing_azure/index.mdx @@ -2,6 +2,7 @@ title: "Preparing your Azure account" description: Prepare your Azure account to manage databases on EDB Postgres AI Cloud Service. redirects: + - /purl/upm/azure-raise-resource-limits/ - /biganimal/latest/getting_started/01_preparing_azure/ - /biganimal/latest/getting_started/preparing_cloud_account/01_preparing_azure/ #generated for BigAnimal URL path removal branch --- diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/backup_and_restore.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/backup_and_restore.mdx index 869c160a29b..b09154bddb8 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/backup_and_restore.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/backup_and_restore.mdx @@ -43,6 +43,8 @@ To determine the replication lag, you can compare the last log sequence number ( ## Restores + + If a restore is necessary—for example, in case of an accidental `DROP TABLE` statement—you can restore clusters to any point in the backup retention period. Cluster restores aren't performed in place on an existing cluster. Instead, a new cluster is created and initialized with data from the backup archive. Restores must replay the transaction logs between the most recent full database backup and the target restore point. Thus restore times (that is, RTO) depend on the write activity in the source cluster. diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/modifying_your_cluster/05_db_configuration_parameters.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/modifying_your_cluster/05_db_configuration_parameters.mdx index e21188d29ad..4f4bc0ba9d7 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/modifying_your_cluster/05_db_configuration_parameters.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/modifying_your_cluster/05_db_configuration_parameters.mdx @@ -23,6 +23,8 @@ Not all database configuration parameters are supported by Cloud Service. Some p ## Using formulas for parameter values + + In addition to entering specific values for parameters, for some parameters you can specify formulas to calculate a value. You can use formulas for parameters of type integer and real in ternary formulas, such as the [shared buffer example](#examples), using the following operators: `+ - / * > >= < <= == != && || ! ? : ( )`. Use `?` and `:` . Use `( )` to specify [order of operations](#order-of-operations), if needed. GUCs used in formulas must also be of type integer or real. All arithmetic is done on 64-bit floating point values rounded to an integer result if the target GUC is of type integer and not real. BigAnimal has what we refer to as *psuedo GUCs* to help with creating equations. These read-only GUCs are: diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/periodic_maintenance.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/periodic_maintenance.mdx index 847312e0855..c48c0c62da7 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/periodic_maintenance.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/managing_your_cluster/periodic_maintenance.mdx @@ -18,6 +18,8 @@ In some cases, these updates might terminate existing network connections to you ## Specifying maintenance windows + + If you want to control when the updates are pushed, you can specify a weekly maintenance window for each cluster or each data group in the case of a distributed high-availability cluster. BigAnimal displays a *scheduled maintenance* message on your cluster list four hours prior to the scheduled maintenance time to remind you of the upcoming maintenance window. This reminder allows you to make any necessary preparations, such as saving your work and closing any open connections. For more information on specifying maintenance windows, see [Maintenance](/edb-postgres-ai/cloud-service/getting_started/creating_cluster/creating_a_cluster/#maintenance). ## Maintenance for high-availability clusters diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_cluster_types/distributed_highavailability.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_cluster_types/distributed_highavailability.mdx index ca11619eb9f..2eb8fdf3849 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_cluster_types/distributed_highavailability.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_cluster_types/distributed_highavailability.mdx @@ -63,6 +63,8 @@ Cross-cloud service provider witness nodes are available with AWS, Azure, and Go ## Read-only workloads + + When you enable the read-only workloads option during the cluster creation, a read-only connection string is created for the data group. You can use this connection to allow your application or service to route read-only requests through the shadow nodes (non-write leaders) to lighten the load on the write leaders and improve the distributed high-availability cluster's performance. If you have more than one data group, you can choose whether to enable the read-only workloads option on a per-data-group basis. diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_database_versions.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_database_versions.mdx index 024d731cc0d..dfd434e61ea 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_database_versions.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/references/supported_database_versions.mdx @@ -20,6 +20,8 @@ We support the major Postgres versions from the date they're made available unti ## End-of-life policy + + Cloud Service deprecates support for Postgres versions following the same timeline as PostgreSQL. PostgreSQL, EDB Postgres Advanced Server, and EDB Postgres Extended Server follow the same timelines. We recommend that you take action and upgrade your Postgres databases running on the deprecated version to a later version as soon as possible. Six months before the PostgreSQL deprecation date, Cloud Service doesn't allow you to create new instances with the deprecated database version. @@ -30,6 +32,8 @@ The only exception is customers who purchased Extended Life Support (ELS) prior ## Key dates + + While PostgreSQL officially deprecated version 11 on November 9, 2023, Cloud Service deprecated PostgreSQL 11 on November 20, 2023 in alignment with the broader EDB portfolio. On November 20, 2023, Cloud Service deprecated support for PostgreSQL 11 and EDB Postgres Advanced Server 11 using the following schedule. We recommend that you take action and upgrade your Postgres databases running on major version 11 to a later version, such as PostgreSQL version 15. diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connect_from_a_client/index.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connect_from_a_client/index.mdx index 88b746a5356..f334108bfc7 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connect_from_a_client/index.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connect_from_a_client/index.mdx @@ -8,6 +8,7 @@ navigation: - connect_using_dbeaver - connecting_from_a_client redirects: + - /purl/upm/ssl-production-recommendation/ - /biganimal/latest/free_trial/detail/connect_to_a_cluster/ #generated for BigAnimal URL path removal branch - /biganimal/latest/using_cluster/02_connecting_your_cluster/connecting_from_a_client/ --- @@ -28,6 +29,8 @@ You can connect to your cluster using the client of your choice including: ## Recommended settings for SSL mode + + Different clients can have different default TLS/SSL modes (sslmode). For example, `psql` defaults to `prefer`, which means the client attempts to establish a TLS connection but falls back to non-TLS if the server doesn't support it. In the `psql` example provided by EDB in the **Quick Connect** field, `sslmode` is explicitly set to `require`, which means the client attempts a TLS connection and fails if the connection to the server can't be encrypted. For public connections and in most environments, EDB recommends setting `sslmode` to `verify-full`. This setting ensures that you connect to the server you specified and that the connection is encrypted. diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connecting_your_cluster/index.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connecting_your_cluster/index.mdx index 9d205515cf0..ffd32b9851f 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connecting_your_cluster/index.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/connecting_your_cluster/index.mdx @@ -3,7 +3,6 @@ title: "Connecting to your cluster" description: Connect to your cluster from your applications, client apps, and EDB's tools. redirects: - /purl/upm/connect-to-cluster/ - - /purl/upm/ssl-production-recommendation/ - /biganimal/latest/using_cluster/02_connect_to_cluster/ - connecting_your_cluster - /biganimal/latest/using_cluster/02_connecting_your_cluster/ #generated for BigAnimal URL path removal branch diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/faraway_replicas.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/faraway_replicas.mdx index cab5230eaca..fe281ee18cb 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/faraway_replicas.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/faraway_replicas.mdx @@ -75,6 +75,8 @@ You can create faraway replicas in any active regions in your cloud. There's no ## Modify a replica + + 1. Sign in to the [Console](https://portal.biganimal.com/). 2. Go to the [Clusters](https://portal.biganimal.com/clusters) page. A list of previously created clusters appears. diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/monitoring_and_logging/other_monitoring/index.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/monitoring_and_logging/other_monitoring/index.mdx index 5a033e635f7..8e5e6c3576e 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/monitoring_and_logging/other_monitoring/index.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/monitoring_and_logging/other_monitoring/index.mdx @@ -13,6 +13,8 @@ redirects: ## Metrics + + You can access metrics in a [Prometheus format](https://prometheus.io/docs/concepts/data_model/) if you request this feature from Cloud Service Support. You can retrieve the hostname and port for your clusters by using the Prometheus URL available on the **Monitoring and logging** tab on each cluster's detail page in the Console. These [example metrics](example_metrics/) can help you get started. @@ -31,6 +33,8 @@ For more information on some common monitoring services, see: ## Logs + + You can view your logs in your cloud provider's blob storage solution if you request this feature from Cloud Service Support. You can retrieve the location of your object storage on the **Monitoring and logging** tab on your cluster's detail page in the Console. The general pattern for getting logs from blob storage into the cloud provider's solution is to write a custom serverless function that watches the blob storage and uploads to the desired solution. diff --git a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/postgres_access/database_authentication.mdx b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/postgres_access/database_authentication.mdx index f5034349942..bce8dd86d0f 100644 --- a/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/postgres_access/database_authentication.mdx +++ b/advocacy_docs/edb-postgres-ai/cloud-service/using_cluster/postgres_access/database_authentication.mdx @@ -4,6 +4,8 @@ description: Setting up the database authentication for the Postgres clusters. redirects: - /purl/upm/csp-auth-use/ - /purl/upm/iam-auth-postgres/ + - /purl/upm/csp-aws-ad-usermanagement/ + - /purl/upm/csp-azure-ad-usermanagement/ - /biganimal/latest/using_cluster/01_postgres_access/ #generated for BigAnimal URL path removal branch --- @@ -75,6 +77,10 @@ If you use a single database to host multiple schemas, create a database owner a ## IAM authentication for Postgres + + + + Any user with a supported cloud account connected to a BigAnimal subscription who has the Postgres IAM role iam_aws, iam_azure, or iam_gcp can authenticate to the database using their IAM credentials. ### Configuring IAM for Postgres diff --git a/advocacy_docs/edb-postgres-ai/console/using/organizations/identity_provider/index.mdx b/advocacy_docs/edb-postgres-ai/console/using/organizations/identity_provider/index.mdx index 67e996473d1..0c79ecee86a 100644 --- a/advocacy_docs/edb-postgres-ai/console/using/organizations/identity_provider/index.mdx +++ b/advocacy_docs/edb-postgres-ai/console/using/organizations/identity_provider/index.mdx @@ -92,6 +92,8 @@ Step-by-step instructions for setting up specific identity providers are availab ### Add a domain + + You need a verified domain so your users can have a streamlined login experience with their email address. 1. On the **Domains** tab, enter the domain name and select **Next: Verify Domain**. @@ -160,6 +162,8 @@ You add users through your identity provider. A user who you add in the identity ### Add a tile + + Once you establish the identity provider, you can create a EDB Postgres AI tile for users to access the organization's EDB Postgres AI application. To do so, copy the quick sign-in URL from the **Settings > Identity Provider** page of the EDB Postgres AI portal. For details on how to add a tile, refer to your identify provider documentation for instructions on setting up SSO access to your application. ## Next steps diff --git a/advocacy_docs/edb-postgres-ai/console/using/projects/index.mdx b/advocacy_docs/edb-postgres-ai/console/using/projects/index.mdx index 97a58b773aa..8ad75ca0288 100644 --- a/advocacy_docs/edb-postgres-ai/console/using/projects/index.mdx +++ b/advocacy_docs/edb-postgres-ai/console/using/projects/index.mdx @@ -16,7 +16,6 @@ navigation: - settings - migrate redirects: -- /purl/upm/project-manage/ - /biganimal/latest/administering_cluster/projects/ --- diff --git a/advocacy_docs/edb-postgres-ai/console/using/projects/users.mdx b/advocacy_docs/edb-postgres-ai/console/using/projects/users.mdx index 1cc11369198..ac377d83a4b 100644 --- a/advocacy_docs/edb-postgres-ai/console/using/projects/users.mdx +++ b/advocacy_docs/edb-postgres-ai/console/using/projects/users.mdx @@ -3,6 +3,8 @@ title: Managing project users navTitle: Users description: Add users to projects and assign roles to control access to projects deepToC: true +redirects: +- /purl/upm/project-manage/ --- The **Users** page displays all the users in the organisation in a table. Each users full name, email, project roles, identity provider, and on the right hand side, a pen icon. Selecting the pen icon on a user allows you to assign or remove roles from that user. diff --git a/gatsby-node.js b/gatsby-node.js index 2c8337ebd1c..d93cbae8452 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -635,6 +635,26 @@ exports.onPostBuild = async ({ graphql, reporter, pathPrefix }) => { // // additional headers // + await addHeaders(graphql, reporter, pathPrefix); + + // + // redirects cleanup + // + await rewriteRedirects(pathPrefix, reporter); +}; + +/** + * Adds content type headers for raw files + * @param {function} graphql + * @param {GatsbyReporter} reporter + * @param {string} pathPrefix + */ +async function addHeaders(graphql, reporter, pathPrefix) { + const contentHeaderTimer = reporter.activityTimer( + "adding content type headers", + ); + contentHeaderTimer.start(); + const publicFileData = await graphql(` query { allPublicFile { @@ -699,17 +719,38 @@ exports.onPostBuild = async ({ graphql, reporter, pathPrefix }) => { "public/_headers", (await readFile("public/_headers")) + "\n" + newHeaders.join("\n"), ); + contentHeaderTimer.end(); +} + +/** + * Rewrites generated headers: + * - fix up unnecessary path prefix for legacy redirects + * - add hash for perma-URLs + * @param {string} pathPrefix + * @param {GatsbyReporter} reporter + */ +async function rewriteRedirects(pathPrefix, reporter) { + const redirectTimer = reporter.activityTimer("rewriting redirects"); + redirectTimer.start(); - // - // redirects cleanup - // const originalRedirects = await readFile("public/_redirects"); // rewrite legacy redirects to exclude the /docs prefix + // rewrite perma-URL redirects to include hash const prefixRE = new RegExp(`^${pathPrefix}/edb-docs/`); + const purlRE = new RegExp( + `^/docs/purl/(?[^/]+)/(?[^/]+)/?\\s+(?\\S+)\\s+\\d+`, + ); let rewrittenRedirects = originalRedirects .split("\n") .map((line) => line.replace(prefixRE, "/edb-docs/")) + .map((line) => + line.replace( + purlRE, + pathPrefix + + "/purl/$/$/ $#$_$ 302", + ), + ) .join("\n"); if (rewrittenRedirects.length === originalRedirects.length) { @@ -764,17 +805,18 @@ exports.onPostBuild = async ({ graphql, reporter, pathPrefix }) => { # Netlify pathPrefix path rewrite ${pathPrefix}/* /:splat 200`, ); -}; + redirectTimer.end(); +} /** * Strip compilation hashes from generated HTML * this speeds up Netlify deploys, as (otherwise unchanged) files don't change every build * there probably should be a faster / more elegant way to do this, possibly by overriding one of the * default webpack configs... But I've had no luck doing so up to now. - * @param {*} reporter Gatsby reporter + * @param {GatsbyReporter} reporter Gatsby reporter */ async function removeCompilationHashes(reporter) { - const hashTimer = reporter.createProgress("Removing compilation hashes"); + const hashTimer = reporter.createProgress("removing compilation hashes"); hashTimer.start(); const { globby } = await import("globby"); diff --git a/product_docs/docs/pgd/5.6/cli/index.mdx b/product_docs/docs/pgd/5.6/cli/index.mdx index f95b828e8b7..e3c7b442bc4 100644 --- a/product_docs/docs/pgd/5.6/cli/index.mdx +++ b/product_docs/docs/pgd/5.6/cli/index.mdx @@ -11,6 +11,8 @@ navigation: description: Installing and using the PGD Command Line Interface (CLI) to manage your PGD cluster. directoryDefaults: description: "The PGD Command Line Interface (CLI) is a tool to manage your EDB Postgres Distributed cluster" +redirects: +- /purl/upm/pgd-cli/ --- The EDB Postgres Distributed Command Line Interface (PGD CLI) is a tool for managing your EDB Postgres Distributed cluster. It's the key tool for inspecting and managing cluster resources. diff --git a/src/components/index.js b/src/components/index.js index c42a9e30b77..7ff8a74169c 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -20,6 +20,7 @@ import Logo from "./logo"; import MainContent from "./main-content"; import PdfDownload from "./pdf-download.js"; import PrevNext from "./prev-next"; +import PurlAnchor from "./purl-anchor"; import SearchNavigationLinks from "./search-navigation-links"; import SearchNavigation from "./search-navigation"; import SideNavigation from "./side-navigation"; @@ -55,6 +56,7 @@ export { MainContent, PdfDownload, PrevNext, + PurlAnchor, SearchNavigationLinks, SearchNavigation, SideNavigation, diff --git a/src/components/layout.js b/src/components/layout.js index c39446b5e30..0ec5c1a655f 100644 --- a/src/components/layout.js +++ b/src/components/layout.js @@ -12,6 +12,7 @@ import { Link, StubCards, IconList, + PurlAnchor, } from "../components"; import { MDXProvider } from "@mdx-js/react"; import Icon from "../components/icon/"; @@ -138,6 +139,7 @@ const Layout = ({ IconList, Archive, AuthenticatedContentPlaceholder, + PurlAnchor, }), [katacodaPanelData, meta.path, meta.isIndexPage, meta.productVersions], ); diff --git a/src/components/purl-anchor.js b/src/components/purl-anchor.js new file mode 100644 index 00000000000..bcaa3298ea0 --- /dev/null +++ b/src/components/purl-anchor.js @@ -0,0 +1,68 @@ +import React from "react"; + +// Accepts the id used as the perma-URL path redirect and transforms it into an +// element with an id that will match the fragment generated by the matching +// redirect in static/_redirects. +// For use in documentation that will be linked to in external application UIs. +// Expected format: +// /purl/// +// ...where will be a short, stable name for the product (e.g. "pgd", "upm", "epas"), +// and will be a meaningful description of the expected content being linked to. +// Both parameters must be composed of characters valid in URL fragments; invalid characters will *not* be escaped! +// I recommend you limit these parameters to words containing alphanumeric characters, separated by dashes. +// +// This component is intentionally bare-bones right now; it's a component for only two reasons +// 1. it performs transformation and some limited validation of the id (ensure that it fits with the scheme expected by the matching redirect in static/_redirects) +// 2. it makes the purpose of the anchor more obvious when scanning the source Markdown +// (and hopefully when reorganizing content) +// +// Note that you *must* list the path passed to this function in the frontmatter +// redirects section of the file where it appears; I may automate that or at least +// validate it at some point in the future if this sees enough use to make that useful. +// +const PurlAnchor = ({ urlPath }) => { + if (!urlPath?.replace) { + console.error("PurlAnchor requires a urlPath property"); + return; + } + + let hash = urlPath + .replace(/^\/?purl\/?/, "") + .split("/") + .filter((s) => s) + .join("_"); + + if (!/^\/purl\/[^/]+\/[^/]+/.test(urlPath)) + console.error( + `PurlAnchor given a badly-formatted URL path: ${urlPath}; format must be /purl// - anchor id will be ${hash}`, + ); + + // h/t https://stackoverflow.com/questions/26088849/url-fragment-allowed-characters/26119120#26119120 + if (!/^([-?/:@._~!$&'()*+,;=a-zA-Z0-9]|%[0-9a-fA-F]{2})*$/.test(hash)) + console.error( + `PurlAnchor given a badly-formatted URL path: ${urlPath}; this results in an anchor id of ${hash}, which is invalid as a URL fragment`, + ); + + return ; +}; + +function snapToNearestSection(node) { + if ( + !node || + decodeURIComponent(window?.location?.hash?.substring(1)) !== node.id + ) + return; + + // walk backwards and find nearest previous sibling which is a header with an id, then use *that* id + // this is a "nice to have", as it makes it more likely that both the URL and section + // are those defined by the document structure (sections) vs. arbitrary ids. + for (let next = node.previousSibling; next; next = next.previousSibling) { + const prevId = next.getAttribute && next.getAttribute("id"); + if (prevId && /H\d/.test(next.nodeName)) { + window.history.replaceState(null, null, "#" + encodeURIComponent(prevId)); + break; + } + } +} + +export default PurlAnchor;