Skip to content

Commit 576e2e9

Browse files
authored
Merge pull request #1028 from EnterpriseDB/release/2021-03-03
Release 2021-03-03 Former-commit-id: 9633fd9
2 parents 2528637 + 9cd94c9 commit 576e2e9

File tree

1,434 files changed

+24268
-1025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,434 files changed

+24268
-1025
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,6 @@ product_docs/content/*
7979
!product_docs/content/.keep
8080
product_docs/content_build/*
8181
!product_docs/content_build/.keep
82+
static/nginx_redirects.generated
8283
temp_kubernetes/build/*
8384

README.md

+30
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,36 @@ Production is hosted on Netlify, and is built from the `main` branch. The build
115115

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

118+
## Redirects
119+
120+
The app is concerned with two different types of redirects that can be defined in frontmatter.
121+
122+
### Internal Redirects (within Docs 2.0)
123+
124+
#### `redirects`
125+
126+
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...
127+
128+
```yaml
129+
redirects:
130+
- '/old_path'
131+
- '/another_old_path'
132+
```
133+
134+
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).
135+
136+
### Docs 1.0 to Docs 2.0 redirects
137+
138+
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.
139+
140+
#### `legacyRedirectsGenerated`
141+
142+
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**.
143+
144+
#### `legacyRedirects`
145+
146+
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.
147+
118148
# Advocacy Docs (left over from previous README, needs attention)
119149

120150
Advocacy doc files are in [advocacy_docs/getting-started](https://github.com/EnterpriseDB/docs/tree/master/advocacy_docs/getting-started)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: 'Redirects'
3+
redirects:
4+
- '/redirect-demo'
5+
6+
legacyRedirects:
7+
- '/edb-docs/redirect-demo'
8+
---

advocacy_docs/supported-open-source/postgresql/installer/01_requirements_overview.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Requirements Overview"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/requirements_overview.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/02_installing_postgresql_with_the_graphical_installation_wizard/01_invoking_the_graphical_installer.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Invoking the Graphical Installer"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/invoking_the_graphical_installer.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/02_installing_postgresql_with_the_graphical_installation_wizard/index.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Installing PostgreSQL with the Graphical Installation Wizard"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/installing_postgresql_with_the_graphical_installation_wizard.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/03_using_stackbuilder.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Using Stack Builder"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/using_stackbuilder.html"
46
---
57

68
<div id="using_stackbuilder" class="registered_link"></div>

advocacy_docs/supported-open-source/postgresql/installer/04_installation_troubleshooting.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Installation Troubleshooting"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/installation_troubleshooting.html"
46
---
57

68

advocacy_docs/supported-open-source/postgresql/installer/05_uninstalling_postgresql.mdx

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
title: "Uninstalling PostgreSQL"
33
product: PostgreSQL
4+
legacyRedirects:
5+
- "/edb-docs/d/postgresql/installation-getting-started/installation-guide/13.0/uninstalling_postgresql.html"
46
---
57

68

gatsby-config.js

+18-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const ANSI_BLUE = '\033[34m';
88
const ANSI_STOP = '\033[0m';
99

1010
const isBuild = process.env.NODE_ENV === 'production';
11+
const isProduction = process.env.APP_ENV === 'production';
1112
const algoliaIndex = process.env.ALGOLIA_INDEX_NAME || 'edb-staging';
1213

1314
/******** Sourcing *********/
@@ -282,6 +283,14 @@ const splitNodeContent = (nodes) => {
282283
return result;
283284
};
284285

