go-proxy icon indicating copy to clipboard operation
go-proxy copied to clipboard

Feature Request: “High Availability” with Autocert

Open polds opened this issue 1 year ago • 3 comments

Hi, it’d be nice to be able to scale out GoDoxy to a few nodes to provide a more highly available solution. It should already work (haven’t tested) if you bring your own certs, but it’d be nice to have support with autocert. I imagine to do so, some basic locking, or leader election would need to be implemented (or just add a Redis node to the compose file) so only one instance attempts to register certs at a given time. It would require a clustered file system unless they could share the certs with each other which would need service discovery 😅 though I guess if you have the docker hosts enabled, there’s already some amount of service discovery happening.

Anyways, I over complicated the problem, but it would be nice to be able to run multiple with Autocert.

polds avatar Jan 09 '25 00:01 polds

Could you elaborate more about it? Multiple machines running same services?

yusing avatar Jan 09 '25 09:01 yusing

No, sorry I'm meaning the ability to horizontally scale GoDoxy to multiple instances.

graph TD
    subgraph User Requests
        User1[User] --> GoDoxy1[GoDoxy Instance 1]
        User1[User] --> GoDoxy2[GoDoxy Instance 2]
        User1[User] --> GoDoxyN[GoDoxy Instance n]
    end

    subgraph GoDoxy Instances
        GoDoxy1 --|Handles Traffic|--> Applications
        GoDoxy2 --|Handles Traffic|--> Applications
        GoDoxyN --|Handles Traffic|--> Applications
    end

    subgraph Let's Encrypt Renewal
        GoDoxy1 --> Election[Leader Election]
        GoDoxy2 --> Election
        GoDoxyN --> Election
        Election -->|Leader| Leader[Leader GoDoxy]
        Leader -->|Renew Certs| ACME[Let's Encrypt]
        ACME --> Leader
        Leader -->|Distributes Certs| GoDoxy1
        Leader --> GoDoxy2
        Leader --> GoDoxyN
    end

But with Let's Encrypt all the instances attempt to renew the certificate which causes issues.

polds avatar Jan 10 '25 05:01 polds