# Dewy Deployment Modes Explained: Server, Assets, and Container Strategies

> Explore Dewy's Server Assets and Container deployment modes. Optimize your binary applications, static files, or OCI containers with tailored strategies. Learn more now.

- Repository: [Tomohisa Oda/dewy](https://github.com/linyows/dewy)
- Tags: deep-dive
- Published: 2026-03-06

---

**Dewy supports three distinct deployment modes—Server, Assets, and Container—each optimized for specific workload types ranging from binary applications to static files and OCI containers.**

Dewy is an open-source deployment agent written in Go that automates software distribution from various registries. Understanding the available **deployment modes** is essential for selecting the right strategy for your infrastructure, whether you are managing compiled binaries, frontend assets, or containerized microservices.

## Understanding Dewy's Three Deployment Modes

The core configuration in [`config.go`](https://github.com/linyows/dewy/blob/main/config.go) defines the `Command` type that determines which **deployment mode** Dewy operates in. As shown in lines 12-18, the three constants are `SERVER`, `ASSETS`, and `CONTAINER`:

- **SERVER**: Manages long-running binary applications with automatic restarts
- **ASSETS**: Distributes static files to web server directories
- **CONTAINER**: Orchestrates OCI container deployments with zero-downtime updates

The CLI sub-commands in [`cli.go`](https://github.com/linyows/dewy/blob/main/cli.go) map directly to these modes, parsing user input and populating `Config.Command` before execution begins.

## Server Mode: Binary Application Deployment

**Server mode** is designed for deploying compiled binaries that run as persistent services. This mode handles the complete lifecycle: downloading artifacts, extracting them, creating atomic symlinks, and managing process restarts.

### How Server Mode Works

When Dewy runs in Server mode, the orchestration logic in [`dewy.go`](https://github.com/linyows/dewy/blob/main/dewy.go) (lines 55-85) performs the following sequence:

1. Polls the configured registry for new artifacts
2. Downloads and caches the artifact locally
3. Extracts the contents to a versioned directory
4. Creates an atomic symlink from `current` to the new version
5. Starts the server process if not running, or performs a graceful restart if already active

The symlink approach ensures that the running binary always points to a consistent directory, preventing partial deployment states.

### Server Mode Configuration Example

Deploy a Go binary from GitHub Releases with automatic restarts on port 8000:

```bash
dewy server \
  --registry ghr://linyows/myapp \
  -p 8000 \
  -- /opt/myapp/current/myapp

```

This command configures Dewy to monitor the GitHub Releases registry for `linyows/myapp`, expose the service on port 8000, and execute the binary located at `/opt/myapp/current/myapp` after each update.

## Assets Mode: Static File Distribution

**Assets mode** simplifies the deployment of static content such as HTML, CSS, JavaScript, and media files. Unlike Server mode, this configuration does not manage running processes—it merely ensures that the target directory contains the latest version of the files.

### Static Asset Deployment Workflow

The Assets mode implementation in [`dewy.go`](https://github.com/linyows/dewy/blob/main/dewy.go) (lines 92-104) follows a streamlined path:

1. Detects new artifacts via the registry polling mechanism
2. Downloads the artifact to the local cache
3. Extracts the archive contents directly into the specified destination directory
4. Skips server lifecycle management and returns to the polling loop

This mode shares the same caching and registry infrastructure as Server mode but short-circuits the process restart logic.

### Assets Mode CLI Usage

Deploy static website files from a GitHub Releases artifact to a web server directory:

```bash
dewy assets \
  --registry ghr://linyows/frontend \
  -d /var/www/html

```

This extracts the latest release from `linyows/frontend` into `/var/www/html`, making the new static content immediately available to the web server without requiring a service restart.

## Container Mode: Zero-Downtime Container Orchestration

**Container mode** provides enterprise-grade deployment capabilities for OCI-compliant container images. This mode supports rolling updates, health checks, and blue-green deployment strategies while maintaining zero downtime during transitions.

### OCI Image Deployment with Health Checks

When operating in Container mode, Dewy invokes `RunContainer` (implemented in [`dewy.go`](https://github.com/linyows/dewy/blob/main/dewy.go) lines 667-679) to manage the container lifecycle:

1. Connects to the specified OCI registry (Docker Hub, GHCR, private registries)
2. Pulls the new image version
3. Starts the configured number of replicas
4. Executes health check requests against the specified endpoint
5. Gradually drains traffic from old containers once health checks pass
6. Removes obsolete container instances

The container runtime abstraction in [`container/docker.go`](https://github.com/linyows/dewy/blob/main/container/docker.go) and [`container/podman.go`](https://github.com/linyows/dewy/blob/main/container/podman.go) allows Dewy to work with both Docker and Podman environments seamlessly.

### Blue-Green Deployment Slots

All **deployment modes** support slot-based filtering for blue-green deployment strategies. The `Slot` field (defined in [`dewy.go`](https://github.com/linyows/dewy/blob/main/dewy.go) lines 71-78) allows you to tag releases and target specific deployment groups:

```bash
dewy server \
  --registry ghr://linyows/myapp \
  --slot blue \
  -- /opt/myapp/current/myapp

```

This configuration only applies releases tagged with `+blue` to this instance, enabling parallel blue-green environments with independent rollout control.

### Container Mode Command Example

Deploy a containerized application with rolling updates and health monitoring:

```bash
dewy container \
  --registry img://ghcr.io/linyows/myapp \
  --port 8080 \
  --health-path /health \
  --replicas 3 \
  -- -e DATABASE_URL=postgres://db:5432/mydb -v /data:/app/data

```

This command configures three replicas, exposes port 8080, validates deployment health via the `/health` endpoint, and passes environment variables and volume mounts to the container runtime.

## Shared Infrastructure Across All Modes

Despite their distinct operational characteristics, all three **deployment modes** leverage common infrastructure components implemented throughout the codebase:

- **Registry Polling**: The `registry/*` packages provide unified interfaces for GitHub Releases, S3, OCI registries, and other artifact sources
- **Caching Layer**: Artifacts are cached locally to prevent redundant downloads and enable rapid rollbacks
- **Hook Execution**: Before and after deployment hooks run consistently across Server, Assets, and Container modes
- **Slot Filtering**: The `Slot` configuration (lines 71-78 in [`dewy.go`](https://github.com/linyows/dewy/blob/main/dewy.go)) enables blue-green deployment strategies regardless of mode

This shared architecture ensures that operational features like caching and deployment hooks behave consistently, reducing cognitive load when switching between **deployment modes**.

## Summary

Dewy provides three specialized **deployment modes** to accommodate different infrastructure requirements:

- **Server mode** manages compiled binary applications with automatic extraction, atomic symlinking, and process lifecycle management
- **Assets mode** distributes static files to target directories without process management, ideal for web content deployment
- **Container mode** orchestrates OCI container images with zero-downtime rolling updates, health checks, and replica management

All modes support advanced features including registry polling, local caching, deployment hooks, and blue-green slot filtering, making Dewy a versatile solution for continuous deployment pipelines.

## Frequently Asked Questions

### What is the default deployment mode in Dewy?

Dewy does not have a default deployment mode; you must explicitly specify one via the CLI sub-command. The available commands are `server`, `assets`, and `container`, which map directly to the `SERVER`, `ASSETS`, and `CONTAINER` constants defined in [`config.go`](https://github.com/linyows/dewy/blob/main/config.go). Running Dewy without specifying a sub-command will display help documentation rather than executing a deployment.

### Can I use Dewy for blue-green deployments?

Yes, all three deployment modes support blue-green deployment strategies through the `--slot` flag. When you specify a slot (e.g., `--slot blue`), Dewy filters releases to only apply those tagged with the corresponding slot identifier (such as `+blue`). This allows you to run parallel production environments and control rollout independently per slot, as implemented in [`dewy.go`](https://github.com/linyows/dewy/blob/main/dewy.go) lines 71-78.

### How does Dewy handle rolling updates in container mode?

In container mode, Dewy implements zero-downtime rolling updates through the `RunContainer` function in [`dewy.go`](https://github.com/linyows/dewy/blob/main/dewy.go) (lines 667-679). The process involves starting new container replicas while keeping existing ones running, executing health checks against the specified endpoint, and gradually draining traffic from old containers before removal. This ensures continuous availability during deployments, with support for both Docker and Podman runtimes via the abstraction layer in [`container/docker.go`](https://github.com/linyows/dewy/blob/main/container/docker.go) and [`container/podman.go`](https://github.com/linyows/dewy/blob/main/container/podman.go).

### Which registry types does Dewy support across deployment modes?

Dewy supports multiple registry types through its unified registry interface in the `registry/*` packages, and these are available across all deployment modes. Supported registries include GitHub Releases (`ghr://`), Amazon S3, OCI-compliant container registries (`img://` for GHCR, Docker Hub, and private registries), and other artifact sources. The registry polling and caching mechanisms are shared infrastructure components that work identically regardless of whether you are deploying in server, assets, or container mode.