Repository navigation
Releases
v2.24.3
Internal polling loop
The polling loop no longer depends on carlescere/scheduler (#554). A small internal package, internal/repeat, now calls the check right away and then at every interval from a single goroutine, so calls never overlap. When a check runs past one or more intervals, those intervals are skipped, as before.
The shutdown stops the loop and waits for a check in progress to finish, the same as in v2.24.2. Log messages and the sequence diagrams in the READMEs now say "polling loop" instead of "scheduler".
End-to-end tests
The end-to-end tests now use the file action of Probe v1.39.0 to read logs and to read and write local files (#553). Log checks no longer depend on the stdout of a shell step, which intermittently came back empty.
v2.24.2
Shutdown no longer races with the polling loop
A SIGTERM, SIGINT or SIGQUIT that arrived while a check or deployment was running could leave the server in a bad state (#552). The problem was introduced in v2.23.0, when the shutdown began to wait for the drain time.
- Restart during the drain. A check that was running when the shutdown began found no server and started one again from the cache. The start failed because the stopping server still held the port, and the version was written to the blocked list.
- Orphaned application. A signal received while dewy was starting the application made dewy exit at once, and the application kept running without dewy.
The shutdown now stops the polling first and waits for a running check or deployment to finish. Then it stops the server, including one that was just started. A shutdown that begins during a download waits for the download to finish.
The Worker stopped log line is now written before the shutdown returns, so it is no longer lost when dewy exits.
End-to-end tests
The end-to-end tests now send SIGTERM to dewy while it starts an application that takes 15 seconds to stop (#552). They check that dewy waits for the application to stop, that the application exits normally, that it is started only once, and that the version is not blocked.
v2.24.1
Socket path length is checked at startup
A --socket address longer than the operating system allows now fails the start with an error that names the limit (#551). Before, such a path passed the option checks and failed when dewy bound it, as bind: invalid argument on the first deployment, followed by a rollback attempt.
Error: invalid socket: "/var/lib/..." is 125 bytes; a Unix domain socket address on darwin is limited to 103 bytes
- Paths. The limit applies to the absolute path, after a relative path is resolved against the working directory: 107 bytes on Linux and 103 bytes on macOS.
- Abstract names. On Linux, an abstract name (
@name) can be at most 108 bytes including@.
End-to-end tests
The end-to-end tests now include a server that listens only on --socket and reads its environment from --envdir (#550). They check that the application answers over the socket, that the health check probes the socket, that the application gets the values from the envdir, that SIGUSR1 reloads a changed value, and that the socket file is removed on shutdown.
v2.24.0
Unix domain sockets for the server command
--socket listens on a Unix domain socket, alone or next to --port (#547). An application behind a reverse proxy on the same host can be served without opening a TCP port.
dewy server --registry ghr://owner/repo --socket /run/app/app.sock --health-path /health -- /opt/app/current/app- Across restarts. Dewy keeps the socket open across restarts, as it does for ports. A connection that arrives during a restart waits in the socket's accept queue.
DEWY_PORT. Each socket is listed by its path after the port entries (8080=3;/run/app.sock=4), in the format server-starter uses.- Socket files. If a socket file is already at the path and refuses connections, it was left by a process that exited without removing it, and dewy replaces it. A socket that accepts connections, or any other file at the path, fails the start. Dewy removes the file on shutdown, unless another file has replaced it.
- Abstract namespace. On Linux,
--socket @namelistens in the abstract namespace and creates no file. - Health checks. Without a TCP port,
--health-pathprobes the first--socket, so a server that listens only on Unix domain sockets needs no--port. - Permissions. The socket file gets its permissions from dewy's umask. A client that runs as another user, such as a reverse proxy, needs write permission on the file.
Environment variables from --envdir
--envdir gives the application environment variables from a directory in the daemontools envdir format (#548). Dewy reads the directory again each time it starts a process: on the first start, a deployment, a rollback, SIGUSR1, and the restart of a crashed process. To change a value without a deployment, edit the file and send SIGUSR1.
echo 'postgres://db.internal/app' > /etc/app/env/DATABASE_URL
dewy server --registry ghr://owner/repo --port 8000 --envdir /etc/app/env -- /opt/app/current/app
echo debug > /etc/app/env/LOG_LEVEL
kill -USR1 $(pidof dewy)- Format. Each regular file sets the variable of its name to the first line of the file, with trailing spaces and tabs removed. An empty file removes the variable. Dotfiles and directories are skipped. Symbolic links are followed, so a mounted Kubernetes Secret or ConfigMap works as the directory.
- Precedence. The envdir overrides dewy's own environment, but not
DEWY_PORT,SERVER_STARTER_PORTorDEWY_HEALTH_PORT. - Errors. A directory that cannot be read fails the start. On a restart, the restart fails and the previous process keeps serving.
The sock module
sock.Listen("unix", path) returns the inherited Unix domain socket for a --socket path and creates the socket itself outside dewy. sock.Listeners now returns Unix domain sockets as well as TCP sockets. The module is released as sock/v0.2.0.
Documentation
- Added the application integration page for the server command, redrew the supervisor and proxy diagrams, and added server command troubleshooting and deployment records to the FAQ (#543).
- Corrected the architecture diagram against the code (#545).
- Described how to install the development build from main with
go install(#542).
v2.23.0
The server command runs on dewy's own supervisor
The server command no longer uses linyows/server-starter. Dewy now binds the ports itself, keeps them open across restarts, and passes them to the application as file descriptors 3, 4, ... (#532, #533).
DEWY_PORT. The application finds its sockets inDEWY_PORT(8080=3;8443=4).SERVER_STARTER_PORTcarries the same value, so applications written for server-starter keep working.- IPv6.
--hostaccepts any IPv4 or IPv6 unicast literal. Without--hostthe ports listen dual stack, so they also accept IPv6 connections.0.0.0.0listens on IPv4 only and::on IPv6 only. - Failed restarts. A new process that exits within its startup window fails the restart, and the previous process keeps serving the previous release. The rollback restores the
currentsymlink and cache key without restarting the server. - Crash recovery. A serving process that exits on its own is started again after a backoff that doubles from 1s up to 30s.
- Shutdown. On SIGINT, SIGTERM or SIGQUIT, dewy stops the application, kills it after
--drain-timeif it is still running, and closes the sockets. - Signals.
SIGUSR1restarts the application. SIGHUP is still ignored.
New options for the server command
- UDP ports (#535).
--porttakes Docker's/udpsuffix:--port 53,53/udp,--port 6000-6002/udp. UDP sockets appear inDEWY_PORTwith the suffix (53=3;53/udp=4).--health-pathprobes the lowest TCP port and requires at least one TCP port. --startup-wait(#536) sets how long a new process must stay up before it replaces the previous one. The default is 1 second.--drain-time(#537) now applies to the server command. A previous process that has not exited this long after SIGTERM is killed with SIGKILL. The default is 30 seconds. The assets command rejects the option instead of ignoring it.--health-before-switch(#538) health checks a new process before it receives traffic. Each new process gets its own loopback TCP socket, announced inDEWY_HEALTH_PORT(127.0.0.1:41234=5). Dewy probes--health-pathon that socket after the startup wait. On failure the new process is killed and the previous one never stops serving. The application has to serve its health endpoint on that socket, so the option is opt-in and requires--health-path.
dewy server --registry ghr://owner/repo --port 8000 \
--health-path /healthz --health-before-switch -- /opt/app/current/appThe sock module
github.com/linyows/dewy/sock is a separate module that applications use to get the sockets dewy opened for them (#534). It depends only on the standard library.
ln, err := sock.Listen("tcp", ":8000")sock.Listen and sock.ListenPacket return the inherited socket whose port matches, and fall back to net.Listen and net.ListenPacket outside dewy, so the same code runs on a developer machine. sock.Listeners, sock.PacketConns and sock.HealthListener return the sockets in DEWY_PORT and DEWY_HEALTH_PORT. The module is released as sock/v0.1.0.
Telemetry
dewy.server.crashes.totalcounts each time the serving process exits without being told to stop (#539). A new process rejected during a restart and exits during dewy's shutdown are not counted.
Documentation
v2.22.0
Bind the server command to a specific address
The server command listened on every IPv4 interface, with no way to narrow it. --host now sets the IPv4 address it listens on, and the address applies to every --port (#528).
dewy server --registry ghr://owner/repo --host 127.0.0.1 --port 8000 -- /opt/app/current/app--hostrequires--port. Only an IPv4 unicast address is accepted: a hostname such aslocalhost, an IPv6 address, and a multicast or broadcast address are rejected at startup. The assets and container commands reject the option.0.0.0.0behaves the same as omitting the option, which is the default and listens on all IPv4 interfaces.- The
--health-pathcheck is sent to the given address, since a server bound to a specific interface does not accept connections on127.0.0.1. With0.0.0.0or no--host, it is still sent to127.0.0.1. The check no longer goes throughHTTP_PROXYorHTTPS_PROXY, so a proxy set for reaching a registry cannot answer it in place of the application. - With an address other than
0.0.0.0, theSERVER_STARTER_PORTenvironment variable passed to the application lists each socket ashost:port=fdinstead ofport=fd. An application that parses the variable itself must accept this form.
Nothing changes when --host is not set.
Documentation
- The multi-port and signal handling samples serve on the sockets passed by server-starter (#529). The Go samples bound their ports with
ListenAndServe, and the multi-port sample read the file descriptor inSERVER_STARTER_PORTas the port number. Under the server command, server-starter already holds the ports, so the samples left the configured ports unanswered, and binding the correct port fails with "address already in use" on Linux. The samples now turn each descriptor into anet.Listenerwithos.NewFileandnet.FileListenerand serve on it, which also keeps the ports open across a graceful restart.
Internal
v2.21.1
Fixes
- Deploy notifications are sent on the tick that recovers from errors (#524). While any error was counted, the notifier also held back download, hook result, deploy success and rollback notifications, not only error notifications. The count is reset only after a successful poll finishes, so when the registry recovered and a new release was deployed, every notification from that deployment was dropped. The following polls skip the same version, so after error notifications reached their limit of 3, nothing was notified at all. A single failed registry fetch was enough to drop the notifications of the next deployment, and with
quiet=true, where only important notifications are sent, none arrived. This has been the case since v0.14.0. Now only error notifications are limited: the limit of 3 and its reset when a poll succeeds are unchanged.
Documentation
- The notifier page and the README state that only error notifications are limited (#524).
v2.21.0
Roll back a server deployment that fails its health check
In server mode a deployment used to finish as soon as the managed process was restarted, without checking that the new release served traffic. When it did not, the host served nothing until someone repointed the current symlink by hand, and the next poll deployed the same version again.
--health-path now applies to the server command as well as the container command (#490). After the process starts or restarts, Dewy probes http://127.0.0.1:<port><health-path> every two seconds until a 2xx or 3xx comes back or --health-timeout (30s by default) runs out. The port is the lowest of the configured --port values.
dewy server --registry ghr://owner/repo -p 8000 --health-path /health -- /opt/app/current/appWhen the probe does not succeed, or the process does not start, Dewy points current back at the previous release, restarts the server on it, and sends a notification naming the failure and the restored version. The failed version is recorded as blocked, so it is deployed once rather than on every poll. Publishing a newer version, or running without --health-path, lets deployments proceed again.
--no-rollbackkeeps the failed release in place. The version is still recorded and the failure still notified.--health-pathwithout--portis rejected at startup, as is--health-pathwith the assets command and--no-rollbackoutside the server command.- A new counter,
dewy.deployments.rollbacks.total, counts rollbacks, and a restart caused by one is recorded asdewy.server.restarts.total{reason="rollback"}. - Deploy hooks are not run on a rollback. The deployment hooks page describes the order of steps and what that means for the after-deploy hook (#494).
Nothing changes when --health-path is not set, which is the default.
Verify downloaded artifacts against published checksums
Dewy extracted what it downloaded without checking it. GitHub Releases, S3 and GCS registries now report the SHA-256 checksum file published next to the selected artifact, and Dewy checks the download against it before writing it to the cache (#491). An artifact that does not match is neither extracted nor shared with other instances on the same cache backend.
Two layouts are recognized: a file named after the artifact (app_linux_amd64.tar.gz.sha256, .sha256sum, .sha256.txt, .sha256sums), and an aggregate file in sha256sum format (checksums.txt, SHA256SUMS, and project-prefixed names such as the myapp_1.2.3_checksums.txt GoReleaser generates by default).
--verify-checksum takes auto (default), required or off:
autoverifies whenever a checksum file is published and deploys without verification when none is, so existing setups keep working, and a release that already publishes checksums is verified with no configuration.requiredalso fails the deployment when no checksum file is published. The gRPC registry does not report one.offnever fetches a checksum file.
Container images are not affected: the runtime verifies an image by its digest on pull.
Fixes
--slotpicks the latest version within the slot (#521). The registries picked the latest version without looking at the slot, and Dewy checked the slot only on that version. Build metadata is ignored when versions are compared, sov1.2.3+blueandv1.2.3+greentied, and the one listed first won: on S3 and GCS a--slot greeninstance never deployed. A slot whose version sorted below another slot's also waited until it became the overall latest. This affected the server and assets commands alike. While no version carries the slot yet, Dewy now waits without reporting an error. Withregistry-ttl, the shared registry-result cache keeps a separate entry per slot.- A failing before-deploy hook aborts the deployment (#495). Dewy logged the failure and deployed anyway, while the documentation said the deployment is aborted. Now nothing is extracted and no container is replaced, the
currentsymlink stays on the running release, and the version is retried on the next poll under the polling backoff. - The app name no longer carries the registry URL's query (#499). A
ghr://ors3://registry URL with query parameters gave an app name such asmyrepo?pre-release=true, and ags://URL gave none, falling back toapp. Both now give the last path segment. - OCI registry credentials are resolved in one order (#500). Listing tags and pulling the image read the same environment variables in opposite orders, so an environment with both
DOCKER_USERNAMEandGITHUB_TOKENlisted as one identity and pulled as another. Both now use:DOCKER_USERNAME/DOCKER_PASSWORD, thenGITHUB_TOKENfor ghcr.io,AWS_ECR_PASSWORDfor ECR, andGCR_TOKENfor Artifact Registry. Listing tags on ECR and Artifact Registry is now authenticated as well.
Upgrade notes
These fixes change behavior that a deployment may depend on:
- A before-deploy hook that exits non-zero now stops the deployment (#495).
- A container deployment that omits
--nameand uses aghr://ors3://registry URL with query parameters gets a differentdewy.applabel, and no longer recognizes the containers it started before (#499).img://registries are not affected. Set--nameto keep the previous name. - On the container path,
DOCKER_USERNAMEnow takes precedence over a host-specific token such asGITHUB_TOKEN(#500).
Security
- Release binaries are built with Go 1.27.3 (#523). Earlier releases were built with Go 1.26.0, because
go.modnamed no toolchain, and carried the standard library fixes made since then, innet/http,crypto/tls,crypto/x509andhtml/templateamong others. github.com/go-jose/go-jose/v4is updated to v4.1.6 for GHSA-mgcc-cww5-fp2q, GHSA-4w3g-jfj2-cw2q and GHSA-vvm8-gf78-28g4, andgolang.org/x/netto v0.62.0 andgolang.org/x/cryptoto v0.58.0 (#523).
Documentation
- The memory, Consul and Redis cache backends are no longer described as planned. The rate-limit and multi-server answers in the FAQ now show the shared S3 or GCS cache with
registry-ttl(#508). - The OCI registry credential variables and their precedence are documented (#500).
Maintenance
- Dependencies: gRPC 1.83.2 (#489), the AWS SDK (#502) and OpenTelemetry 1.46.0 (#503).
- Internal refactoring with no change in behavior: shared defaults, container label constants and the deploy hook runner each live in one place (#496, #497, #498).
- The e2e tests run on Probe v1.30.0, cover blue/green slots on S3 and GCS, and the lint workflow checks their formatting (#516, #517, #518, #519, #521, #522).
- The docs site dependencies are updated (#488, #514, #515).
v2.20.0
Opt-in backoff for the polling loop
The polling scheduler fired at a fixed interval, so a registry that was down met an unchanged request rate for as long as the outage lasted. At the default --interval 10 that is 360 attempts an hour per instance, every one of them failing.
--max-backoff-interval <seconds> bounds that (#481, thanks @u5surf). While checks keep failing the effective interval doubles from the configured interval, jittered, up to the given bound. The first successful check restores the normal cadence immediately.
dewy server --interval 10 --max-backoff-interval 300 -- /opt/app/current/appA registry that stays down is then polled at most 10s, 20s, 40s, 80s and 160s apart, and at most 300s apart from there on, instead of every 10s. The flag defaults to 0, which keeps the fixed interval dewy has always used, so no existing deployment changes behavior without opting in.
Worth knowing before enabling it:
- A single failure never stretches the interval. Only the second consecutive failure opens a window, because one failed check is more often a blip than an outage and delaying recovery for it costs more than it saves.
- Jitter applies only to the part of the delay above the interval, so a jittered wait is never shorter than one polling interval. A bound shorter than
--intervalis therefore inert. - The scheduler still fires at
--intervaland a tick returns immediately while a window is open, so every wait lands on a multiple of the configured interval. - The artifact-not-found grace period and a slot mismatch are skips rather than failures, and neither opens a window. A slow CI upload will not stretch the interval.
- Any error from a check counts, not only a registry outage. A failing deploy hook or a failed server restart backs off as well.
- The trade-off is that a release landing right after recovery can go unnoticed for up to the bound. The polling tick is also dewy's only recovery path for a managed server that has crashed, so that restart is delayed by the same amount once the registry comes back.
Documentation
- The reference documented
--intervalas defaulting to 600 seconds. The actual default is 10, and has been since 2018 (#480, thanks @u5surf). - The Japanese reference had both of the above missing and now carries them (#482).
レジストリis used consistently across the Japanese pages and the side navigation, which still hadレジストリーin six places (#482).
Maintenance
- The backoff vocabulary was settled before it shipped: the flag, its config field, the type and the file all read as
max-backoff-interval, and the scheduler callback is nowtick, which is what the codebase already called it in comments (#482).
Full Changelog: v2.19.1...v2.20.0
v2.19.1
Container flag fixes
--health-timeout and --drain-time were parsed, defaulted and stored on the container config, but neither reached the code it was supposed to control. Both were wired when container support landed and both lost their readers in later refactors, leaving the flags and their documentation advertising behavior that no longer existed (#478).
--health-timeoutis now the overall budget for verifying a container, which matches its documented meaning. The probe retries within that budget instead of running a fixed five attempts with a hardcoded 5s timeout, and the failure message reports the attempt count, the budget and the last error.- The probe and its back-off now honor the context, so a shutdown during a deploy is no longer stuck behind an in-flight health check.
--drain-timenow feeds the stop timeout of the old container. The old container is stopped right after its backend is pulled from the proxy, so that timeout is the drain window: SIGTERM lands immediately and the container has until the timeout to finish in-flight requests. At the default this widens the window from a hardcoded 10s to the documented 30s, the one user-visible difference at the defaults.- A sub-second stop timeout is clamped to one second. The runtime CLI takes whole seconds, so truncation turned a short graceful stop into an immediate kill. Reachable only from a programmatically built config.
container/healthcheck.gois removed.HealthChecker,WaitForHTTPandWaitForTCPlost their only production caller in an earlier refactor.
Dewy's own shutdown keeps its fixed 10 second stop window, so a generous drain budget cannot stall exit past a service manager's stop timeout.
Tests
- New
healthfaile2e variant covers the health check failure path, which had no coverage in any mode (#479). It asserts that the configured budget reaches the probe, and that a replica failing its health check is rolled back rather than stranded. - e2e now asserts that
--drain-timereaches the old-container stop.
Security
google.golang.org/grpcv1.82.0 -> v1.82.1 (GHSA-hrxh-6v49-42gf) andgithub.com/google/cel-gov0.28.0 -> v0.29.0 (GHSA-gcjh-h69q-9w9g) (#473).
Maintenance
- Dependabot scope narrowed to Go modules at the repository root (#473).
- Dependency bumps:
aws-sdk-go-v2/config(#474),aws-sdk-go-v2/service/s3(#475),prometheus/client_golang(#476).
Full Changelog: v2.19.0...v2.19.1