2019-07-18 16:09:30 +08:00
|
|
|
# dev-manual
|
|
|
|
|
|
|
|
## Install APISIX in development environment
|
|
|
|
|
|
|
|
If you are a developer, you can set up a local development environment with the following commands.
|
|
|
|
|
|
|
|
```shell
|
|
|
|
git clone git@github.com:iresty/apisix.git
|
|
|
|
cd apisix
|
2019-09-12 10:56:47 +08:00
|
|
|
|
|
|
|
# init submodule
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
|
|
|
# install dependency
|
2019-07-18 16:09:30 +08:00
|
|
|
make dev
|
|
|
|
```
|
|
|
|
|
|
|
|
If all goes well, you will see this message at the end:
|
|
|
|
|
|
|
|
> Stopping after installing dependencies for apisix
|
|
|
|
|
|
|
|
The following is the expected development environment directory structure:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ tree -L 2 -d apisix
|
|
|
|
apisix
|
2019-09-12 10:56:47 +08:00
|
|
|
├── benchmark
|
|
|
|
│ ├── fake-apisix
|
|
|
|
│ └── server
|
2019-07-18 16:09:30 +08:00
|
|
|
├── bin
|
|
|
|
├── conf
|
2019-09-12 10:56:47 +08:00
|
|
|
│ └── cert
|
|
|
|
├── dashboard
|
|
|
|
│ ├── css
|
|
|
|
│ ├── fonts
|
|
|
|
│ ├── img
|
|
|
|
│ ├── js
|
|
|
|
│ └── tinymce
|
|
|
|
├── deps # dependent Lua and dynamic libraries
|
2019-07-18 16:09:30 +08:00
|
|
|
│ ├── lib64
|
|
|
|
│ └── share
|
|
|
|
├── doc
|
2019-09-12 10:56:47 +08:00
|
|
|
│ ├── images
|
|
|
|
│ └── plugins
|
|
|
|
├── logs
|
2019-07-18 16:09:30 +08:00
|
|
|
├── lua
|
|
|
|
│ └── apisix
|
2019-09-12 10:56:47 +08:00
|
|
|
├── rockspec
|
2019-07-18 16:09:30 +08:00
|
|
|
├── t
|
|
|
|
│ ├── admin
|
2019-09-12 10:56:47 +08:00
|
|
|
│ ├── config-center-yaml
|
2019-07-18 16:09:30 +08:00
|
|
|
│ ├── core
|
|
|
|
│ ├── lib
|
|
|
|
│ ├── node
|
2019-09-12 10:56:47 +08:00
|
|
|
│ ├── plugin
|
|
|
|
│ ├── router
|
|
|
|
│ └── servroot
|
2019-07-18 16:09:30 +08:00
|
|
|
└── utils
|
|
|
|
```
|
|
|
|
|
|
|
|
We can use more actions in the `make` command, for example:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
$ make help
|
|
|
|
Makefile rules:
|
|
|
|
|
|
|
|
help: Show Makefile rules.
|
|
|
|
dev: Create a development ENV
|
2019-09-12 10:56:47 +08:00
|
|
|
dev_r3: Create a development ENV for r3
|
|
|
|
check: Check Lua source code
|
2019-07-18 16:09:30 +08:00
|
|
|
init: Initialize the runtime environment
|
|
|
|
run: Start the apisix server
|
|
|
|
stop: Stop the apisix server
|
|
|
|
clean: Remove generated files
|
|
|
|
reload: Reload the apisix server
|
|
|
|
install: Install the apisix
|
2019-09-12 10:56:47 +08:00
|
|
|
test: Run the test case
|
2019-07-18 16:09:30 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Test
|
|
|
|
|
|
|
|
Running the test cases at local machine:
|
|
|
|
|
|
|
|
```shell
|
|
|
|
make test
|
|
|
|
```
|
|
|
|
|
|
|
|
The following dependencies are required to run the test suite:
|
|
|
|
|
|
|
|
* Nginx: version >= 1.4.2
|
|
|
|
|
|
|
|
* Perl modules:
|
|
|
|
`Test::Nginx` https://github.com/openresty/test-nginx
|
|
|
|
|
|
|
|
For the detail on how to install dependencies, please take a look at [travis.yml](.travis.yml).
|