Skip to content

Commit

Permalink
Deploying to gh-pages from @ 366cc83 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] committed Oct 6, 2023
0 parents commit f4a18ea
Show file tree
Hide file tree
Showing 11 changed files with 334 additions and 0 deletions.
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ldddns.arnested.dk
36 changes: 36 additions & 0 deletions InRelease
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Date: Fri, 06 Oct 2023 17:37:20 +0000
Label: ldddns.arnested.dk
Origin: Arne Jørgensen
MD5Sum:
515b65949ac773a8e031ad253278654f 1374 Packages
77560e3638da8cc67ddade05761e5818 599 Packages.gz
011a682bc040dbeca67dca2bc66f43f1 88 Release
SHA1:
3dc97a0858d365e0a219fde60bfdc5b80c5f29cc 1374 Packages
c57c73523f744435dc0fe417ecb9750aa1dd2d47 599 Packages.gz
c381361dcc59f7ef724d3f212a809d36f8fbe5f9 88 Release
SHA256:
f51e954f1eed7c4e74bebeece1dbfff1122bc10ebcada37eb29dce6d3efb2019 1374 Packages
992dd7b20e42e26d3673cc7686fbe2888667a15c3ac1cccb58747d0baedadbbf 599 Packages.gz
d1a1a33a029881a393b213301a634b63d796388c94482da4f0a2308a31a015a0 88 Release
SHA512:
9c9a881733d320b576e061bee3e15b5f376e658b4adc0391a6930d7f95c74dd6e82fa418e05e910825973c7eda695e5040e1991486591f0a57bd1e0f513ee597 1374 Packages
987136fc403b4b93bccdc1eadb7a00b60bece0f290bbc64a99e54f692db9fa86b623676b44301600ad4f27b9b4a6a077640f4b6187dea936bfd2d92d73a6237d 599 Packages.gz
2dc1382bc30cd690b9cd72091ecdf9459f7d9d678889c784761cad83a00828ed156737933bc7a61a5405a77d6a8045b627e8b28fde9cb4ce42c851a92dd8099f 88 Release
-----BEGIN PGP SIGNATURE-----

iQGzBAEBCgAdFiEEOaW5aMP09wCi81cVnwaxeMQIvd4FAmUgRdAACgkQnwaxeMQI
vd6T9gwAutyY9tFN3MXdnyYlRpVdZx0pYlxyB0/fwkYANVPy7fuYehINoKMGfyBe
Ly7NmmRWxWyNZvPKwRIY1leJwdu80e9h8sW8sCmSuHHTptOvRh/AVIXzqDJoPiZf
LlyWcj/snDpAA/UemJm/+DnAznvFoBIG8ZUt5PD7Q5ES3Gkh3AfOs96QEB2JRXch
vA8nYsjpHwix8wQih7l827UCHC6DwAGxBJR2+nS5TQP2xcC7Ug+azLKGsSogXeTD
A+3GKXmf/vwZwsq/oewZFMQLKJLyDpJcqSjVxpsII0Iis+GNzjyVLBxfmL7vOz1J
nwiGZL/iudKJegP10uJxeL3I5Te/A0bbrEwSc5McRvcedYkmHzYKdaKofTJ3EDz3
NFR9nVUHsCPkpPovhxwKj96Py5qXKt0QasnbNfafp7YWtn7x6F8FKonWFqAehZ7f
zzsR6zuA95kapOQMnmXV+MQvWR649gKVu7ejK3sMl3gZCgHoiCtEFoYO55GUd9Xi
T+ZjLpYM
=4y83
-----END PGP SIGNATURE-----
42 changes: 42 additions & 0 deletions Packages
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Package: ldddns
Version: 1.0.150
Architecture: amd64
Maintainer: Arne Jørgensen <[email protected]>
Installed-Size: 7592
Depends: avahi-daemon, docker.io | docker-ce, libsystemd0
Filename: ./ldddns_1.0.150_linux_amd64.deb
Size: 3237932
MD5sum: 1acfded17462be087c2fe7ffa2d5f659
SHA1: 4b9d96d9609c5ee1819eb3d4e2ee40a0c21aeec7
SHA256: e87a238b6d2600ff77c7d20eb5cd9e5bc4ad40d84c5f4aed815f8d4952be5799
Priority: optional
Description: Local Docker Development DNS

