Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
92679e5
disable live reload and fix too many open files error (#233)
RichieEscarez Nov 11, 2020
ec8357c
Add an update-codegen to regenerate the static redirects. (#239)
Nov 12, 2020
b6b84a1
update docs build for 0.19 (#240)
RichieEscarez Nov 18, 2020
c1ad8bf
Update DEVELOPMENT.md (#241)
xtreme-sameer-vohra Dec 5, 2020
b141e8f
Update build scripts to build from any named docs fork (#242)
RichieEscarez Dec 9, 2020
9ec9e48
Add net-ingressv2 golang redirect (#244)
nak3 Dec 18, 2020
2851e21
Fix static HTML build (#245)
RichieEscarez Dec 18, 2020
a11fd04
add version 0.20.0 to docs build (#247)
RichieEscarez Jan 13, 2021
32e8cbb
normal size nav text (#248)
RichieEscarez Jan 28, 2021
847183c
Added control protocol redirect (#254)
slinkydeveloper Feb 22, 2021
56a122a
fix typo (#249)
RichieEscarez Feb 24, 2021
ee79d8c
add version 0.21.0 to docs build (#256)
csantanapr Feb 24, 2021
ab4c12a
Redirect contributing URL to the docs website (#257)
Feb 27, 2021
b5405bb
Remove README->index renames (#259)
Mar 5, 2021
e052141
Add knative.dev/specs golang redirect (#258)
tayarani Mar 5, 2021
225c077
search/replace master with main (#263)
RichieEscarez Mar 9, 2021
0dfbc9f
Add Google Analytics tracking ID (#262)
RichieEscarez Mar 10, 2021
822bc97
add: Redirects for various knative-sandbox plugin repos (#251)
rhuss Mar 10, 2021
db466a8
Regenerate redirects to point at main (#265)
markusthoemmes Mar 11, 2021
9fecf11
Run github.com/client9/misspell (#266)
knative-automation Mar 15, 2021
5c2bbae
Fix/update missed release parameter (#261)
RichieEscarez Mar 16, 2021
f892959
Add future Docs release owners as Approvers (#264)
RichieEscarez Mar 16, 2021
9028c36
Update development instructions with netlify info (#269)
Mar 16, 2021
33f56ad
Update to latest version of Hugo from ~6 month old version (#270)
Mar 17, 2021
6ce4827
Resolved issue where files named "index.md" had incorrect file paths …
Mar 22, 2021
39b2852
Add autogenerated imports (#274)
Mar 23, 2021
87ddb1b
Bump y18n from 4.0.0 to 4.0.1 (#279)
dependabot[bot] Mar 31, 2021
dbe3920
Update OWNERS_ALIASES to match autogen in community (#282)
Apr 2, 2021
718e640
add instructions for cutting a release (#284)
csantanapr Apr 6, 2021
64260cd
Fix spaces in command (#285)
Apr 6, 2021
d84a922
Releasing 0.22 (#287)
Apr 7, 2021
96e6889
Fixed spacing on code blocks (#289)
abrennan89 Apr 13, 2021
cb417d4
Don't build elections content into the website (#291)
Apr 16, 2021
a41e37f
Enable asciidoctor in Netlify builds (#292)
Apr 16, 2021
b773d7b
Update knative/community files (#277)
knative-automation Apr 19, 2021
438751e
Update knative/community files (#293)
knative-automation Apr 20, 2021
35ea631
Redirect serving spec to specs repo (#290)
Apr 23, 2021
9e5693d
Enable new "help" section and fix a few things (#288)
RichieEscarez May 4, 2021
e9a6091
Remove golang module and build scripts from hugo build (#295)
May 4, 2021
aebf67a
Merge branch 'staging' into staging
RichieEscarez May 10, 2021
7c06acb
Manually update from /community
RichieEscarez May 10, 2021
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
179 changes: 3 additions & 176 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -1,177 +1,4 @@
- [Development instructions](#development-instructions)
* [Setup](#setup)
* [Run locally](#run-locally)
* [On a Mac](#on-a-mac)
+ [Sed](#sed)
+ [File Descriptors in "server mode"](#file-descriptors-in--server-mode-)
- [How it is deployed](#how-it-is-deployed)


# Development instructions

## Setup

1. Clone this repo (or your fork) using `--recurse-submodules`, like so:

```shell
git clone --recurse-submodules https://github.com/knative/website.git
```

If you accidentally cloned this repo without `--recurse-submodules`, you'll
need to do the following inside the repo:

```shell
git submodule init
git submodule update
cd themes/docsy
git submodule init
git submodule update
```

(Docsy uses two submodules, but those don't use further submodules.)

1. Clone the docs repo next to (_not inside_) the website repo. This allows you
to test docs changes alongside the website:

```shell
git clone https://github.com/knative/docs.git
```

You may also want to clone the community repo:

```shell
git clone https://github.com/knative/community.git
```

1. (Optional) If you want to change the CSS, install
[PostCSS](https://www.docsy.dev/docs/getting-started/#install-postcss)

1. Install a supported version of [Hugo](https://www.docsy.dev/docs/getting-started/#install-hugo).

1. Install a supported version of [Hugo](https://www.docsy.dev/docs/getting-started/#install-hugo).

1. Install a supported version of [Hugo](https://www.docsy.dev/docs/getting-started/#install-hugo).

## Run locally

You can use `./scripts/localbuild.sh` to build and test files locally.
The script uses Hugo's build and server commands in addition to some Knative
specific file scripts that enables optimal user experience in GitHub
(ie. use README.md files, allows our site to use relative linking
(not
[`rel` or `relref`](https://gohugo.io/content-management/cross-references/#use-ref-and-relref)),
etc.) and also meets Hugo/Docsy static site generator
and template requirements (ie. _index.hmtl files, etc.)

The two local docs build options:

- Simple/static HTML file generation for viewing how your Markdown renders in HTML:

Use this to generate a static build of the documentation site into HTML. This
uses Hugo's build command [`hugo`](https://gohugo.io/commands/hugo/).

From your clone of knative/website, you run `./scripts/localbuild.sh`.

All of the HTML files are built into the `public/` folder from where you can open,
view, and test how each file renders.

Notes:

- This method does not mirror how knative.dev is generated and therefore is
only recommended for testing how your files render. That also means that link
checking might not be 100% accurate. Hugo builds relative links differently
(all links based on the site root vs relative to the file in which the link
resides - this is part of the Knative specific file processing that is done)
therefore some links will not work between the statically built HTML files.
For example, links like `.../index.html` are converted to `.../` for simplicity
(servers treat them as the same destination) but when you are browsing a local HTML
file you need to open/click on the individual `index.html` files to get where you want
to go.
- This method does however make it easier to read or use local tools on the HTML build
output files (vs. fetching the HTML from the server). For example, it is useful for
refactoring/moving content and ensuring that complicated Markdown renders properly.
- Using this method also avoids the MacOs specific issue (see below), where the default
open FD limit exceeds the total number of `inotify` calls that Hugo wants to keep open.

- Mimic how knative.dev is built and hosted:

Use this option to locally build knative.dev. This uses Hugo's local server
command [`hugo server`](https://gohugo.io/commands/hugo_server/).

From your clone of knative/website, you run `./scripts/localbuild.sh -s true`.

All of the HTML files are temporarily copied into the `content/en/` folder to allow
the Hugo server to locally host those files at the URL:port specified in your terminal.

Notes:

- This method provides the following local build and test build options:
- test your locally cloned files
- build and test other user's remote forks (ie. locally build their PRs `./scripts/build.sh -f repofork -b branchname -s)
- option to build only a specific branch or all branches (and also from any speicifed fork)
- fully functioning site links
- [See all command options in localbuild.sh](https://github.com/knative/website/blob/main/scripts/localbuild.sh)
- Hugo's live-reload is not completely utilized due to the required Knative specific file processing
scripts (you need to rerun `./scripts/localbuild.sh -s` to rebuild and reprocess any changes that you
make to the files from within your local knative/docs clone directory).

Alternatively, if you want to use Hugo's live-reload feature, you can make temporary
changes to the copied files within the `content/en/` folder, and then when satisfied, you must
copy those changes into the corresponding files of your knative/docs clone.
- Files in `content/en/` are overwritten with a new copy of your local files in your knative/docs
clone folder each time that you run this script. Note that the last set of built files remain
in `content/en/` for you to run local tools against but are overwritten each time that you rerun the script.
- Using this method causes the MacOs specific issue (see below), where the default
open FD limit exceeds the total number of `inotify` calls that the Hugo server wants to keep open.

## On a Mac

If you want to develop on a Mac, you'll find two obstacles:

### Sed

The scripts assume GNU `sed`. You can install this with
[Homebrew](https://brew.sh/):

```shell
brew install gnu-sed
# You need to put it in your PATH before the built-in Mac sed
PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
```

### File Descriptors in "server mode"

By default, MacOS permits a very small number of open FDs. This will manifest
as:

```
ERROR 2020/04/14 12:37:16 Error: listen tcp 127.0.0.1:1313: socket: too many open files
```

You can fix this with the following (may be needed for each new shell):

```shell
sudo launchctl limit maxfiles 65535 200000
# Probably only need around 4k FDs, but 64k is defensive...
ulimit -n 65535
sudo sysctl -w kern.maxfiles=100000
sudo sysctl -w kern.maxfilesperproc=65535
```

# How it is deployed

While the above describes how the content is built locally, https://knative.dev/ is built and served by [Netlify](https://netlify.com/) on their platform.
There are a few differences between the two, and when debugging issues on the website, it can be useful to understand what Netlify is doing (as we've
configured it).

Generally, Netlify runs Hugo/Docsy builds and publishes everything that gets merged into the knative/docs and knative/website repos
(anything in knative/community will get picked up when either of the other two repos trigger a build).

The builds are triggered are through [GitHub webhooks](https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads).
There are two webhooks sent from knative/docs that are configured to inidicate that they were sent from knative/website:

* One that triggers a "production" build - Any PR that gets merged. (Webhook payload - /website `main` branch)
* One that triggers a "preview" build - Any PR action other than a merge (ie. commit, comment, label, etc). (Webhook payload - /website `staging` branch)

All of our builds (and build logs) are shown here: https://app.netlify.com/sites/knative/deploys (in the order of recent to past)
All information about the Knative documentation and site has been moved
into a single location:

#### [Go to the How-to guides for Knative docs contributors](https://knative.dev/help/)
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
source 'https://rubygems.org'
gem 'asciidoctor'
8 changes: 5 additions & 3 deletions OWNERS
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# The OWNERS file is used by prow to automatically merge approved PRs.

approvers:
- eng-approvers
- docs-approvers
- technical-oversight-committee
- ux-writers
- docs-writers
reviewers:
- docs-approvers
- docs-writers
- docs-reviewers
Loading