286+
const netlifyHeaders = () => {
287+
// if (isProduction) return {};
288+
289+
return {
290+
'/*': ['X-Robots-Tag: noindex'],
291+
};
292+
};
293+
285294
/********** Gatsby config *********/
286295
module.exports = {
287296
flags: {
@@ -305,13 +314,10 @@ module.exports = {
305314
'gatsby-transformer-json',
306315
'gatsby-plugin-catch-links',
307316
'gatsby-plugin-sharp',
308-
'gatsby-plugin-meta-redirect',
309317
{
310318
resolve: 'gatsby-plugin-netlify',
311319
options: {
312-
headers: {
313-
'/*': ['X-Robots-Tag: noindex'],
314-
},
320+
headers: netlifyHeaders(),
315321
},
316322
},
317323
// 'gatsby-plugin-remove-fingerprints', // speeds up Netlify, see https://github.com/narative/gatsby-plugin-remove-fingerprints
@@ -416,6 +422,14 @@ module.exports = {
416422
id: process.env.GTM_ID,
417423
},
418424
},
425+
{
426+
resolve: 'gatsby-plugin-nginx-redirect',
427+
options: {
428+
inputConfigFile: `${__dirname}/static/nginx_redirects.template`,
429+
outputConfigFile: `${__dirname}/static/nginx_redirects.generated`,
430+
whereToIncludeRedirects: '', // defaults to: "server"
431+
},
432+
},
419433
],
420434
};
421435

gatsby-node.js

+30-11
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ const {
2121
treeToNavigation,
2222
treeNodeToNavNode,
2323
findPrevNextNavNodes,
24+
configureRedirects,
25+
configureLegacyRedirects,
2426
} = require('./src/constants/gatsby-node-utils.js');
2527

2628
const isBuild = process.env.NODE_ENV === 'production';
@@ -83,6 +85,9 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
8385
productStub
8486
indexCards
8587
navigation
88+
legacyRedirects
89+
legacyRedirectsGenerated
90+
navigation
8691
katacodaPages {
8792
scenario
8893
account
@@ -183,17 +188,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
183188
// set computed frontmatter
184189
node.frontmatter = computeFrontmatterForTreeNode(curr);
185190

186-
// set up frontmatter redirects
187-
if (node.frontmatter.redirects) {
188-
node.frontmatter.redirects.forEach((fromPath) => {
189-
actions.createRedirect({
190-
fromPath,
191-
toPath: node.fields.path,
192-
redirectInBrowser: true,
193-
isPermanent: true,
194-
});
195-
});
196-
}
191+
configureRedirects(node.fields.path, node.frontmatter.redirects, actions);
197192

198193
// build navigation tree
199194
const navigationDepth = 2;
@@ -226,6 +221,18 @@ const createDoc = (navTree, prevNext, doc, productVersions, actions) => {
226221
});
227222
}
228223

224+
// configure legacy redirects
225+
if (!doc.frontmatter.productStub) {
226+
configureLegacyRedirects({
227+
toPath: doc.fields.path,
228+
toLatestPath: replacePathVersion(doc.fields.path),
229+
redirects: (doc.frontmatter.legacyRedirects || []).concat(
230+
doc.frontmatter.legacyRedirectsGenerated || [],
231+
),
232+
actions,
233+
});
234+
}
235+
229236
const isIndexPage = isPathAnIndexPage(doc.fileAbsolutePath);
230237
const docsRepoUrl = 'https://github.com/EnterpriseDB/docs';
231238
const branch = isProduction ? 'main' : 'develop';
@@ -264,6 +271,16 @@ const createDoc = (navTree, prevNext, doc, productVersions, actions) => {
264271
};
265272

