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

docs: contribute Getting Started tutorials #9046

Merged
merged 7 commits into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
11 changes: 9 additions & 2 deletions docs/en/latest/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@
"version": "3.2.0",
"sidebar": [
{
"type": "doc",
"id": "getting-started"
"type": "category",
"label": "Getting Started",
"items": [
"getting-started/README",
"getting-started/configure-routes",
"getting-started/load-balancing",
"getting-started/key-authentication",
"getting-started/rate-limiting"
]
},
{
"type": "doc",
Expand Down
91 changes: 91 additions & 0 deletions docs/en/latest/getting-started/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved
title: Get APISIX
description: This tutorial uses a script to quickly install Apache APISIX in your local environment and verify it through the Admin API.
---

<!--
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-->

<head>
<link rel="canonical" href="https://docs.api7.ai/apisix/getting-started/" />
</head>

> The Getting Started tutorials are contributed by [API7.ai](https://api7.ai/) and are licensed under the Apache 2.0 license.

Apache APISIX is a dynamic, real-time, and high-performance API Gateway. It is a [top-level project](https://projects.apache.org/project.html?apisix) of the Apache Software Foundation.

You can use APISIX API Gateway as a traffic entrance to process all business data. It offers features including dynamic routing, dynamic upstream, dynamic certificates, A/B testing, canary release, blue-green deployment, limit rate, defense against malicious attacks, metrics, monitoring alarms, service observability, service governance, and more.

This tutorial uses a script to quickly install [Apache APISIX](https://api7.ai/apisix) in your local environment and verifies the installation through the Admin API.

## Prerequisite(s)

The quickstart script relies on several components:

* [Docker](https://docs.docker.com/get-docker/) is used to install the containerized **etcd** and **APISIX**.
* [curl](https://curl.se/) is used to send requests to APISIX for validation.

## Get APISIX

:::caution

To provide a better experience in this tutorial, the authorization of Admin API is switched off by default. Please turn on the authorization of Admin API in the production environment.

:::

guoqqqi marked this conversation as resolved.
Show resolved Hide resolved
APISIX can be easily installed and started with the quickstart script:

```shell
curl -sL https://run.api7.ai/apisix/quickstart | sh
```

The script should start two Docker containers, _apisix-quickstart_ and _etcd_. APISIX uses etcd to save and synchronize configurations. Both the etcd and the APISIX use [**host**](https://docs.docker.com/network/host/) Docker network mode. That is, the APISIX can be accessed from local.

You will see the following message once APISIX is ready:

```text
✔ APISIX is ready!
```


## Validate

Once APISIX is running, you can use curl to interact with it. Send a simple HTTP request to validate if APISIX is working properly:

```shell
curl "http://127.0.0.1:9080" --head | grep Server
```

If everything is ok, you will get the following response:

```text
Server: APISIX/3.1.0
```

You now have APISIX installed and running successfully!​

## Next Steps

The following tutorial is based on the working APISIX, please keep everything running and move on to the next step.

* [Configure Routes](configure-routes.md)
* [Load Balancing](load-balancing.md)
* [Rate Limiting](rate-limiting.md)
* [Key Authentication](key-authentication.md)

92 changes: 92 additions & 0 deletions docs/en/latest/getting-started/configure-routes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
juzhiyuan marked this conversation as resolved.
Show resolved Hide resolved
title: Configure Routes
slug: /getting-started/configure-routes
---

<!--
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
-->

<head>
<link rel="canonical" href="https://docs.api7.ai/apisix/getting-started/configure-routes" />
</head>

> The Getting Started tutorials are contributed by [API7.ai](https://api7.ai/) and are licensed under the Apache 2.0 license.

Apache APISIX provides flexible gateway management capabilities based on _routes_, where routing paths and targets are defined for requests.

This tutorial guides you on how to create a route and validate it. You will complete the following steps:

1. Create a route with a sample _upstream_ that points to [httpbin.org](http://httpbin.org).
2. Use _cURL_ to send a test request to see how APISIX proxies and forwards the request.

## What is a Route

A route is a routing path to upstream targets. In [Apache APISIX](https://api7.ai/apisix), routes are responsible for matching client's requests based on defined rules, loading and executing the corresponding plugins, as well as forwarding requests to the specified upstream services.

In APISIX, a simple route can be set up with a path-matching URI and a corresponding upstream address.

## What is an Upstream

An upstream is a set of target nodes with the same work. It defines a virtual host abstraction that performs load balancing on a given set of service nodes according to the configured rules.

## Prerequisite(s)

1. Complete [Get APISIX](./) to install APISIX.

## Create a Route

In this section, you will create a route that forwards client requests to [httpbin.org](http://httpbin.org), a public HTTP request and response service.

The following command creates a route, which should forward all requests sent to `http://127.0.0.1:9080/ip` to [httpbin.org/ip](http://httpbin.org/ip):

[//]: <TODO: Add the link to the authorization of Admin API>

```shell
curl -i "http://127.0.0.1:9180/apisix/admin/routes" -X PUT -d '
{
"id": "getting-started-ip",
"uri": "/ip",
"upstream": {
"type": "roundrobin",
"nodes": {
"httpbin.org:80": 1
}
}
}'
```

You will receive an `HTTP/1.1 201 OK` response if the route was created successfully.

## Validate

```shell
curl "http://127.0.0.1:9080/ip"
```

The expected response is similar to the following:

```text
{
"origin": "183.94.122.205"
}
```

## What's Next

This tutorial creates a route with only one target node. In the next tutorial, you will learn how to configure load balancing with multiple target nodes.
Loading