Package: ldddns
Version: 1.0.150
Architecture: i386
Maintainer: Arne Jørgensen <[email protected]>
Installed-Size: 7388
Depends: avahi-daemon, docker.io | docker-ce, libsystemd0
Filename: ./ldddns_1.0.150_linux_386.deb
Size: 3080606
MD5sum: dac45310a111164ad8c437b665fc1b5b
SHA1: 77b40610ec9c0fa49ec116c418e1ceb2dfc09c7a
SHA256: ce9c9a52c72f1394d7c93dee5598730ed2edf888ebe28a13fe00677fce43fa90
Priority: optional
Description: Local Docker Development DNS

Package: ldddns
Version: 1.0.150
Architecture: arm64
Maintainer: Arne Jørgensen <[email protected]>
Installed-Size: 7304
Depends: avahi-daemon, docker.io | docker-ce, libsystemd0
Filename: ./ldddns_1.0.150_linux_arm64.deb
Size: 2980568
MD5sum: fc90c0f60640b3049e8aa4f3d03a0428
SHA1: 14b71dec694cee378a8a7550fe37dfc72041c512
SHA256: d126eb124bbd299e28ffd9df2e4c9642e0a7df8194d6a357d72a7e3e2ef94691
Priority: optional
Description: Local Docker Development DNS

Binary file added Packages.gz
Binary file not shown.
19 changes: 19 additions & 0 deletions Release
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Date: Fri, 06 Oct 2023 17:37:20 +0000
Label: ldddns.arnested.dk
Origin: Arne Jørgensen
MD5Sum:
515b65949ac773a8e031ad253278654f 1374 Packages
77560e3638da8cc67ddade05761e5818 599 Packages.gz
011a682bc040dbeca67dca2bc66f43f1 88 Release
SHA1:
3dc97a0858d365e0a219fde60bfdc5b80c5f29cc 1374 Packages
c57c73523f744435dc0fe417ecb9750aa1dd2d47 599 Packages.gz
c381361dcc59f7ef724d3f212a809d36f8fbe5f9 88 Release
SHA256:
f51e954f1eed7c4e74bebeece1dbfff1122bc10ebcada37eb29dce6d3efb2019 1374 Packages
992dd7b20e42e26d3673cc7686fbe2888667a15c3ac1cccb58747d0baedadbbf 599 Packages.gz
d1a1a33a029881a393b213301a634b63d796388c94482da4f0a2308a31a015a0 88 Release
SHA512:
9c9a881733d320b576e061bee3e15b5f376e658b4adc0391a6930d7f95c74dd6e82fa418e05e910825973c7eda695e5040e1991486591f0a57bd1e0f513ee597 1374 Packages
987136fc403b4b93bccdc1eadb7a00b60bece0f290bbc64a99e54f692db9fa86b623676b44301600ad4f27b9b4a6a077640f4b6187dea936bfd2d92d73a6237d 599 Packages.gz
2dc1382bc30cd690b9cd72091ecdf9459f7d9d678889c784761cad83a00828ed156737933bc7a61a5405a77d6a8045b627e8b28fde9cb4ce42c851a92dd8099f 88 Release
14 changes: 14 additions & 0 deletions Release.gpg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
-----BEGIN PGP SIGNATURE-----