266273
const createAdvocacy = (navTree, prevNext, doc, learn, actions) => {
274+
// configure legacy redirects
275+
configureLegacyRedirects({
276+
toPath: doc.fields.path,
277+
toLatestPath: doc.fields.path,
278+
redirects: (doc.frontmatter.legacyRedirects || []).concat(
279+
doc.frontmatter.legacyRedirectsGenerated || [],
280+
),
281+
actions,
282+
});
283+
267284
const navLinks = learn.filter(
268285
(node) => node.fields.topic === doc.fields.topic,
269286
);
@@ -399,6 +416,8 @@ exports.createSchemaCustomization = ({ actions }) => {
399416
type Frontmatter {
400417
originalFilePath: String
401418
indexCards: TileModes
419+
legacyRedirects: [String]
420+
legacyRedirectsGenerated: [String]
402421
}
403422
404423
enum TileModes {

package.json

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
"develop": "gatsby develop",
1313
"config-sources": "python3 scripts/source/config_sources.py",
1414
"format": "prettier --write src/**/*.js gatsby-*.js",
15-
"build": "gatsby build --prefix-paths",
15+
"build": "gatsby build --prefix-paths && bash scripts/post-build.sh",
1616
"serve-build": "gatsby serve --prefix-paths",
1717
"update-icons": "git submodule update --init --remote && node scripts/createIconTypes.js && node scripts/createIconNames.js",
1818
"build-pdf": "python3 scripts/pdf/generate_pdf.py",
1919
"build-all-pdfs": "for i in product_docs/docs/**/*/ ; do echo \"$i\"; python3 scripts/pdf/generate_pdf.py ${i%}; done",
2020
"fix-mtimes": "python3 scripts/source/git-restore-mtime.py",
2121
"count": "find product_docs/docs/ advocacy_docs/ external_sources/ -name '*.mdx' | wc -l",
22-
"heroku-postbuild": "gatsby build"
22+
"heroku-postbuild": "gatsby build",
23+
"build-legacy-redirects-nginx": "gatsby clean && gatsby build --prefix-paths && python3 scripts/legacy_redirects/clean_up_output.py"
2324
},
2425
"husky": {
2526
"hooks": {
@@ -44,6 +45,7 @@
4445
"gatsby-plugin-mdx": "^1.2.6",
4546
"gatsby-plugin-meta-redirect": "^1.1.1",
4647
"gatsby-plugin-netlify": "^2.3.13",
48+
"gatsby-plugin-nginx-redirect": "^0.0.11",
4749
"gatsby-plugin-react-helmet": "^3.3.1",
4850
"gatsby-plugin-react-svg": "^3.0.0",
4951
"gatsby-plugin-remove-fingerprints": "^0.0.2",

product_docs/README.md

-33
This file was deleted.

product_docs/docs/ark/3.5/ark_admin/01_ark_whats_new.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "What's New"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_whats_new.html"
37
---
48

59
<div id="ark_whats_new" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/02_ark_supported_platforms.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Supported Platforms"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_supported_platforms.html"
37
---
48

59
<div id="ark_supported_platforms" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/03_ark_architecture_overview.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Ark Architecture Overview"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_architecture_overview.html"
37
---
48

59
<div id="ark_architecture_overview" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/04_ark_registering_with_pem.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Registering an Ark Cluster with PEM"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_registering_with_pem.html"
37
---
48

59
<div id="ark_registering_with_pem" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/05_ark_authentication_models.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Ark Authentication Models"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_authentication_models.html"
37
---
48

59
<div id="ark_authentication_models" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/06_ark_installing_console/01_ark_installing_console_aws.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Installing the Ark Console on AWS"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console_aws.html"
37
---
48

59
<div id="ark_installing_console_aws" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/06_ark_installing_console/02_ark_installing_console_azure.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Installing the Ark Console on Azure"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console_azure.html"
37
---
48

59
<div id="ark_installing_console_azure" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/06_ark_installing_console/index.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Installing the Ark Console"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_installing_console.html"
37
---
48

59
<div id="ark_installing_console" class="registered_link"></div>

product_docs/docs/ark/3.5/ark_admin/07_ark_admin_features.mdx

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
---
22
title: "Administrative Features of the EDB Ark Console"
3+
4+
legacyRedirectsGenerated:
5+
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
6+
- "/edb-docs/d/edb-postgres-ark-platform/user-guides/administrative-users-guide/3.5/ark_admin_features.html"
37
---
48

59
<div id="ark_admin_features" class="registered_link"></div>

0 commit comments

Comments
 (0)