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

Release 2021-03-03 #1028

Merged
merged 19 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ product_docs/content/*
!product_docs/content/.keep
product_docs/content_build/*
!product_docs/content_build/.keep
static/nginx_redirects.generated
temp_kubernetes/build/*

30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,36 @@ Production is hosted on Netlify, and is built from the `main` branch. The build

Review builds are automatically created for pull requests. These builds are created by Heroku, and only include advocacy content, no other sources.

## Redirects

The app is concerned with two different types of redirects that can be defined in frontmatter.

### Internal Redirects (within Docs 2.0)

#### `redirects`

The `redirects` frontmatter is to be used for redirects internal to Docs. For example, if you had a file `great_file.mdx` with this following frontmatter...

```yaml
redirects:
- '/old_path'
- '/another_old_path'
```

both `/old_path` and `/another_old_path` would redirect to `great_file.mdx`'s current path. This is perfect for setting up redirects when moving a file around within Docs. Redirects created with `redirects` are permanent (301).

### Docs 1.0 to Docs 2.0 redirects

This app builds a list of nginx style redirects that are loaded into a separate server. These redirects direct users from links to the old docs site, to the appropriate page on the new docs site.

#### `legacyRedirectsGenerated`

This frontmatter is an automatically generated list of redirects for Docs 1.0 to Docs 2.0 (this repo). These redirects are built by `scripts/legacy_redirects/add_legecy_redirects.py`, and **should not be manually edited**.

#### `legacyRedirects`

If you need to setup a redirect from Docs 1.0 to Docs 2.0 manually, this is the place to do it. If the `legacyRedirectsGenerated` frontmatter does not include the redirect you need, you should add it here.

# Advocacy Docs (left over from previous README, needs attention)

Advocacy doc files are in [advocacy_docs/getting-started](https://github.com/EnterpriseDB/docs/tree/master/advocacy_docs/getting-started)
Expand Down
8 changes: 8 additions & 0 deletions advocacy_docs/playground/1/01_examples/redirects.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: 'Redirects'
redirects:
- '/redirect-demo'

legacyRedirects:
- '/edb-docs/redirect-demo'
---
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Requirements Overview"
product: PostgreSQL
legacyRedirects:
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/requirements_overview.html"
---


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Invoking the Graphical Installer"
product: PostgreSQL
legacyRedirects:
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/invoking_the_graphical_installer.html"
---


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Installing PostgreSQL with the Graphical Installation Wizard"
product: PostgreSQL
legacyRedirects:
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/installing_postgresql_with_the_graphical_installation_wizard.html"
---


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Using Stack Builder"
product: PostgreSQL
legacyRedirects:
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/using_stackbuilder.html"
---

<div id="using_stackbuilder" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Installation Troubleshooting"
product: PostgreSQL
legacyRedirects:
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/installation_troubleshooting.html"
---


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Uninstalling PostgreSQL"
product: PostgreSQL
legacyRedirects:
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/uninstalling_postgresql.html"
---


Expand Down
22 changes: 18 additions & 4 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const ANSI_BLUE = '\033[34m';
const ANSI_STOP = '\033[0m';

const isBuild = process.env.NODE_ENV === 'production';
const isProduction = process.env.APP_ENV === 'production';
const algoliaIndex = process.env.ALGOLIA_INDEX_NAME || 'edb-staging';

/******** Sourcing *********/
Expand Down Expand Up @@ -282,6 +283,14 @@ const splitNodeContent = (nodes) => {
return result;
};

const netlifyHeaders = () => {
// if (isProduction) return {};

return {
'/*': ['X-Robots-Tag: noindex'],
};
};

/********** Gatsby config *********/
module.exports = {
flags: {
Expand All @@ -305,13 +314,10 @@ module.exports = {
'gatsby-transformer-json',
'gatsby-plugin-catch-links',
'gatsby-plugin-sharp',
'gatsby-plugin-meta-redirect',
{
resolve: 'gatsby-plugin-netlify',
options: {
headers: {
'/*': ['X-Robots-Tag: noindex'],
},
headers: netlifyHeaders(),
},
},
// 'gatsby-plugin-remove-fingerprints', // speeds up Netlify, see https://github.com/narative/gatsby-plugin-remove-fingerprints
Expand Down Expand Up @@ -416,6 +422,14 @@ module.exports = {
id: process.env.GTM_ID,
},
},
{
resolve: 'gatsby-plugin-nginx-redirect',
options: {
inputConfigFile: `${__dirname}/static/nginx_redirects.template`,
outputConfigFile: `${__dirname}/static/nginx_redirects.generated`,
whereToIncludeRedirects: '', // defaults to: "server"
},
},
],
};

Expand Down
41 changes: 30 additions & 11 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const {
treeToNavigation,
treeNodeToNavNode,
findPrevNextNavNodes,
configureRedirects,
configureLegacyRedirects,
} = require('./src/constants/gatsby-node-utils.js');