iQGzBAABCgAdFiEEOaW5aMP09wCi81cVnwaxeMQIvd4FAmUgRdAACgkQnwaxeMQI
vd5+jgv5ATmWxNmkx9c8ztIo7ZUpU55KAEnOp1hJsuImvzyg7BzCq46qqiWWeR4F
Ruoym/Ib9MKpyKMJNm/qBiPUxyHUanG/Km83fOSMmWq4RFyJegvGwKGffu0lGUi5
IZMO2Zi2cxkT9tA30jS9/zoKMn4sgNlbeBZ9wi4koVfzOyLvcgEr32gwBTKM3wjP
0tK5ONQZacVX+l+Tg0jBFD2HB7Q0j06Mag8tZYVs5qszg33LoKLwEmuEXOzgteak
pFyrnFOd5frUspZiKGSW5Z1msyaxs/0x8o9EblFz/DfllsmMkI6JMHGmxQa/YQrG
3084S0yKoHogngUd17S4Y0gWGOpusUGaDTAQYUCKciG1lIahGcyJ5qmUch7Sbu/O
2hnBHjg98m3SHGoCo7X+35vpALsEqax8aB205Ap84cmloRjOpYq2VPzkbRTWsXAt
V6O1VtcTXe+EChHOn1x4OLA0bUMl2DFtftlzy9nyHxfAYRR78oEHIY5EqilBzGQF
dl1uRK+L
=b8oB
-----END PGP SIGNATURE-----
172 changes: 172 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Local Docker Development DNS</title>
<meta name="go-import" content="ldddns.arnested.dk git https://github.com/arnested/ldddns.git"/>
<meta name="description" content="A systemd service that will monitor your Docker host and provide DNS names for containers based of the container name." />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
html {
background-color: white;
color: black;
font-family: system-ui, -apple-system;
font-size: 16px;
line-height: 1.6;
}

body {
padding: 0 2em;
max-width: 62em;
margin: 10ex auto;
}

code {
background-color: whitesmoke;
color: darkslategrey;
padding: 0.5ex 0.5em;
border-radius: 0.75em;
overflow-x: auto;
}

code.language-ini,
code.language-console {
padding: 2ex 1em;
margin: 2ex 0;
display: block;
}

code.language-console::before {
content: "$ ";
color: black;
font-weight: bold;
}

