{"id":34099811,"url":"https://github.com/projecteru2/elb","last_synced_at":"2025-12-14T16:03:30.396Z","repository":{"id":57426004,"uuid":"104729064","full_name":"projecteru2/elb","owner":"projecteru2","description":"Eru load balancer","archived":false,"fork":false,"pushed_at":"2019-09-25T14:16:32.000Z","size":50,"stargazers_count":10,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-15T12:29:42.240Z","etag":null,"topics":["docker","eru","load-balancer","lua","openresty"],"latest_commit_sha":null,"homepage":"https://eru.sh","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/projecteru2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-25T09:21:03.000Z","updated_at":"2022-06-08T07:24:10.000Z","dependencies_parsed_at":"2022-09-19T06:50:53.532Z","dependency_job_id":null,"html_url":"https://github.com/projecteru2/elb","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/projecteru2/elb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projecteru2%2Felb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projecteru2%2Felb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projecteru2%2Felb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projecteru2%2Felb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/projecteru2","download_url":"https://codeload.github.com/projecteru2/elb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/projecteru2%2Felb/sbom","scorecard":{"id":746608,"data":{"date":"2025-08-11","repo":{"name":"github.com/projecteru2/elb","commit":"e3fbdccd3925fa1176c12555d6029ae3880db74c"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Code-Review","score":0,"reason":"Found 2/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: containerImage not pinned by hash: Dockerfile:3: pin your Docker image by updating alpine:latest to alpine:latest@sha256:4bcff63911fcb4448bd4fdacec207030997caf25e9bea4045fa6c8c44de311d1","Info:   0 out of   1 containerImage dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-22T18:57:15.961Z","repository_id":57426004,"created_at":"2025-08-22T18:57:15.961Z","updated_at":"2025-08-22T18:57:15.961Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27730950,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","eru","load-balancer","lua","openresty"],"created_at":"2025-12-14T16:03:29.381Z","updated_at":"2025-12-14T16:03:30.388Z","avatar_url":"https://github.com/projecteru2.png","language":"Lua","readme":"Eru load balance\n================\n\n[![Build Status](https://travis-ci.org/projecteru2/elb.svg?branch=master)](https://travis-ci.org/projecteru2/elb)\n[![Pypi Status](https://img.shields.io/pypi/v/elb.py.svg)](https://pypi.python.org/pypi/elb.py)\n\nELB (Eru load balance) is based on [openresty](https://openresty.org/en/). In Eru architecture, we use multiple filters to determine which upstream to forward. And by using [ngx_http_dyups_module](https://github.com/yzprofile/ngx_http_dyups_module), [citadel](https://github.com/citadel) can update upstream dynamically.\n\n### Features\n\n* update upstream dynamically\n* run by eru\n* custom strategies of network flow\n\n### Storage\n\nELB will load data from [etcd](https://github.com/coreos/etcd) when starting.\n\n### Rule\n\nIn this version, we provide two types of filter. One is for user-agent, another for path. So we design a simple protocol for describing it.\n\nThis data will store in etcd with key `/$ELBNAME/rules/$domain`.\n\nFor example:\n\n```json\n{\n    \"init\": \"r1\",\n    \"rules\": {\n        \"r1\": {\"type\": \"ua\", \"args\": {\"fail\": \"r3\", \"pattern\": \"httpie(\\\\S+)$\", \"succ\": \"r4\"}},\n        \"r2\": {\"type\": \"backend\", \"args\": {\"servername\": \"upstream1\"}},\n        \"r3\": {\"type\": \"backend\", \"args\": {\"servername\": \"upstream2\"}},\n        \"r4\": {\"type\": \"path\", \"args\": {\"regex\": true, \"pattern\": \"^\\\\/blog\\\\/(\\\\S+)$\", \"succ\": \"r2\", \"fail\": \"r3\", \"rewrite\": false}}\n    },\n}\n```\n\nYou can build a complex filter by multiple rules.\n\n### Upstream\n\nUpstream data also store in etcd with key `/$ELBNAME/upstreams/$backend/$server`.\n\nFor example\n\n```\netcdctl set /ELB/upstreams/up1/127.0.0.1:8088 \"\"\netcdctl set /ELB/upstreams/up1/127.0.0.1:8089 \"\"\netcdctl set /ELB/upstreams/up2/127.0.0.1:8089 \"max_fails=2 weight=10\"\n```\n\nUse dir to store server data will help you to asynchronous active server in upstream.\n\n### API\n\nELB have two APIs for managing.\n\n##### Domain API `/__erulb__/domain`\n\nWhen `GET` this url, it will response a json which contains domain and it's rules.\n\nFor example:\n\n```\nGET /__erulb__/domain HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nHost: 127.0.0.1:8080\nUser-Agent: HTTPie/0.9.9\n\n\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Type: application/json\nDate: Mon, 25 Sep 2017 09:06:32 GMT\nServer: openresty/1.11.2.5\nTransfer-Encoding: chunked\n\n{\n    \"127.0.0.1\": {\n        \"init\": \"r1\",\n        \"rules\": {\n            \"r1\": {\n                \"args\": {\n                    \"fail\": \"r3\",\n                    \"pattern\": \"httpie(\\\\S+)$\",\n                    \"succ\": \"r4\"\n                },\n                \"type\": \"ua\"\n            },\n            \"r2\": {\n                \"args\": {\n                    \"servername\": \"up1\"\n                },\n                \"type\": \"backend\"\n            },\n            \"r3\": {\n                \"args\": {\n                    \"servername\": \"up2\"\n                },\n                \"type\": \"backend\"\n            },\n            \"r4\": {\n                \"args\": {\n                    \"fail\": \"r3\",\n                    \"pattern\": \"^\\\\/blog\\\\/(\\\\S+)$\",\n                    \"regex\": true,\n                    \"rewrite\": false,\n                    \"succ\": \"r2\"\n                },\n                \"type\": \"path\"\n            }\n        }\n    }\n}\n```\n\nIf you `PUT` this url, you have to upload a json with domains and it's rule, then ELB will update itself with their rules. For example:\n\n```\nPUT /__erulb__/domain HTTP/1.1\nAccept: application/json\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 305\nContent-Type: application/json\nHost: localhost:8080\nUser-Agent: HTTPie/0.9.4\n\n{\n    \"localhost\": {\n        \"init\": \"r1\",\n        \"rules\": {\n            \"r1\": {\n                \"args\": {\n                    \"fail\": \"r3\",\n                    \"pattern\": \"^\\\\/blog\\\\/(\\\\S+)$\",\n                    \"regex\": true,\n                    \"rewrite\": false,\n                    \"succ\": \"r2\"\n                },\n                \"type\": \"path\"\n            },\n            \"r2\": {\n                \"args\": {\n                    \"servername\": \"upstream1\"\n                },\n                \"type\": \"backend\"\n            },\n            \"r3\": {\n                \"args\": {\n                    \"servername\": \"upstream2\"\n                },\n                \"type\": \"backend\"\n            }\n        }\n    }\n}\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Type: application/json\nDate: Tue, 26 Sep 2017 15:03:03 GMT\nServer: openresty/1.11.2.5\nTransfer-Encoding: chunked\n\n{\n    \"msg\": \"OK\"\n}\n```\n\nThen domain `localhost` was added. However, if somebody restart ELB, it will lose. Don't forget to store rules in etcd.\n\nIf you use `DELETE` method, you can upload a json with domains, then ELB will delete those domains.\n\n```\nDELETE /__erulb__/domain HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 0\nHost: localhost:8080\nUser-Agent: HTTPie/0.9.9\n\n[\n    \"localhost\",\n    \"127.0.0.1\"\n]\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Type: application/json\nDate: Wed, 27 Sep 2017 06:36:30 GMT\nServer: openresty/1.11.2.5\nTransfer-Encoding: chunked\n\n{\n    \"msg\": \"OK\"\n}\n```\n\nDon't forget delete domains data in etcd.\n\n##### Upstream API `/__erulb__/upstream`\n\nIf you `GET` this url, elb will response a json which contains upstreams and it's backends like this:\n\n```\nGET /__erulb__/upstream HTTP/1.1\nAccept: */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nHost: 127.0.0.1:8080\nUser-Agent: HTTPie/0.9.9\n\n\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Type: application/json\nDate: Mon, 25 Sep 2017 09:08:59 GMT\nServer: openresty/1.11.2.5\nTransfer-Encoding: chunked\n\n{\n    \"upstream1\": [\n        {\n            \"addr\": \"127.0.0.1:8089\",\n            \"fail_timeout\": 10,\n            \"max_fails\": 1,\n            \"name\": \"127.0.0.1:8089\",\n            \"weight\": 1\n        },\n        {\n            \"addr\": \"127.0.0.1:8088\",\n            \"fail_timeout\": 10,\n            \"max_fails\": 1,\n            \"name\": \"127.0.0.1:8088\",\n            \"weight\": 1\n        }\n    ],\n    \"upstream2\": [\n        {\n            \"addr\": \"127.0.0.1:8089\",\n            \"fail_timeout\": 10,\n            \"max_fails\": 2,\n            \"name\": \"127.0.0.1:8089\",\n            \"weight\": 10\n        }\n    ]\n}\n```\n\nIf you use `PUT` method, you can upload a json with upstreams and it's backends, then ELB will update itself with their upstreams. For example:\n\n```\nPUT /__erulb__/upstream HTTP/1.1\nAccept: application/json, */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 115\nContent-Type: application/json\nHost: localhost:8080\nUser-Agent: HTTPie/0.9.9\n\n{\n    \"up1\": {\n        \"127.0.0.1:8088\": \"\",\n        \"127.0.0.1:8089\": \"\"\n    },\n    \"up2\": {\n        \"localhost:8088\": \"\",\n        \"localhost:8089\": \"\"\n    }\n}\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Type: application/json\nDate: Mon, 25 Sep 2017 09:10:58 GMT\nServer: openresty/1.11.2.5\nTransfer-Encoding: chunked\n\n{\n    \"msg\": \"OK\"\n}\n```\n\nIf you use `DELETE` method, you can upload a json with upstreams' name, then ELB will delete those upstreams.\n\n```\nDELETE /__erulb__/upstream HTTP/1.1\nAccept: application/json, */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 8\nContent-Type: application/json\nHost: localhost:8080\nUser-Agent: HTTPie/0.9.9\n\n[\n    \"upstream1\",\n    \"upstream2\"\n]\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Type: application/json\nDate: Wed, 27 Sep 2017 06:34:51 GMT\nServer: openresty/1.11.2.5\nTransfer-Encoding: chunked\n\n{\n    \"upstream1\": true,\n    \"upstream2\": true\n}\n```\n\nDon't forget delete upstreams data in etcd.\n\n##### Dump API `/__erulb__/dump`\n\n`PUT` this url, in-memory data will be dumped into etcd. and next elb will load it automatically from etcd.\n\n```\nPUT /__erulb__/dump HTTP/1.1\nAccept: application/json, */*\nAccept-Encoding: gzip, deflate\nConnection: keep-alive\nContent-Length: 115\nContent-Type: application/json\nHost: localhost:8080\nUser-Agent: HTTPie/0.9.9\n\nHTTP/1.1 200 OK\nConnection: keep-alive\nContent-Type: application/json\nDate: Mon, 25 Sep 2017 09:10:58 GMT\nServer: openresty/1.11.2.5\nTransfer-Encoding: chunked\n\n{\n    \"msg\": \"OK\"\n}\n```\n\n### Env\n\nELB will read `ETCD`, `ELBNAME` and `STATSD` from environment.\n\nIf etcd and elbname not set, elb will use `127.0.0.1:2379` and `ELB` as default.\n\nBut if `STATSD` not set, elb will not calcuate domain status.\n\n### Dockerized ELB manually\n\nWe suggest you to run elb by ERU, however this [image](https://hub.docker.com/r/projecteru2/elb/) can standalone running.\n\n```shell\ndocker run -d --privileged \\\n  --name eru_elb_$HOSTNAME \\\n  --net host \\\n  --restart always \\\n  -e \"ETCD=\u003cIP:PORT\u003e\" \\\n  -e \"ELBNAME=\u003cELBNAME\u003e\" \\\n  -e \"STATSD=\u003cIP:PORT\u003e\" \\\n  projecteru2/elb\n```\n\n### Build and Deploy by Eru itself\n\nAfter we implemented bootstrap in eru2, now you can build and deploy elb with [cli](https://github.com/projecteru2/cli) tool.\n\n1. Test source code and build image\n\n```shell\n\u003ccli_execute_path\u003e --name \u003cimage_name\u003e https://goo.gl/WTGT9E\n```\n\nMake sure you can clone code by ssh protocol because libgit2 ask for it. So you need configure core with github certs. After the fresh image was named and tagged, it will be auto pushed to the remote registry which was defined in core.\n\n2. Deploy elb by eru with specific resource.\n\n```shell\n\u003ccli_execute_path\u003e --pod \u003cpod_name\u003e --entry elb --network \u003cnetwork_name\u003e --image \u003cprojecteru2/elb\u003e|\u003cyour_own_image\u003e [--node \u003cspecify_node\u003e] [--cpu 0.3 | --mem 1024000000] https://goo.gl/WTGT9E\n```\n\nNow you will find elb was started.\n\n### Warning\n\nBecause overlayfs with CentOS 7 has some issue, do not compile Dockerfile on CentOS 7 with overlayfs if you use early docker befor [this](https://github.com/moby/moby/issues/13108).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojecteru2%2Felb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprojecteru2%2Felb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprojecteru2%2Felb/lists"}