Sign inSign up

saarphil/domain-mgmt

By saarphil

•Updated about 19 hours ago

a simple tool to manage domain names

Image
Web servers
Content management system
Databases & storage
0

10K+

saarphil/domain-mgmt repository overview

A simple tool to maintain domain names in order to allow On Demand TLS⁠ for Caddy2⁠.

⁠Tags

⁠Current

(daily built)

  • latest
  • latest-fedora44, latest-fedora
  • latest-ubuntu24, latest-ubuntu26, latest-ubuntu
⁠Older versions

While it is strongly recommended to update, older versions wont be removed from the registry - for now.
If you prefer to stick with older versions, you might want to mirror them to your own registry.

⁠Setup

Here's a full but very condensed example:

MARIADB_ROOT_PASSWORD=$(docker run -q --rm alpine/openssl rand -hex 20)
MARIADB_PASS=$(docker run -q --rm alpine/openssl rand -hex 20)

docker network create domain-mgmt

docker run -d --name mariadb --network domain-mgmt \
   -v mariadb_data:/var/lib/mysql:Z \
   -e MARIADB_ROOT_PASSWORD=${MARIADB_ROOT_PASSWORD} \
   -e MARIADB_USER=domain-mgmt \
   -e MARIADB_PASSWORD=${MARIADB_PASS} \
   -e MARIADB_DATABASE=domain_mgmt \
   mariadb:latest

docker run -d --name domain-mgmt --network domain-mgmt -p 127.0.0.1:8080:8080 \
  -e "DATABASE_URL=mysql://domain-mgmt:${MARIADB_PASS}@mariadb:3306/domain_mgmt" \
  saarphil/domain-mgmt:latest

⁠Usage

  1. Configure Caddy

    {
       on_demand_tls {
          ask http://127.0.0.1:8080/api/query
       }
    }
    
    (ondemandtls) {
       tls {
          on_demand
       }
    }
    
    mgmt.domain:443 {
       # protect this endpoint
       reverse_proxy http://127.0.0.1:8080
    }
    
    *.customers.domain:443 {
       import ondemandtls
       ...
    }
    
  2. Manage your domains

    • Add Domain
      curl -X PUT "http://localhost:8080/api/domains" -H 'Content-Type: application/json' -d '{"name": "example.tld"}'
      
    • Read Domain
      curl -X GET "http://localhost:8080/api/domain/1" -H 'Content-Type: application/json'
      
    • Update Domain
      curl -X POST "http://localhost:8080/api/domain/1" -H 'Content-Type: application/json' -d '{"name": "sub.example.tld"}'
      
    • Delete Domain
      curl -X DELETE "http://localhost:8080/api/domain/1" -H 'Content-Type: application/json'
      
    • Read Domains paged
      curl -X GET "http://localhost:8080/api/domains?offset=0&limit=10" -H 'Content-Type: application/json'
      

    Be aware it's crucial to not end with trailing slashes (/) otherwise the server responds with a 404.

⁠Contact

  • support [at] codereaders.eu

Tag summary

Content type

Image

Digest

sha256:906406385…

Size

70.1 MB

Last updated

about 19 hours ago

docker pull saarphil/domain-mgmt