@media (prefers-color-scheme: dark) {
html {
background-color: black;
color: white;
}

code {
background-color: darkslategrey;
color: whitesmoke;
}

code.language-console::before {
color: white;
}

a:active, a:link, a:hover, a:visited {
color: white;
font-weight: bold;
}
}
</style>
</head>
<body>
<main>
<h1 id="local-docker-development-dns" tabindex="-1"><a class="anchor" href="#local-docker-development-dns" aria-hidden="true"><span class="octicon octicon-link"></span></a> Local Docker Development DNS</h1>
<p>A systemd service that will monitor your Docker host and provide
DNS names for the containers.</p>
<p>The service broadcasts the domain names using multicast DNS
(a.k.a. mDNS, zeroconf, Bonjour, Avahi).</p>
<p>A limitation of this is that domains name can only be on the <code>.local</code>
TLD and only have one level below the TLD. A benefit is that you don't
have to change your DNS server or configure stuff in <code>/etc/resolv</code> or
similar.</p>
<p>If the containers also have exposed ports (and the ports can be looked
up in <code>/etc/services</code>) the service will also broadcast the
service/domain for service discovery. I.e., <code>_https._tcp.</code> for
https://my-example.local (a.k.a. DNS-SD). Only <em>one</em> domain name can
be broadcast per service per container.</p>
<p>Per default domain names will be generated from the <code>VIRTUAL_HOST</code>
environment variable is present (several hostnames can be separated by
space or comma) and from the container name.</p>
<p>If the hostnames do not fulfill the rule of being on the <code>.local</code> TLD
and have only one level below the service will rewrite it.
I.e. <code>my.example.com</code> will be rewritten to <code>my-example.local</code>.</p>
<h2 id="configuration" tabindex="-1"><a class="anchor" href="#configuration" aria-hidden="true"><span class="octicon octicon-link"></span></a> Configuration</h2>
<p>You can configure where the service should look for hostnames:</p>
<ul>
<li>Environment variables (configured with <code>env:&lt;VAR_NAME&gt;</code>) - several
hostnames can be separated by spaces or commas.</li>
<li>Container name (configured with <code>containerName</code>) - the container
name will never be a valid hostname to begin with, but as mentioned
the <code>ldddns</code> will rewrite it into one.</li>
<li>Labels (configured with <code>label:&lt;label.name&gt;</code>) - several hostnames
can be separated by spaces or commas.</li>
</ul>
<p>You configure it be setting the environment variable
<code>LDDDNS_HOSTNAME_LOOKUP</code> in a systemd unit override file.</p>
<p>For example, you could create a file named
<code>/etc/systemd/system/ldddns.service.d/override.conf</code> with the content:</p>
<pre><code class="language-ini"><span class="hljs-section">[Service]</span>
<span class="hljs-attr">Environment</span>=LDDDNS_HOSTNAME_LOOKUP=env:VIRTUAL_HOST,label:org.example.my.hostname,env:OTHER_VAR,containerName
</code></pre>
<p>This will create a hostname for all hostnames in the <code>VIRTUAL_HOST</code>
environment variable, the <code>org.example.my.hostname</code> label, the
<code>OTHER_VAR</code> environment variable, and the container name.</p>
<p>The first hostname found will be broadcast as a DNS-SD service.</p>
<p>Containers started with <code>docker-compose run</code> are ignored by
default. You can included them by setting the environment variable
<code>LDDDNS_IGNORE_DOCKER_COMPOSE_ONEOFF</code> to <code>false</code>.</p>
<p>The default configuration is the equivalent of setting:</p>
<pre><code class="language-ini"><span class="hljs-section">[Service]</span>
<span class="hljs-attr">Environment</span>=LDDDNS_HOSTNAME_LOOKUP=env:VIRTUAL_HOST,containerName
<span class="hljs-attr">Environment</span>=LDDDNS_IGNORE_DOCKER_COMPOSE_ONE<span class="hljs-literal">OFF</span>=<span class="hljs-literal">true</span>
</code></pre>
<h2 id="install" tabindex="-1"><a class="anchor" href="#install" aria-hidden="true"><span class="octicon octicon-link"></span></a> Install</h2>
<p>For Pop!_OS, Ubuntu, Debian and the like, download the <code>.deb</code> package
file from the <a href="https://github.com/arnested/ldddns/releases/latest">latest
release</a> and open
it or run:</p>
<pre><code class="language-console">sudo dpkg -i <a href="https://github.com/arnested/ldddns/releases/latest/download/ldddns_1.0.150_linux_amd64.deb">ldddns_1.0.150_linux_amd64.deb</a>
</code></pre>
<p>Or just run the following command which will download and install the
latest package for you:</p>
<pre><code class="language-console">curl -fsSL https://ldddns.arnested.dk/install.sh | bash
</code></pre>
<p>For other distributions download the binary from the <a href="https://github.com/arnested/ldddns/releases/latest">latest
release</a> and
create a systemd service unit file yourself based on
<a href="https://github.com/arnested/ldddns/blob/main/systemd/ldddns.service"><code>ldddns.service</code></a>.</p>
<h3 id="updates" tabindex="-1"><a class="anchor" href="#updates" aria-hidden="true"><span class="octicon octicon-link"></span></a> Updates</h3>
<p>When you install the package it will add an APT source list so, you
will receive future updates to <code>ldddns</code> along with your other system
updates.</p>
<h2 id="keeping-an-eye-on-things" tabindex="-1"><a class="anchor" href="#keeping-an-eye-on-things" aria-hidden="true"><span class="octicon octicon-link"></span></a> Keeping an eye on things</h2>
<p>You can get the status of the service by running:</p>
<pre><code class="language-console">sudo systemctl status ldddns.service
● ldddns.service - Local Docker Development DNS
Loaded: loaded (/lib/systemd/system/ldddns.service; enabled; vendor preset: enabled)
Active: active (running) since Mon 2022-01-03 09:13:14 CET; 5 days ago
Docs: https://ldddns.arnested.dk
Main PID: 5414 (ldddns)
Status: "v1.0.13; {"HostnameLookup":["env:VIRTUAL_HOST","containerName"],"IgnoreDockerComposeOneoff":true}"
Tasks: 14 (limit: 47870)
Memory: 13.7M
CPU: 6.243s
CGroup: /system.slice/ldddns.service
└─5414 /usr/libexec/ldddns start