const isBuild = process.env.NODE_ENV === 'production';
Expand Down Expand Up @@ -83,6 +85,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
productStub
indexCards
navigation
legacyRedirects
legacyRedirectsGenerated
navigation
katacodaPages {
scenario
account
Expand Down Expand Up @@ -183,17 +188,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
// set computed frontmatter
node.frontmatter = computeFrontmatterForTreeNode(curr);

// set up frontmatter redirects
if (node.frontmatter.redirects) {
node.frontmatter.redirects.forEach((fromPath) => {
actions.createRedirect({
fromPath,
toPath: node.fields.path,
redirectInBrowser: true,
isPermanent: true,
});
});
}
configureRedirects(node.fields.path, node.frontmatter.redirects, actions);

// build navigation tree
const navigationDepth = 2;
Expand Down Expand Up @@ -226,6 +221,18 @@ const createDoc = (navTree, prevNext, doc, productVersions, actions) => {
});
}

// configure legacy redirects
if (!doc.frontmatter.productStub) {
configureLegacyRedirects({
toPath: doc.fields.path,
toLatestPath: replacePathVersion(doc.fields.path),
redirects: (doc.frontmatter.legacyRedirects || []).concat(
doc.frontmatter.legacyRedirectsGenerated || [],
),
actions,
});
}

const isIndexPage = isPathAnIndexPage(doc.fileAbsolutePath);
const docsRepoUrl = 'https://github.com/EnterpriseDB/docs';
const branch = isProduction ? 'main' : 'develop';
Expand Down Expand Up @@ -264,6 +271,16 @@ const createDoc = (navTree, prevNext, doc, productVersions, actions) => {
};

const createAdvocacy = (navTree, prevNext, doc, learn, actions) => {
// configure legacy redirects
configureLegacyRedirects({
toPath: doc.fields.path,
toLatestPath: doc.fields.path,
redirects: (doc.frontmatter.legacyRedirects || []).concat(
doc.frontmatter.legacyRedirectsGenerated || [],
),
actions,
});

const navLinks = learn.filter(
(node) => node.fields.topic === doc.fields.topic,
);
Expand Down Expand Up @@ -399,6 +416,8 @@ exports.createSchemaCustomization = ({ actions }) => {
type Frontmatter {
originalFilePath: String
indexCards: TileModes
legacyRedirects: [String]
legacyRedirectsGenerated: [String]
}

enum TileModes {
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
"develop": "gatsby develop",
"config-sources": "python3 scripts/source/config_sources.py",
"format": "prettier --write src/**/*.js gatsby-*.js",
"build": "gatsby build --prefix-paths",
"build": "gatsby build --prefix-paths && bash scripts/post-build.sh",
"serve-build": "gatsby serve --prefix-paths",
"update-icons": "git submodule update --init --remote && node scripts/createIconTypes.js && node scripts/createIconNames.js",
"build-pdf": "python3 scripts/pdf/generate_pdf.py",
"build-all-pdfs": "for i in product_docs/docs/**/*/ ; do echo \"$i\"; python3 scripts/pdf/generate_pdf.py ${i%}; done",
"fix-mtimes": "python3 scripts/source/git-restore-mtime.py",
"count": "find product_docs/docs/ advocacy_docs/ external_sources/ -name '*.mdx' | wc -l",
"heroku-postbuild": "gatsby build"
"heroku-postbuild": "gatsby build",
"build-legacy-redirects-nginx": "gatsby clean && gatsby build --prefix-paths && python3 scripts/legacy_redirects/clean_up_output.py"
},
"husky": {
"hooks": {
Expand All @@ -44,6 +45,7 @@
"gatsby-plugin-mdx": "^1.2.6",
"gatsby-plugin-meta-redirect": "^1.1.1",
"gatsby-plugin-netlify": "^2.3.13",
"gatsby-plugin-nginx-redirect": "^0.0.11",
"gatsby-plugin-react-helmet": "^3.3.1",
"gatsby-plugin-react-svg": "^3.0.0",
"gatsby-plugin-remove-fingerprints": "^0.0.2",
Expand Down
33 changes: 0 additions & 33 deletions product_docs/README.md

This file was deleted.

4 changes: 4 additions & 0 deletions product_docs/docs/ark/3.5/ark_admin/01_ark_whats_new.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "What's New"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_whats_new.html"
---

<div id="ark_whats_new" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Supported Platforms"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_supported_platforms.html"
---

<div id="ark_supported_platforms" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Ark Architecture Overview"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_architecture_overview.html"
---

<div id="ark_architecture_overview" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Registering an Ark Cluster with PEM"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_registering_with_pem.html"
---

<div id="ark_registering_with_pem" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Ark Authentication Models"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_authentication_models.html"
---

<div id="ark_authentication_models" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Installing the Ark Console on AWS"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console_aws.html"
---

<div id="ark_installing_console_aws" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Installing the Ark Console on Azure"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console_azure.html"
---

<div id="ark_installing_console_azure" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Installing the Ark Console"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console.html"
---

<div id="ark_installing_console" class="registered_link"></div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
---
title: "Administrative Features of the EDB Ark Console"

legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_admin_features.html"
---

<div id="ark_admin_features" class="registered_link"></div>
Expand Down
Loading