From 41688e01f2165f12b39af2b6d65640772cfabc6f Mon Sep 17 00:00:00 2001 From: Joao M Date: Tue, 4 Jun 2024 21:28:13 -0500 Subject: [PATCH 01/15] Create CONTRIBUTING.md --- CONTRIBUTING.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..f8f3bc8 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,37 @@ +# Contributing to byjg/docker-easy-haproxy + +First of all, thank you for taking the time to contribute! + +## How to Contribute + +### Issues + +If you encounter any issues, have questions, or need clarification, please open an issue on our [Issues page](https://github.com/your-repo/issues). This helps us track and prioritize bug fixes and enhancements. + +### Branches + +We have three main branches in this project: + +- **master**: Contains the latest code. It is generally stable, but we recommend using it with caution. +- **a.b**: Use this branch for creating PRs. The naming convention follows `a.b`, where `a` is the major release and `b` is the minor release of the current version. For example, if the current release is 4.9.2, use the branch `4.9` for your PR. You can also use `4.9.x-dev` in your composer for development purposes. +- **future release**: This branch is typically `(a+1).0`. For instance, if the current release is 4.9.2, the future release branch will be `5.0`. + + +### Code Style and Guidelines + +- **Follow PSR Standards**: We follow [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/), and [PSR-12](https://www.php-fig.org/psr/psr-12/). +- **Write Clear Commit Messages**: Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. +- **Documentation**: Update the documentation for any new features or changes. + +### Common Practices + +- **Keep Pull Requests Small**: Smaller PRs are easier to review and merge. Focus on one feature or fix per PR. +- **Write Tests**: Ensure your changes are covered by tests. We aim for a high level of test coverage. +- **Respect Reviewers' Time**: Be responsive to feedback and willing to make necessary changes. + +### Community + +- **Be Respectful**. +- **Collaborate**: We encourage collaboration and open discussion. Don’t hesitate to ask for help or provide feedback. + +Thank you for contributing to byjg/docker-easy-haproxy! Your help is appreciated and makes a big difference. From 5b76656993f15a42ddd346a5c5dee54e9fa4d4ab Mon Sep 17 00:00:00 2001 From: Joao M Date: Tue, 4 Jun 2024 21:28:47 -0500 Subject: [PATCH 02/15] Create FUNDING.yml --- .github/FUNDING.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..3a9251f --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,3 @@ +# These are supported funding model platforms + +github: byjg From 1a6853487ec9aabcb241f3c9e263313138378b0c Mon Sep 17 00:00:00 2001 From: Joao M Date: Tue, 4 Jun 2024 21:31:19 -0500 Subject: [PATCH 03/15] Update CONTRIBUTING.md --- CONTRIBUTING.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f8f3bc8..183cc37 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -19,7 +19,6 @@ We have three main branches in this project: ### Code Style and Guidelines -- **Follow PSR Standards**: We follow [PSR-1](https://www.php-fig.org/psr/psr-1/), [PSR-2](https://www.php-fig.org/psr/psr-2/), and [PSR-12](https://www.php-fig.org/psr/psr-12/). - **Write Clear Commit Messages**: Use the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. - **Documentation**: Update the documentation for any new features or changes. From 8671a80b7470b584af8bac89ed1bd56c9a493d56 Mon Sep 17 00:00:00 2001 From: Dylan Vos Date: Sat, 9 Nov 2024 14:10:01 +0100 Subject: [PATCH 04/15] #56 prototyped manual-auth-hook and different `preferred-challenges` support --- src/functions/__init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/functions/__init__.py b/src/functions/__init__.py index 1b3b1c0..56d8bdf 100644 --- a/src/functions/__init__.py +++ b/src/functions/__init__.py @@ -285,6 +285,8 @@ class Certbot: self.eab_hmac_key = self.set_eab_hmac_key(env["certbot"]["eab_hmac_key"]) self.freeze_issue = {} self.retry_count = env["certbot"]["retry_count"] + self.certbot_preferred_challenges = env["certbot"]["preferred_challenges"] or "http" + self.certbot_manual_auth_hook = env["certbot"]["manual_auth_hook"] or False @staticmethod def set_acme_server(acme_server): @@ -337,9 +339,7 @@ class Certbot: renew_certs.append(host_arg) certbot_certonly = ('/usr/bin/certbot certonly {acme_server}' - ' --standalone' - ' --preferred-challenges http' - ' --http-01-port 2080' + ' --preferred-challenges {challenge}' ' --agree-tos' ' --issuance-timeout 90' ' --no-eff-email' @@ -350,9 +350,18 @@ class Certbot: eab_hmac_key=self.eab_hmac_key, certs=' '.join(request_certs), email=self.email, + challenge=self.certbot_preferred_challenges, acme_server=self.acme_server) ) + if 'http' in self.certbot_preferred_challenges: + certbot_certonly += (' --http-01-port 2080' + ' --standalone' + ) + + if self.certbot_manual_auth_hook != False: + certbot_certonly += ' --manual --manual-auth-hook \'{hook}\''.format(hook=self.certbot_manual_auth_hook) + ret_reload = False return_code_issue = 0 return_code_renew = 0 From 2026531b7f6c2c3f7c0a3a8739301d5de9c5ffcb Mon Sep 17 00:00:00 2001 From: Dylan Vos Date: Sat, 9 Nov 2024 17:35:16 +0100 Subject: [PATCH 05/15] #56: Small fix, missed ENV setting --- src/functions/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/functions/__init__.py b/src/functions/__init__.py index 56d8bdf..23ef215 100644 --- a/src/functions/__init__.py +++ b/src/functions/__init__.py @@ -41,6 +41,8 @@ class ContainerEnv: "eab_kid": os.getenv("EASYHAPROXY_CERTBOT_EAB_KID", ""), "eab_hmac_key": os.getenv("EASYHAPROXY_CERTBOT_EAB_HMAC_KEY", ""), "retry_count": int(os.getenv("EASYHAPROXY_CERTBOT_RETRY_COUNT", 60)), + "preferred_challenges": int(os.getenv("EASYHAPROXY_CERTBOT_PREFERRED_CHALLENGES", "http")), + "manual_auth_hook": int(os.getenv("EASYHAPROXY_CERTBOT_MANUAL_AUTH_HOOK", False)), } if env_vars["certbot"]["autoconfig"] != "" and not env_vars["certbot"]["server"] and env_vars["certbot"]["email"] != "": @@ -285,8 +287,8 @@ class Certbot: self.eab_hmac_key = self.set_eab_hmac_key(env["certbot"]["eab_hmac_key"]) self.freeze_issue = {} self.retry_count = env["certbot"]["retry_count"] - self.certbot_preferred_challenges = env["certbot"]["preferred_challenges"] or "http" - self.certbot_manual_auth_hook = env["certbot"]["manual_auth_hook"] or False + self.certbot_preferred_challenges = env["certbot"]["preferred_challenges"] + self.certbot_manual_auth_hook = env["certbot"]["manual_auth_hook"] @staticmethod def set_acme_server(acme_server): From b7b372c6fcbc904422398082fc02565b8ae39815 Mon Sep 17 00:00:00 2001 From: Dylan Vos Date: Sat, 9 Nov 2024 17:37:15 +0100 Subject: [PATCH 06/15] #56: Small fix, missed ENV setting - broken cast --- src/functions/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/functions/__init__.py b/src/functions/__init__.py index 23ef215..68bd260 100644 --- a/src/functions/__init__.py +++ b/src/functions/__init__.py @@ -41,8 +41,8 @@ class ContainerEnv: "eab_kid": os.getenv("EASYHAPROXY_CERTBOT_EAB_KID", ""), "eab_hmac_key": os.getenv("EASYHAPROXY_CERTBOT_EAB_HMAC_KEY", ""), "retry_count": int(os.getenv("EASYHAPROXY_CERTBOT_RETRY_COUNT", 60)), - "preferred_challenges": int(os.getenv("EASYHAPROXY_CERTBOT_PREFERRED_CHALLENGES", "http")), - "manual_auth_hook": int(os.getenv("EASYHAPROXY_CERTBOT_MANUAL_AUTH_HOOK", False)), + "preferred_challenges": os.getenv("EASYHAPROXY_CERTBOT_PREFERRED_CHALLENGES", "http"), + "manual_auth_hook": os.getenv("EASYHAPROXY_CERTBOT_MANUAL_AUTH_HOOK", False), } if env_vars["certbot"]["autoconfig"] != "" and not env_vars["certbot"]["server"] and env_vars["certbot"]["email"] != "": From e4a7fffa8f56cacbf05de3fc6355afb54de88365 Mon Sep 17 00:00:00 2001 From: Dylan Vos Date: Sat, 9 Nov 2024 17:42:55 +0100 Subject: [PATCH 07/15] #56: Updating tests --- src/tests/test_containerenv.py | 40 ++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/src/tests/test_containerenv.py b/src/tests/test_containerenv.py index 30c2680..27d672e 100644 --- a/src/tests/test_containerenv.py +++ b/src/tests/test_containerenv.py @@ -18,7 +18,9 @@ def test_container_env_empty(): "eab_kid": "", "email": "", "server": False, - "retry_count": 60} + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False} } == ContainerEnv.read() # os.environ['CERTBOT_LOG_LEVEL'] = 'warn' @@ -41,7 +43,9 @@ def test_container_env_customerrors(): "eab_kid": "", "email": "", "server": False, - "retry_count": 60} + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False} } == ContainerEnv.read() finally: del os.environ['HAPROXY_CUSTOMERRORS'] @@ -64,7 +68,9 @@ def test_container_env_sslmode(): "eab_kid": "", "email": "", "server": False, - "retry_count": 60} + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False} } == ContainerEnv.read() finally: del os.environ['EASYHAPROXY_SSL_MODE'] @@ -88,7 +94,9 @@ def test_container_env_stats(): "eab_kid": "", "email": "", "server": False, - "retry_count": 60} + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False} } == ContainerEnv.read() finally: del os.environ['HAPROXY_USERNAME'] @@ -118,7 +126,9 @@ def test_container_env_stats_password(): "eab_kid": "", "email": "", "server": False, - "retry_count": 60} + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False} } == ContainerEnv.read() finally: del os.environ['HAPROXY_PASSWORD'] @@ -148,7 +158,9 @@ def test_container_env_stats_password_2(): "eab_kid": "", "email": "", "server": False, - "retry_count": 60} + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False} } == ContainerEnv.read() finally: del os.environ['HAPROXY_USERNAME'] @@ -174,7 +186,9 @@ def test_container_env_certbot_email(): 'eab_kid': "", "email": "acme@example.org", "server": False, - "retry_count": 60 + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False } } == ContainerEnv.read() finally: @@ -187,6 +201,8 @@ def test_container_env_certbot_full(): os.environ['EASYHAPROXY_CERTBOT_EAB_KID'] = 'eab_kid' os.environ['EASYHAPROXY_CERTBOT_EAB_HMAC_KEY'] = 'eab_hmac_key' os.environ['EASYHAPROXY_CERTBOT_RETRY_COUNT'] = "10" + os.environ['EASYHAPROXY_CERTBOT_PREFERRED_CHALLENGES'] = "dns" + os.environ['EASYHAPROXY_CERTBOT_MANUAL_AUTH_HOOK'] = "something_manual_auth_hook" try: assert { "customerrors": False, @@ -203,7 +219,9 @@ def test_container_env_certbot_full(): "server": "schema://url/a", 'eab_hmac_key': 'eab_hmac_key', 'eab_kid': 'eab_kid', - 'retry_count': 10 + 'retry_count': 10, + "preferred_challenges": "dns", + "manual_auth_hook": "something_manual_auth_hook" } } == ContainerEnv.read() finally: @@ -212,6 +230,8 @@ def test_container_env_certbot_full(): del os.environ['EASYHAPROXY_CERTBOT_EAB_KID'] del os.environ['EASYHAPROXY_CERTBOT_EAB_HMAC_KEY'] del os.environ['EASYHAPROXY_CERTBOT_RETRY_COUNT'] + del os.environ['EASYHAPROXY_CERTBOT_PREFERRED_CHALLENGES'] + del os.environ['EASYHAPROXY_CERTBOT_MANUAL_AUTH_HOOK'] def test_container_log_level(): @@ -234,7 +254,9 @@ def test_container_log_level(): 'eab_kid': "", "email": "", "server": False, - "retry_count": 60 + "retry_count": 60, + "preferred_challenges": "http", + "manual_auth_hook": False } } == ContainerEnv.read() finally: From 8e9b048d96b092f316a5de243bf1420fbbc7c95b Mon Sep 17 00:00:00 2001 From: Dylan Vos Date: Sat, 9 Nov 2024 17:46:43 +0100 Subject: [PATCH 08/15] #56: Split layers in Dockerfile to speed up builds --- build/Dockerfile | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 334f3cb..0b5101b 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -5,16 +5,20 @@ ARG RELEASE_VERSION_ARG ENV RELEASE_VERSION=$RELEASE_VERSION_ARG ENV TZ="Etc/UTC" +RUN apk add --no-cache haproxy bash python3 py3-pip py-yaml certbot openssl \ + && pip3 install --upgrade pip + +RUN openssl dhparam -out /etc/haproxy/dhparam 2048 \ + && openssl dhparam -out /etc/haproxy/dhparam-1024 1024 + WORKDIR /scripts -COPY src/ /scripts/ COPY build/assets / -RUN apk add --no-cache haproxy bash python3 py3-pip py-yaml certbot openssl \ - && pip3 install --upgrade pip \ - && pip install -r requirements.txt \ - && pytest -s -vv tests/ \ - && openssl dhparam -out /etc/haproxy/dhparam 2048 \ - && openssl dhparam -out /etc/haproxy/dhparam-1024 1024 +COPY src/ /scripts/ + +RUN pip install -r requirements.txt + +RUN pytest -s -vv tests/ CMD ["/usr/bin/python", "-u", "/scripts/main.py" ] From 67e40dab436f386a19f193b005a42abc480e4d94 Mon Sep 17 00:00:00 2001 From: Joao M Date: Mon, 11 Nov 2024 13:21:49 -0600 Subject: [PATCH 09/15] Update to support Build on PRs --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 969d076..e45c985 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,9 +77,13 @@ jobs: result = [] tags.split("\n").forEach(function (item) { short_tag = item.trim().split(":")[1]; + result.push(short_tag); if (short_tag != "latest") { result.push(short_tag); } + if (short_tag == "master" || short_tag == "main") { + result.push("latest"); + } }) return result.join(","); result-encoding: string @@ -97,7 +101,7 @@ jobs: RELEASE_VERSION_ARG="${{ steps.tags.outputs.result }}" platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }} - tags: ${{ steps.meta.outputs.tags }} + tags: ${{ steps.tags.outputs.result }} labels: ${{ steps.meta.outputs.labels }} outputs: From cc5fb83dab62d5fc219874497a320b43776161c2 Mon Sep 17 00:00:00 2001 From: Joao M Date: Mon, 11 Nov 2024 13:26:33 -0600 Subject: [PATCH 10/15] Update build.yml --- .github/workflows/build.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e45c985..759271f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,13 +76,12 @@ jobs: tags = `${{ join(steps.meta.outputs.tags, ',') }}` result = [] tags.split("\n").forEach(function (item) { + echo item; short_tag = item.trim().split(":")[1]; - result.push(short_tag); - if (short_tag != "latest") { - result.push(short_tag); - } if (short_tag == "master" || short_tag == "main") { result.push("latest"); + } else if (short_tag != "latest") { + result.push(short_tag); } }) return result.join(","); From 775b1c4cc7fbf77e59c37e8515e28f0d3508aacc Mon Sep 17 00:00:00 2001 From: Joao M Date: Mon, 11 Nov 2024 13:29:39 -0600 Subject: [PATCH 11/15] Update build.yml --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 759271f..47d5c3a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,7 +76,6 @@ jobs: tags = `${{ join(steps.meta.outputs.tags, ',') }}` result = [] tags.split("\n").forEach(function (item) { - echo item; short_tag = item.trim().split(":")[1]; if (short_tag == "master" || short_tag == "main") { result.push("latest"); @@ -86,7 +85,8 @@ jobs: }) return result.join(","); result-encoding: string - - name: Get result + + - name: Get Tags run: echo "${{ steps.tags.outputs.result }}" # Build and push Docker image with Buildx (don't push on PR) From cd230528f004fb9b19032519f71ec18d27c899ae Mon Sep 17 00:00:00 2001 From: Joao M Date: Mon, 11 Nov 2024 13:39:45 -0600 Subject: [PATCH 12/15] Update build.yml --- .github/workflows/build.yml | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 47d5c3a..8b29454 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,7 +87,29 @@ jobs: result-encoding: string - name: Get Tags - run: echo "${{ steps.tags.outputs.result }}" + run: | + echo "${{ steps.tags.outputs.result }}" + + - uses: actions/github-script@v6 + id: normalized + with: + script: | + tags = `${{ join(steps.meta.outputs.tags, ',') }}` + result = [] + tags.split("\n").forEach(function (item) { + short_tag = item.trim().split(":")[1]; + if (short_tag == "master" || short_tag == "main") { + result.push("${{ env.IMAGE_NAME }}:latest"); + } else if (short_tag != "latest") { + result.push("${{ env.IMAGE_NAME }}:" + short_tag); + } + }) + return result.join(","); + result-encoding: string + + - name: Get Normalized Docker Image + run: | + echo "${{ steps.normalized.outputs.result }}" # Build and push Docker image with Buildx (don't push on PR) # https://github.com/docker/build-push-action @@ -100,7 +122,7 @@ jobs: RELEASE_VERSION_ARG="${{ steps.tags.outputs.result }}" platforms: linux/amd64,linux/arm64 push: ${{ github.event_name != 'pull_request' || github.event.inputs.push == 'true' }} - tags: ${{ steps.tags.outputs.result }} + tags: ${{ steps.normalized.outputs.result }} labels: ${{ steps.meta.outputs.labels }} outputs: @@ -139,7 +161,9 @@ jobs: CURRENT_VERSION=$(grep "appVersion: " helm/easyhaproxy/Chart.yaml | sed 's#appVersion: "\(.*\)"#\1#g') if [ "$TAG" = "$CURRENT_VERSION" ]; then - echo "Skipping update version..." + echo "Skipping version $CURRENT_VERSION..." + elif [ "$TAG" = "latest" ]; then + echo "Skipping latest version..." else sed -i "s#easy-haproxy:[a-zA-Z0-9\.-]*#easy-haproxy:$TAG#g" deploy/docker/docker-compose.yml sed -i "s#version: \"[a-zA-Z0-9\.-]*\"#version: \"$TAG\"#g" deploy/kubernetes/easyhaproxy-*.yml From 95f0163c0a2bee4d7d138c96c0fc4af9af183b98 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Tue, 12 Nov 2024 20:35:56 -0600 Subject: [PATCH 13/15] Upload PyCharm default tests --- .run/pytest in tests.run.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .run/pytest in tests.run.xml diff --git a/.run/pytest in tests.run.xml b/.run/pytest in tests.run.xml new file mode 100644 index 0000000..9b5784c --- /dev/null +++ b/.run/pytest in tests.run.xml @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file From e88f6b6326d76e00d849cd18c7f7ad00a2ecb697 Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Fri, 15 Nov 2024 10:13:24 -0600 Subject: [PATCH 14/15] Added documentation for new feature + Upgrade HAPROXY to 2.8.11 + Upgrade Python --- build/Dockerfile | 6 +++--- docs/acme.md | 22 +++++++++++++--------- docs/environment-variable.md | 28 ++++++++++++++-------------- src/functions/__init__.py | 2 +- src/main.py | 4 ++-- 5 files changed, 33 insertions(+), 29 deletions(-) diff --git a/build/Dockerfile b/build/Dockerfile index 0b5101b..9c03c36 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.18 +FROM alpine:3.20 ARG RELEASE_VERSION_ARG @@ -6,7 +6,7 @@ ENV RELEASE_VERSION=$RELEASE_VERSION_ARG ENV TZ="Etc/UTC" RUN apk add --no-cache haproxy bash python3 py3-pip py-yaml certbot openssl \ - && pip3 install --upgrade pip + && pip3 install --upgrade pip --break-system-packages RUN openssl dhparam -out /etc/haproxy/dhparam 2048 \ && openssl dhparam -out /etc/haproxy/dhparam-1024 1024 @@ -17,7 +17,7 @@ COPY build/assets / COPY src/ /scripts/ -RUN pip install -r requirements.txt +RUN pip install -r requirements.txt --break-system-packages RUN pytest -s -vv tests/ diff --git a/docs/acme.md b/docs/acme.md index f695726..2de2e26 100644 --- a/docs/acme.md +++ b/docs/acme.md @@ -8,21 +8,25 @@ Most of the issuers offers Automatic Issuing free of cost. ## Environment Variables -To enable the ACME protocol we need to enable Certbot in EasyHAProxy by setting up to 4 environment variables: +To enable the ACME protocol we need to enable Certbot in EasyHAProxy by setting up to the following environment variables: -| Environment Variable | Required? | Description | -|----------------------------------|-----------|----------------------------------------------------------------------------------------------------------------------------------| -| EASYHAPROXY_CERTBOT_EMAIL | YES | Your email in the certificate authority. | -| EASYHAPROXY_CERTBOT_AUTOCONFIG | - | Will use pre-sets for your Certificate Authority (CA). See table below. | -| EASYHAPROXY_CERTBOT_SERVER | - | The ACME Endpoint of your certificate authority. If you use AUTOCONFIG, it is set automatically. See table below. | -| EASYHAPROXY_CERTBOT_EAB_KID | - | External Account Binding (EAB) Key Identifier (KID) provided by your certificate authority. Some CA require it. See table below. | -| EASYHAPROXY_CERTBOT_EAB_HMAC_KEY | - | External Account Binding (EAB) HMAC Key provided by your certificate authority. Some CA require it. See table below. | -| EASYHAPROXY_CERTBOT_RETRY_COUNT | - | Wait 'n' requests before retrying issue invalid requests. Default 60. | +| Environment Variable | Required? | Description | +|------------------------------------------|-----------|----------------------------------------------------------------------------------------------------------------------------------| +| EASYHAPROXY_CERTBOT_EMAIL | YES | Your email in the certificate authority. | +| EASYHAPROXY_CERTBOT_AUTOCONFIG | - | Will use pre-sets for your Certificate Authority (CA). See table below. | +| EASYHAPROXY_CERTBOT_SERVER | - | The ACME Endpoint of your certificate authority. If you use AUTOCONFIG, it is set automatically. See table below. | +| EASYHAPROXY_CERTBOT_EAB_KID | - | External Account Binding (EAB) Key Identifier (KID) provided by your certificate authority. Some CA require it. See table below. | +| EASYHAPROXY_CERTBOT_EAB_HMAC_KEY | - | External Account Binding (EAB) HMAC Key provided by your certificate authority. Some CA require it. See table below. | +| EASYHAPROXY_CERTBOT_RETRY_COUNT | - | Wait 'n' requests before retrying issue invalid requests. Default 60. | +| EASYHAPROXY_CERTBOT_PREFERRED_CHALLENGES | - | The preferred challenges for Certbot. Available: `http` | +| EASYHAPROXY_CERTBOT_MANUAL_AUTH_HOOK | - | The path to a script that will be executed (default: None) | ## Auto Config Certificate Authority (CA) Here are detailed instructions per Certificate Authority (CA). If anyone is missing, please let's know. +Possible values for: `EASYHAPROXY_CERTBOT_AUTOCONFIG` + | CA | Auto Config | Free? | Account Required? | EAB KID? | EAB HMAC Key? | More Info | |----------------------|------------------|-------|--------------------|----------|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Let's Encrypt | - | Yes | No | No | No | - | diff --git a/docs/environment-variable.md b/docs/environment-variable.md index b00bacf..661438d 100644 --- a/docs/environment-variable.md +++ b/docs/environment-variable.md @@ -1,19 +1,19 @@ # Docker environment variables -| Environment Variable | Description | Default | -|----------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------| -| EASYHAPROXY_DISCOVER | How the services will be discovered to create `haproxy.cfg`: `static`, `docker`, `swarm` or `kubernetes` | **required** | -| EASYHAPROXY_LABEL_PREFIX | (Optional) The key will search for matching resources. | `easyhaproxy` | -| EASYHAPROXY_CERTBOT_* | (Optional) Enable Let's Encrypt or any other ACME certificate. See more: [acme](acme.md) | *empty* | -| EASYHAPROXY_SSL_MODE | (Optional) `strict` supports only the most recent TLS version; `default` good SSL integration with recent browsers; `loose` supports all old SSL protocols for old browsers (not recommended). | `default` | -| EASYHAPROXY_REFRESH_CONF | (Optional) Check for new containers/services every N seconds. | 10 | -| EASYHAPROXY_LOG_LEVEL | (Optional) The log level for EasyHAproxy messages. Available: TRACE,DEBUG,INFO,WARN,ERROR,FATAL | DEBUG | -| CERTBOT_LOG_LEVEL | (Optional) The log level for Certbot messages. Available: TRACE,DEBUG,INFO,WARN,ERROR,FATAL | DEBUG | -| HAPROXY_LOG_LEVEL | (Optional) The log level for HAProxy messages. Available: TRACE,DEBUG,INFO,WARN,ERROR,FATAL | DEBUG | -| HAPROXY_USERNAME | (Optional) The HAProxy username to the statistics. | `admin` | -| HAPROXY_PASSWORD | (Optional) The HAProxy password to the statistics. If not set, statistics will be available with no password | *empty* | -| HAPROXY_STATS_PORT | (Optional) The HAProxy port to the statistics. If set to `false`, disable statistics | `1936` | -| HAPROXY_CUSTOMERRORS | (Optional) If HAProxy will use custom HTML errors. true/false. | `false` | +| Environment Variable | Description | Default | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------| +| EASYHAPROXY_DISCOVER | How the services will be discovered to create `haproxy.cfg`: `static`, `docker`, `swarm` or `kubernetes` | **required** | +| EASYHAPROXY_LABEL_PREFIX | (Optional) The key will search for matching resources. | `easyhaproxy` | +| EASYHAPROXY_CERTBOT_* | (Optional) Enable Let's Encrypt or any other ACME certificate. See more: [acme](acme.md) | *empty* | +| EASYHAPROXY_SSL_MODE | (Optional) `strict` supports only the most recent TLS version; `default` good SSL integration with recent browsers; `loose` supports all old SSL protocols for old browsers (not recommended). | `default` | +| EASYHAPROXY_REFRESH_CONF | (Optional) Check for new containers/services every N seconds. | 10 | +| EASYHAPROXY_LOG_LEVEL | (Optional) The log level for EasyHAproxy messages. Available: TRACE,DEBUG,INFO,WARN,ERROR,FATAL | INFO | +| CERTBOT_LOG_LEVEL | (Optional) The log level for Certbot messages. Available: TRACE,DEBUG,INFO,WARN,ERROR,FATAL | DEBUG | +| HAPROXY_LOG_LEVEL | (Optional) The log level for HAProxy messages. Available: TRACE,DEBUG,INFO,WARN,ERROR,FATAL | DEBUG | +| HAPROXY_USERNAME | (Optional) The HAProxy username to the statistics. | `admin` | +| HAPROXY_PASSWORD | (Optional) The HAProxy password to the statistics. If not set, statistics will be available with no password | *empty* | +| HAPROXY_STATS_PORT | (Optional) The HAProxy port to the statistics. If set to `false`, disable statistics | `1936` | +| HAPROXY_CUSTOMERRORS | (Optional) If HAProxy will use custom HTML errors. true/false. | `false` | ---- diff --git a/src/functions/__init__.py b/src/functions/__init__.py index 68bd260..619173c 100644 --- a/src/functions/__init__.py +++ b/src/functions/__init__.py @@ -361,7 +361,7 @@ class Certbot: ' --standalone' ) - if self.certbot_manual_auth_hook != False: + if self.certbot_manual_auth_hook: certbot_certonly += ' --manual --manual-auth-hook \'{hook}\''.format(hook=self.certbot_manual_auth_hook) ret_reload = False diff --git a/src/main.py b/src/main.py index 24769d8..fb4e96a 100644 --- a/src/main.py +++ b/src/main.py @@ -63,8 +63,8 @@ def main(): Functions.log(Functions.INIT_LOG, Functions.INFO, " _ ") Functions.log(Functions.INIT_LOG, Functions.INFO, " ___ __ _ ____ _ ___| |_ __ _ _ __ _ _ _____ ___ _ ") - Functions.log(Functions.INIT_LOG, Functions.INFO, "/ -_) _` (_-< || |___| ' \/ _` | '_ \ '_/ _ \ \ / || |") - Functions.log(Functions.INIT_LOG, Functions.INFO, "\___\__,_/__/\_, | |_||_\__,_| .__/_| \___/_\_\\_, |") + Functions.log(Functions.INIT_LOG, Functions.INFO, "/ -_) _` (_-< || |___| ' \\/ _` | '_ \\ '_/ _ \\ \\ / || |") + Functions.log(Functions.INIT_LOG, Functions.INFO, "\\___\\__,_/__/\\_, | |_||_\\__,_| .__/_| \\___/_\\_\\_, |") Functions.log(Functions.INIT_LOG, Functions.INFO, " |__/ |_| |__/ ") Functions.log(Functions.INIT_LOG, Functions.INFO, "Release: %s" % (os.getenv("RELEASE_VERSION"))) From 386efcd6b5e077d6e10ec92f47da82fbaaa91f8d Mon Sep 17 00:00:00 2001 From: Joao Gilberto Magalhaes Date: Fri, 15 Nov 2024 10:58:42 -0600 Subject: [PATCH 15/15] Add DigitalOcean marketplace --- README.md | 2 ++ docs/digitalocean.md | 11 +++++++++++ docs/easyhaproxy_digitalocean.png | Bin 0 -> 7922 bytes 3 files changed, 13 insertions(+) create mode 100644 docs/digitalocean.md create mode 100644 docs/easyhaproxy_digitalocean.png diff --git a/README.md b/README.md index fe8a32b..e6f8da4 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,7 @@ EasyHAProxy can detect and configure HAProxy automatically on the following plat EasyHAProxy is part of some projects: - Dokku - MicroK8s +- DigitalOcean Marketplace See detailed instructions on how to install below. @@ -70,6 +71,7 @@ Or you can install using tools: [![Helm](docs/easyhaproxy_helm.png)](docs/helm.md) [![MicroK8s](docs/easyhaproxy_microk8s.png)](docs/microk8s.md) [![Dokku](docs/easyhaproxy_dokku.png)](docs/dokku.md) +[![DigitalOcean](docs/easyhaproxy_digitalocean.png)](docs/digitalocean.md) ## Special Topics diff --git a/docs/digitalocean.md b/docs/digitalocean.md new file mode 100644 index 0000000..ff1edec --- /dev/null +++ b/docs/digitalocean.md @@ -0,0 +1,11 @@ +# DigitalOcean + +DigitalOcean is a cloud infrastructure provider focused on simplifying web infrastructure for software developers. + +EasyHAProxy is available on DigitalOcean Marketplace. +You can install it with a few clicks directly from the DigitalOcean dashboard. + +## Installing EasyHAProxy on DigitalOcean + +Please refer the [EasyHAProxy page on DigitalOcean Marketplace](https://marketplace.digitalocean.com/apps/easyhaproxy-ingress-controller). + diff --git a/docs/easyhaproxy_digitalocean.png b/docs/easyhaproxy_digitalocean.png new file mode 100644 index 0000000000000000000000000000000000000000..421a9d58b323645cd016a92ff3e41db6b806f36f GIT binary patch literal 7922 zcmeHKcTkgC(+?qZDT+wP2uKk^LP#i)P^2SGdQl;y5lJ9GXbKWK7CK6iBGNzc5+VHSefv0i*bWM zAYL<5LtEg@+`Kv2foHo8?h){6J8tjHu*C&K>HfYX3Y7?DgwlynVhDu<0)@Py+34?R zhjRY0a#}~9<&<^@YSJR2cOuv!?UZHkeKwaG{kHYc=C-29G)U*cLw1SGED;CUy?oEQ z70oA-4BEo4#M?nLL{isSzpfYMTSaf*R}+Rl-dNoob!sJZw~Scipdswd>j$qBD4d~1L?ji|+3CV&$EHM-V0~<2~gFmAIV#p0o#hSM3N!)X{D>-SuZ$SU<9)rM| zGp9BC_w6h^a9PMT5OM1ZPYy~}Q6(wLyR|j>-j(PxH>&umqM%DG?>>$ce~{k04u{ny zd>(1oJ^Km!X_)1}oyVxFO6*>Zw9*}Zs_93BSg(CB;f&5Qy7pKZZ zYM;46yK#nN-cBCHSIH-qOb$02s>B}Ni||*z2V9m_gFx%at7BG{|G+-$bxAnBT2tE+pkUEmeFO4VRa4aeb6pmysx>cgthGR4t_ zmKD)(yImrUY~TBH?$j;%eFqhnUmfM8(>c!yE1Vd5KZMP@vv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