jan 07 12:46:11 pop-os systemd[1]: Starting Local Docker Development DNS...
jan 07 12:46:11 pop-os ldddns[5414]: Starting ldddns v1.0.13...
jan 07 12:46:11 pop-os systemd[1]: Started Local Docker Development DNS.
jan 07 12:46:11 pop-os ldddns[5414]: Rewrote hostname from "my.example.com" to "my-example.local"
jan 07 12:46:11 pop-os ldddns[5414]: added address for "my-example.local" pointing to "172.18.0.2"
jan 07 12:46:11 pop-os ldddns[5414]: added service "_https._tcp" pointing to "my-example.local"
</code></pre>
<p>Or follow the log with:</p>
<pre><code class="language-console">sudo journalctl --follow --unit ldddns.service
</code></pre>
<h2 id="bugs-thoughts-and-comments" tabindex="-1"><a class="anchor" href="#bugs-thoughts-and-comments" aria-hidden="true"><span class="octicon octicon-link"></span></a> Bugs, thoughts, and comments</h2>
<p>Bugs, thoughts, and comments are welcome.</p>
<p>Feel free to get in touch at <a href="https://github.com/arnested/ldddns/issues">GitHub
Issues</a> and <a href="https://github.com/arnested/ldddns/discussions">GitHub
Discussions</a>.</p>

</main>
<hr>
Copyright &copy; 2020, 2021, 2022, 2023 <a href="https://arnested.dk">Arne Jørgensen</a> &mdash; <a href="https://github.com/arnested/ldddns/blob/main/LICENSE">MIT License</a> &mdash; <a href="https://github.com/arnested/ldddns">GitHub</a>
</body>
</html>
50 changes: 50 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env bash

# shellcheck disable=SC2292
if [ -z "${BASH}" ]; then
echo >&2 Please run the install with bash.
exit 1
fi

aptdcon="$(command -v aptdcon || true)"
dpkg="$(command -v dpkg || true)"
pkexec="$(command -v pkexec || true)"

if [[ ! -x "${aptdcon}" && ! -x "${dpkg}" ]]; then
echo >&2 Install only runs on Debian based distributions.
exit 2
fi

set -euo pipefail

ldddns_install() {
tmpdir="$(mktemp --directory)"

# Make a cleanup function
cleanup() {
rm --recursive --force -- "${tmpdir}"
}
trap cleanup EXIT

echo -n "Finding latest package name..."

uname="$(uname -s)"
arch="$(dpkg --print-architecture)"

package=$(curl --proto =https --fail --location --silent --show-error "https://github.com/arnested/ldddns/releases/latest/download/checksums.txt" | grep --ignore-case "${uname}" | grep "${arch}" | grep \.deb | awk '{print $2}')
echo " ${package}"

echo "Downloading ${package}..."
curl --proto =https --fail --location --progress-bar --output "${tmpdir}/${package}" "https://github.com/arnested/ldddns/releases/latest/download/${package}"

echo "Installing ${package}..."
if [[ -x "${aptdcon}" ]]; then
yes | aptdcon --hide-terminal --install "${tmpdir}/${package}" > /dev/null
elif [[ -x "${pkexec}" ]]; then
pkexec dpkg --install "${tmpdir}/${package}"
else
sudo dpkg --install "${tmpdir}/${package}"
fi
}

ldddns_install
Binary file added ldddns_1.0.150_linux_386.deb
Binary file not shown.
Binary file added ldddns_1.0.150_linux_amd64.deb
Binary file not shown.
Binary file added ldddns_1.0.150_linux_arm64.deb
Binary file not shown.

0 comments on commit f4a18ea

Please sign in to comment.