OpenResty

From UVOO Tech Wiki
Jump to navigation Jump to search

If needing more than nginx/resty openresty might be a good option

Install on Ubuntu via Deb Package Repo

https://openresty.org/en/linux-packages.html

sudo systemctl disable nginx
sudo systemctl stop nginx
# Otherwise the installation might fail.

# You can add our APT repository to your Ubuntu system so as to easily install our packages and receive updates in the future (via the apt-get update command). To add the repository, just run the following commands (only need to run once for each system):

# import our GPG key:
wget -qO - https://openresty.org/package/pubkey.gpg | sudo apt-key add -

# for installing the add-apt-repository command
# (you can remove this package and its dependencies later):
sudo apt-get -y install software-properties-common

# add the our official APT repository:
sudo add-apt-repository -y "deb http://openresty.org/package/ubuntu $(lsb_release -sc) main"

# to update the APT index:
sudo apt-get update

# Then you can install a package, say, openresty, like this:
sudo apt-get install openresty

# Move nginx files over to openresty

Useful modules

https://github.com/ledgetech/lua-resty-http

local http = require "resty.http"
local httpc = http.new()

local res, err = httpc:request_uri("http://127.0.0.1/functions.json", { method = "GET" })
// Use res.body to access the response

https://openresty.org/en/postgres-nginx-module.html

resty myfile.lua

https://github.com/SkyLothar/lua-resty-jwt#methods

https://github.com/altexy/lua-resty-jwt

https://github.com/wahern/luaossl

Health Checks