Activity Pub Reverse Proxy Framework
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
luna 84cb21b26a Merge pull request 'add config file validation' (#2) from config-validation into mistress
Reviewed-on: #2
10 months ago
scripts add draft for config schema validation 10 months ago
tests validate schema on module tests 10 months ago
.gitignore Initial commit 10 months ago
LICENSE Initial commit 10 months ago
Makefile add Makefile 10 months ago
README.md README: update wording 10 months ago
conf.lua add config file loading 10 months ago
config.lua only run config validations on init callback 10 months ago
ctx.lua show name of module that filtered request in logs 10 months ago
docker-compose.yaml add config file loading 10 months ago
main.lua only run config validations on init callback 10 months ago
nginx.conf add hook for init_by_lua_block 10 months ago
test.lua validate schema on module tests 10 months ago
util.lua properly print config errors when loading config file 10 months ago

README.md

aproxy

Activity Pub Reverse Proxy Framework

this is a collection of OpenResty scripts that provide different functionality on top of ActivityPub implementations.

Installation

the fuck is openresty

Get OpenResty: http://openresty.org/en/

For those not in the know, OpenResty is a "soft fork" of the god NGINX. It adds various modules but the most important of them is Lua scripting (provided by another god, LuaJIT)

It is an effective replacement to your NGINX installation, but you can have them coexisting (say, NGINX on port 80, OpenResty being reverse proxied by NGINX on port 8069, though I wouldn't recommend it in production environments).

actually installing aproxy

mkdir /opt
git clone https://gitdab.com/luna/aproxy

cd aproxy
mkdir /etc/aproxy
cp ./conf.lua /etc/aproxy/conf.lua
$EDITOR /etc/aproxy/conf.lua

now to configuring openresty to use aproxy

Say, you already have your reverse proxy block to your instance as such:

http {
    server {
        server_name example.com;
        location / {
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
            proxy_pass http://localhost:4000;
        }
    }
}

You need to do the following:

  • Configure OpenResty package path so that it can call aproxy.
  • Insert aproxy as a callback on location / { block

It'll look something like this:

http {
    lua_package_path '/opt/?.lua;/opt/aproxy/?.lua;;';
        
    server {
        server_name example.com;
        location / {
            # set this to 'on' after you have tested that it actually works.
            # once you do that, performance will be increased
            # while the friction to quickly debug aproxy will also be increased
            lua_code_cache off;
            access_by_lua_block {
                require("aproxy.main")()
            }

            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Host $http_host;
            proxy_pass http://localhost:4000;
        }
    }
}

Running the test suite

requires luarocks, luajit, and nothing else.

make testdeps
eval (luarocks-5.1 path --bin)
make test