Code Monkey home page Code Monkey logo

docs.konghq.com's Introduction

Netlify Status

Kong's Documentation Website

This repository contains the source content and code for Kong's documentation website. It's built using Jekyll and deployed with Netlify.

Here are some things to know before you get started:

  • We're beginner-friendly. Whether you're a Technical Writer learning about docs-as-code or an engineer practicing your documentation skills, we welcome your involvement. If you'd like to contribute and don't have something in mind already, head on over to Issues. We've added good first issue labels on beginner-friendly issues.

  • We need more help in some areas. We'd especially love some help with plugin documentation.

  • Some of our docs are generated.

All pull requests for these docs should be opened in the Kong/kong repository. Fork the repository and submit PRs from your fork.

For Gateway Enterprise configuration reference, open an issue on this repo and we'll update the docs.

  • Community is a priority for us. Before submitting an issue or pull request, make sure to review our Contributing Guide and our documentation templates.

  • We are currently accepting plugin submissions to our plugin hub from trusted technical partners, on a limited basis. For more information, see the Kong Partners page.

Run Locally

For anything other than minor changes, clone the repository onto your local machine and build locally. Once you've installed all of the tools required, you can use our Makefile to build the docs:

# Install dependencies
make install

# Create local .env file
# OAS Pages require VITE_PORTAL_API_URL to be set in your current environment, it should match the Kong supplied portal URL
cp .env.example .env

# Build the site and watch for changes
make run

Once you see the Server now ready on … message, the docs site is available at http://localhost:8888.

Troubleshooting the local build

Invalid byte sequence in US-ASCII

If you encounter an error that looks like this:

app/_plugins/generators/utils/frontmatter_parser.rb:8:in `match': invalid byte sequence in US-ASCII (ArgumentError)

      @result = @string.match(Jekyll::Document::YAML_FRONT_MATTER_REGEXP)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    from app/_plugins/generators/utils/frontmatter_parser.rb:8:in `match'

You can try setting the LANG or LC_ALL environment variable to en_US.UTF-8. For example:

export LANG=en_US.UTF-8

Generating specific products

In order to speed up build times, it's possible to generate a specific subset of products and their corresponding versions by specifying the KONG_PRODUCTS env variable. It takes a comma-separated list of products and for each product, the list of versions the versions to be generated separated by semi-colons, in the following way.

KONG_PRODUCTS='<product>:<version>;<version>,<product>:<version>,hub'

For example, running

KONG_PRODUCTS='gateway:2.8.x;3.3.x,mesh:2.2.x,hub' make run

will generate the plugin hub, mesh version 2.2.x, and gateway versions 2.8.x and 3.3.x. It also supports wildcard matching for both products and versions, i.e.

KONG_PRODUCTS='gateway:3.*'

and

KONG_PRODUCTS='*:latest'

are also possible.

Skipping slow generators

Unfortunately, the Sitemap and Hub generators are slow. Even if they don't need to re-render a page, they still need to read the files and generate the necessary structures and pages, which takes time. The Sitemap generator is disabled by default if JEKYLL_ENV=development, so it doesn't run locally. Disabling the Hub generator can be done by setting the environment variable: DISABLE_HUB.

DISABLE_HUB=1 make run

Plugin contributors

If you have contributed a plugin, you can add a Kong badge to your plugin README.

Use the following, where you replace test with your plugin name and link-to-docs with a link to the Kong docs for your plugin.

