The reason for the apisix startup script use `lua` as the interpreter is we don't know the path of LuaJIT in user's environment. Sure you can change the interpreter to LuaJIT in your own production environment.
Thanks, Ming Wen, Apache APISIX Twitter: _WenMing liyong <[email protected]> 于2019年11月27日周三 下午12:05写道: > Currently luarocks 3( latest version 3.2.1) and build with OpenResty > luajit, the apisix startup script currently use `#!/usr/bin/env lua` as its > interpreter, it also support luajit bundled with OpenResty, so I thought we > can only depend OpenResty in production environment, does anyone else has > some good advices. > > On Thu, Nov 21, 2019 at 10:43 AM liyong <[email protected]> wrote: > > > The Makefile has already give a recommended way for install dependencies > > by using luarock 3 with the --lua-dir option specified to OpenResty's > > luajit, and the dependencies is installed at current directory(project > repo > > root). > > But how we do this for production environment? The `install` target in > > `Makefile` copy the source to `/usr/local/apisix`(`apisix_home`),I think > > this is very good, but it doesn't copy deps directory to > > `/usr/local/apisix`, I think we should also copy this. > > The OpenResty use `/usr/local/apisix` as its prefix path, the log path > > locate at /var/log/apisix/ may be more compatible with Linux FHS > standard. > > As this can be configured by `config.yaml`, we can skip this step now. > > > > So the standard production install like this: > > 1. Ensure `OpenResty` is installed and has the expected version(s) > > 2. Ensure `luarocks 3` is installed > > 3. Use `/usr/local/apisix` as `apisix_home` > > sudo luarocks install --lua-dir=/usr/local/openresty/luajit > > --tree=/usr/local/apisix apisix > > The directory tree like this: > > /usr/local/apisix > > ├── bin > > │ └── apisix > > ├── conf > > │ ├── cert > > │ │ ├── apisix.crt > > │ │ └── apisix.key > > │ ├── config.yaml > > │ ├── mime.types > > │ └── nginx.conf > > ├── lib > > │ ├── lua > > │ │ └── 5.1 > > │ │ ├── lfs.so > > │ │ ├── librestychash.so > > │ │ ├── librestyradixtree.so > > │ │ ├── pb.so > > │ │ └── rapidjson.so > > │ └── luarocks > > │ └── rocks-5.1 > > │ ├── apisix > > │ ├── iresty-nginx-lua-prometheus > > │ ├── luafilesystem > > │ ├── lua-protobuf > > │ ├── lua-resty-balancer > > │ ├── lua-resty-cookie > > │ ├── lua-resty-etcd > > │ ├── lua-resty-healthcheck-iresty > > │ ├── lua-resty-http > > │ ├── lua-resty-ipmatcher > > │ ├── lua-resty-jit-uuid > > │ ├── lua-resty-jwt > > │ ├── lua-resty-ngxvar > > │ ├── lua-resty-openidc > > │ ├── lua-resty-radixtree > > │ ├── lua-resty-session > > │ ├── lua-resty-template > > │ ├── lua-resty-worker-events > > │ ├── lua-tinyyaml > > │ ├── lua-typeof > > │ ├── manifest > > │ ├── opentracing-openresty > > │ └── rapidjson > > ├── logs > > └── share > > └── lua > > └── 5.1 > > ├── apisix > > ├── nginx > > ├── opentracing > > ├── protoc.lua > > ├── resty > > ├── tinyyaml.lua > > └── typeof.lua > > > > > > What can we do? > > 1. Add install document for production environment > > 2. Support upgrade document for each release > > 3. Modify Makefile to support installation(`make install`) current > codebase > > 4. Add some `config.yaml` config item, eg. `tmp_dir`, this would set > > *_temp_path for OpenResty. > > ``` > > client_body_temp_path > > fastcgi_temp_path > > uwsgi_temp_path > > scgi_temp_path > > proxy_temp_path > > ``` > > >