[![](https://img.shields.io/badge/Kong-test-blue.svg?colorA=042943&colorB=00C4BB&style=flat&longCache=true&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAIAAAAC64paAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAOwgAADsIBFShKgAAAABl0RVh0U29mdHdhcmUAcGFpbnQubmV0IDQuMC4xOdTWsmQAAAIcSURBVDhPY2DRdCYb0Vgzh46btlcCmiAEEdDMb+w9a+Xmr99/FHdM49R1R5PFp5nPyHvfifP/weDvv39LNu4SMfdHVoBPs2VY9q4jpx8+ewnRDwRHz13h1veAK8CpmdfQq6xrRt2EeS7xxc9evYVovvf4mbhlIFwNTs1JlV1///4Fajh96UZIbt2nL1+B7B8/fznGFsDVYNcsYRX04jXUtn///m3ae7SgZcrnr9/aZixBDjYsmnn0Pe2j85++fAPRDAR///6btGitWXAGu7Yrskp0zaLmAWt2HLxy+35UUcvHzyCnQsCv37/zWiaxabkgK0ZoFrMIMA3OOH/t9j+w6j3HzmbW9wE9CeaBwJdv30PyGuDqgQiqWdDU9/TlG99//IQqBHt1wbodjZMX/PnzByr0///rdx+sI3JQNAMT4ML1O6HySOD3nz+FbVOBUsAUAhUCx5aqawxCc2HbFKA9UEmwHqATgOjdx092UXmCJr57j5+DyoHBqUs3RC0CoJqRXfv795/sxol+GVVA5JJQzK3vCVQgZx92+eY9qApI5O07BtUMFQODGcs3RRY1v3zzHug9IJq4cA3QU0A1+r7JT168hir6/x/IZtVyQdF85spNYGYAOunh0xcQEWAM5TRNBKoBIo/ksi9fv0PEgdEJFAFpvnbnARBduH4Hnm+BKQkiCETAMGfTBkWviJn/3mNnIYKp1d1QzWQiTWcA1wsS5+E9q+MAAAAASUVORK5CYII=)](link-to-docs)

Here's how the badge looks:

See Issue #908 for more information. Note that we're not currently hosting assets for badges.

Generate the PDK, Admin API, CLI, and Configuration documentation

This section is for Kong source code maintainers. You don't need to do anything here if you're contributing to this repo!

The PDK docs, Admin API docs, cli.md and configuration.md for each release are generated from the Kong source code.

To generate them, go to the Kong/kong repo and run:

scripts/autodoc <docs-folder> <kong-version>

For example:

cd /path/to/kong
scripts/autodoc ../docs.konghq.com 2.4.x

This example assumes that the Kong/docs.konghq.com repo is cloned into the same directory as the Kong/kong repo, and that you want to generate the docs for version 2.4.x. Adjust the paths and version as needed.

After everything is generated, review, open a branch with the changes, send a pull request, and review the changes.

You usually want to open a PR against a release/* branch. For example, in the example above, the branch was release/2.4.

cd docs.konghq.com
git fetch --all
git checkout release/2.4
git checkout -b release/2.4-autodocos
git add -A .
git commit -m "docs(2.4.x) add autodocs"
git push

Then open a pull request against release/2.4.

Testing

Tests for this site are written using fetch, cheerio and jest

To run the tests, you must first build the site by running make build before running make smoke.

Many of the tests are smoke tests to check for issues that occurred while adding caching to the site, such as ensuring that the side navigation isn't cached.

To add your own tests, look in the tests directory and use home.test.js as a sample. You specify which URL to visit and then a CSS selector to search for, before asserting that the contents match what you expect.

test("has the 'Welcome to Kong' header", async () => {
  const $ = await fetchPage("/")
  expect($("#main")).toHaveText("Welcome to Kong Docs");
});

Continuous Integration

We run various quality checks at build time to ensure that the documentation is maintainable.

Some of the checks can be manually marked as approved using labels:

  • ci:manual-approve:link-validation - mark link checking as successful. Useful when Netlify returns an HTTP 400 error and the links are validated manually.

include-check

The include-check.sh script checks for any files in the app/_includes folder that depend on a page.* variable (e.g. page.url). This is not compatible with the include_cached gem that we use, and so using page.* in an include will fail the build.

To run the script locally, open a terminal, navigate to the documentation folder, and run ./include-check.sh. If there is no output, everything is successful.

In the following example, we can see that admin-listen.md uses a page.* variable, and that the include is used in the docker.md file:

❯ ./include-check.sh
Page variables must not be used in includes.
Pass them in via include_cached instead

Files that currently use page.*:
File: app/_includes/md/admin-listen.md
via:
app/_src/gateway/install/docker.md

Here are sample contents for those files:

In docker.md:

{% include_cached app/_includes/md/admin-listen.md %}

In deployment-options-k8s:

This is an include that uses {{ page.release }}

To resolve this, the two files should be updated to pass in the URL when include_cached is called:

In docker.md:

{% include_cached app/_includes/md/admin-listen.md release=page.release %}

In admin-listen:

This is an include that uses {{ include.release }}

The include_cached gem uses all passed parameters as the cache lookup key, and this ensures that all required permutations of an include file will be generated.

For guidelines on how to write includes and call them in target topics, see the Kong Docs contributing guidelines.

Review Labels

When raising a pull request, it's useful to indicate what type of review you're looking for from the team. To help with this, we've added three labels that can be applied:

  • review:copyedit: Request for writer review.
  • review:general: Review for general accuracy and presentation. Does the doc work? Does it output correctly?
  • review:tech: Request for technical review from an SME.

At least one of these labels must be applied to a PR or the build will fail.

docs.konghq.com's People

Contributors

acgoldsmith avatar cloudjumpercat avatar coopr avatar d19dotca avatar dependabot[bot] avatar fabianrbz avatar fffonion avatar gayleneumann avatar gszr avatar guaris avatar h3xar0n avatar hbagdi avatar hcloward avatar hishamhm avatar hutchic avatar jlawlzz avatar kikito avatar kong-docs avatar lena-larionova avatar levfishbluefish avatar mheap avatar nijikokun avatar rainest avatar rainum avatar renovate[bot] avatar sonicaghi avatar subnetmarco avatar theetrain avatar thibaultcha avatar tieske avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

docs.konghq.com's Issues

add a search bar

keeping it simple: link to Google search with "site:getkong.org SEARCH_TERM"

Events for newsletter subscription and enterprise demo request

  1. For the enterprise form and the newsletter updates, when you call identify, please also add "created_at" = datetime (unix time)
  2. For the enterprise form, on submit, please also call analytics.track event for “request_enterprise_demo" with the properties.
    Example:
analytics.track('request_enterprise_demo',{
    company: 'Mashape',
    deployment: 'on-prem',
    email: '[email protected]',
    name: 'christina test',
    phone: '4321',
    request_date: date/time of submission
})
  1. For the newsletter updates, same thing, on submit, please call analytics.track event for “request_newsletter_updates” with the properties.

Alternatively, you can use the trackform function instead of track, whichever one is easier for you - https://segment.com/docs/libraries/analytics.js/#track-form

Basically, if the same user (same email) submits the form twice, it should call the analytics.track event twice with two different submit date/time.

create a "requirements" page

  • to list all required packages for installations across different distribution methods.
  • to link from the download page with the text: "check all your dependencies are met, click here for a full list of requirements."

NOTE this is turning into an install debugging thread, i'll list everything here then separate out into individual tickets as applicable, for now using this as a draft space.

  • sudo is a requirement for kong.postinst but it probably shouldn't be, we can use "su" which comes pre-installed with most distros anyways, can use su -c ‘command’

Request size limiting plugin doc

In the configuration section of the plugin page there's an extra trailing slash:

curl -X POST http://kong:8001/apis/{api_id}/plugins \
    --data "name=requestsizelimiting" \
    --data "allowed_payload_size=128" \

There's also an issue with allowed_payload_size missing the value prefix:

curl -i -X POST http://localhost:8001/apis/e3870142-ff01-4e0c-ce6f-6ca9665d915c/plugins \
    --data "name=requestsizelimiting" \
    --data "allowed_payload_size=128"

HTTP/1.1 400 Bad Request
{"allowed_payload_size":"allowed_payload_size is an unknown field"}

This worked:

curl -i -X POST http://localhost:8001/apis/e3870142-ff01-4e0c-ce6f-6ca9665d915c/plugins \
  --data "name=requestsizelimiting" \
  --data "value.allowed_payload_size=10"

HTTP/1.1 201 Created
Date: Sat, 06 Jun 2015 02:09:45 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: kong/0.3.0

{"api_id":"e3870142-ff01-4e0c-ce6f-6ca9665d915c","value":{"allowed_payload_size":10},"id":"b407b2b5-75ca-40a9-c0b2-d293d6f67267","enabled":true,"created_at":1433556585000,"name":"requestsizelimiting"}

Default tweet text

For the twitter button in the footer, please make it such that it will always tweet the same message regardless of the page that the user is at.

The message should be:

KONG - the open-source management layer for APIs and Microservices http://getkong.org/ #opensource #API #management

No dropdown

There is no dropdown visible even when having multiple versions.

Installation Support

At the bottom of the installation instructions we have the text:

Something went wrong? Check out the Docs ›

Instead of sending them to the docs which won't be of any use it would be better to send them to the support page with our glitter channel and enterprise support options.

Text replacement could be like:

Having trouble? We're here to help!

implicit description of how to use DNS with Kong in production

it occurred to me (from customer feedback) that the usage of Host header in examples are causing some confusion for people.

basically, its empowering the assumption that you need to call the proxy address directly and pass a Host header, where in a real-world implementation, you should be able to point any DNS address (domain / subdomain) to your proxy network address and no longer require passing of a Host header in your HTTP request.

this is not an obvious conclusion from following the tutorial and reading the docs, and it does count as a bit of an advanced knowledge for some developers.

suggestion: add a "deploying to production" section in the tutorial (at the end) that describes this as well as any related considerations when going to production.

docs.html layout should be versioned

_layouts/docs.html is what is on the left side of a documentation page. Not every version to document will have the same articles (in fact, the 2 versions we currently have already differ, resulting in a few 404s), and in the future there might be a lot more to it.

To dynamically generate it, we can either have a list of all articles in kong_versions.yml, or we could dynamically generate that list via the versions.rb plugin. One is more flexible, the other is less to maintain.

Then docs.html simply becomes:

<aside class="page-navigation">
  {% for section in page.doc_link %}
  <nav>
    <h5>{{section.title}}</h5>
    <ul>
      {% for article in section.articles %}
        <li href="/docs/{{page.kong_version}}/{{article.link}}">{{article.name}}</li>
      {% endfor %}      
    </ul>
  </nav>
  {% endfor %}
</aside>

Which solution do we like better: YAML or automated?

nginx configuration value is wrong

At the page /docs/0.2.0-2/configuration/ the nginx configuration is not rendering the {{*}} placeholders (like {{auto_worker_rlimit_nofile}}) although they have been defined in the source.

[guide] Going to production

  • How many nodes for any amount of traffic
  • How many Cassandra nodes for a Kong cluster
  • How to distribute and/or scale Kong
  • How to load balance your traffic on a Kong cluster
  • How to setup a production ready Cassandra cluster (authentication/authorization/multi-region)
  • How to setup your DNS records to leverage the Host header #87
  • How to upgrade Kong without downtime
  • How and why to protect the Admin API (8001)
  • How to link your users to Kong (custom_id)

Cassandra dependency

The current location is easy to skip over and miss at first glance.

Right now we have dependencies listed as step one for "Other" which is where I would expect Casandra to be mentioned as well. We also mention that Cassandra must be running in the "Start Kong" section for all distributions except for Docker but I feel it should be clear it's a dependency before you get there.

screen shot 2015-04-21 at 4 35 07 pm

extra html escaping in data attributes on render

this will break any tracking events.

<a href="/download" class="button" data-analytics="{&quot;event&quot;: &quot;Clicked download&quot;, &quot;type&quot;: &quot;button&quot;, &quot;location&quot;: &quot;header&quot;}">Download</a>

Meta stuff website

Please add the following to kong website:

1. Json-LD

<script type="application/ld+json">
{ "@context" : "http://schema.org",
  "@type" : "Organization",
  "name" : "Mashape",
  "url" : "http://getkong.org/",
  "logo" : "[replace with image url]",
  "sameAs" : [ "https://www.facebook.com/Mashape",
    "https://twitter.com/mashape",
    "https://plus.google.com/+mashape"]
}
</script>
  • (replace image url with the mashape logo url)
    ape logo with text

2. VWO script

<!-- Start Visual Website Optimizer Asynchronous Code -->
<script type='text/javascript'>
var _vwo_code=(function(){
var account_id=125292,
settings_tolerance=2000,
library_tolerance=2500,
use_existing_jquery=false,
// DO NOT EDIT BELOW THIS LINE
f=false,d=document;return{use_existing_jquery:function(){return use_existing_jquery;},library_tolerance:function(){return library_tolerance;},finish:function(){if(!f){f=true;var a=d.getElementById('_vis_opt_path_hides');if(a)a.parentNode.removeChild(a);}},finished:function(){return f;},load:function(a){var b=d.createElement('script');b.src=a;b.type='text/javascript';b.innerText;b.onerror=function(){_vwo_code.finish();};d.getElementsByTagName('head')[0].appendChild(b);},init:function(){settings_timer=setTimeout('_vwo_code.finish()',settings_tolerance);this.load('//dev.visualwebsiteoptimizer.com/j.php?a='+account_id+'&u='+encodeURIComponent(d.URL)+'&r='+Math.random());var a=d.createElement('style'),b='body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}',h=d.getElementsByTagName('head')[0];a.setAttribute('id','_vis_opt_path_hides');a.setAttribute('type','text/css');if(a.styleSheet)a.styleSheet.cssText=b;else a.appendChild(d.createTextNode(b));h.appendChild(a);return settings_timer;}};}());_vwo_settings_timer=_vwo_code.init();
</script>
<!-- End Visual Website Optimizer Asynchronous Code -->

3. Existing meta property og:description

Please change to:

Kong is the Next Generation RESTful API Management Platform to secure, manage & extend your APIs or Microservices. Made with Love by Mashape.

4. Share image

Please replace http://getkong.org/share.png image with the attached kong image and make sure it is available on http://getkong.org/share.png

kong

5. Send users who sign up for email updates to customer.io

Format for identifying users via segmentio's identity function is wrong. Instead of nesting userId inside the traits object, you need to send it as the first param.
You need to send this:

analytics.identify('[email protected]', {
  email: "[email protected]",
  environment: 'kong',
  name: 'Christina Ng'
});

Right now, you are sending this which doesnt work:

analytics.identify({
  userId: '[email protected]',
  environment: 'kong',
  name: 'Christina Ng',
  email: "[email protected]"
});

6. Send event for Viewed XX page

We need to send custom events for "Viewed XX page" e.g. "Viewed Documentation page" and "Viewed Enterprise page" and "Viewed Plugins page" etc via analytics.track.

This is because mixpanel doesnt allow me to build a funnel using the analytics.page events so I need a separate analytics.track event.

code snippets

two questions:

  • should we standardize spacing? (e.g. some JSON snippets have 4 spaces, curl have 2)
  • do we really need a dollar sign for bash snippets? makes it more annoying to copy-paste.

0.3.0 documentation changes

A to-be-improved list of things to document for the upcoming 0.3.0, with links to possible documentation when available:

  • Admin API
    • New routes to document in the sidebar, /plugins_configurations should be considered deprecated in favour of /apis/{api}/plugins Kong/kong#257
    • Update the tutorials to use the new routing (/apis/{api}/plugins and /consumer/{consumer}/keyauth) which will stop confusing users about the famous "API_ID" as a form parameter.
    • It now supports application/json Content Type. Kong/kong#236
    • It now supports PUT calls. Kong/kong#236
  • Proxy
    • Support for path routing. Kong/kong#282
    • Support for alternate Host header: X-Host-Override. Kong/kong#246
    • Headers sent to the upstream server when using authentication plugins
  • Plugins
    • HTTP logging docs. Kong/kong#244
    • File logging has a new option to specify a path to a file. Kong/kong#202
    • Document the SSL plugin, and SSL features. Kong/kong#254
    • Document the Analytics plugin. Kong/kong#272
    • Document the response transformations plugin.
    • Document the request size limiting plugin
  • Chore
    • Document that openresty must be patched in the Source install for SSL support

Not related to 0.3.0, but still missing

  • Document the default logging format.
  • Document how the proxy layer works. #80 Also related to the new path routing and the new X-Host-Override header.

Setup redirects to the latest docs version

As mentioned in #10, we should redirect a request at /docs/{latest,current} to `/docs/x.x.x. This can only happen if we host getkong.org somewhere else of if we use something such as cloudflare.

Caveats:

  • The process won't be automated

Or, during the website generation we can duplicate the content of the latest version into a new latest/current folder. It won't be redirects, but it'll be automated.

Caveats:

  • It could impact SEO?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.