Skip to content

Add redis-proxy Dockerfile, GHCR publishing workflow, and deployment …#367

Merged
bootjp merged 18 commits intomainfrom
feature/redis-proxy
Mar 20, 2026
Merged

Add redis-proxy Dockerfile, GHCR publishing workflow, and deployment …#367
bootjp merged 18 commits intomainfrom
feature/redis-proxy

Conversation

@bootjp
Copy link
Owner

@bootjp bootjp commented Mar 20, 2026

…guide for automated container deployment

@bootjp bootjp requested a review from Copilot March 20, 2026 09:27
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the deployability and usability of the redis-proxy by introducing a dedicated Dockerfile for containerization and a detailed deployment guide. These additions streamline the process of packaging, deploying, and operating the redis-proxy in various environments, facilitating its role in gradual migrations from Redis to ElasticKV.

Highlights

  • Dockerfile for redis-proxy: A new multi-stage Dockerfile (Dockerfile.redis-proxy) was added to build and containerize the redis-proxy application, using golang:latest for building and gcr.io/distroless/static:latest for the final image.
  • Redis-proxy Deployment Guide: A comprehensive deployment guide (docs/redis-proxy-deployment.md) was added, detailing Docker image usage, command-line options, proxy modes for migration, deployment examples (Docker, Docker Compose, Kubernetes), health checks, Prometheus metrics, internal parameters, graceful shutdown, and troubleshooting.
  • GHCR Publishing Workflow: The pull request description indicates the addition of a GitHub Container Registry (GHCR) publishing workflow, which automatically builds and publishes redis-proxy images on pushes to main when relevant files change.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/redis-proxy-docker.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a Dockerfile for the redis-proxy and a comprehensive deployment guide. The changes are a great addition. My review includes suggestions to improve the Dockerfile for better reproducibility and build performance by pinning base image versions and optimizing layer caching. For the deployment guide, I've pointed out that the Kubernetes example uses a command not available in the container and recommended using specific image tags in examples instead of latest to promote best practices.

@@ -0,0 +1,11 @@
FROM golang:latest AS build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

For better reproducibility and to avoid unexpected build failures, it's recommended to pin the Go version instead of using latest. For example, you can use a specific version like golang:1.22.

FROM golang:1.22 AS build


RUN CGO_ENABLED=0 go build -o /redis-proxy ./cmd/redis-proxy/

FROM gcr.io/distroless/static:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

It's a best practice to pin the base image version for the final stage instead of using latest to ensure your deployments are deterministic. Additionally, consider using the nonroot variant for enhanced security, as it runs the container as a non-privileged user.

FROM gcr.io/distroless/static:nonroot

FROM golang:latest AS build

WORKDIR $GOPATH/src/app
COPY . .
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To improve Docker build performance and leverage layer caching more effectively, you should copy go.mod and go.sum first, download dependencies, and then copy the rest of the source code. This prevents re-downloading dependencies every time any file in the repository changes. The structure should be:

COPY go.mod go.sum ./
RUN go mod download
COPY . .

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds end-to-end container packaging and deployment documentation for redis-proxy, enabling automated builds/publishing to GHCR and providing run examples for Docker/Compose/Kubernetes.

Changes:

  • Added a deployment guide covering proxy modes, flags, metrics, alerts, and example manifests.
  • Added a dedicated Dockerfile.redis-proxy to build a distroless redis-proxy image.
  • Added a GitHub Actions workflow to build (and on main, publish) the redis-proxy image to GHCR.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
docs/redis-proxy-deployment.md New deployment guide covering modes, configuration, observability, and deployment examples.
Dockerfile.redis-proxy New multi-stage build for a distroless redis-proxy container image.
.github/workflows/redis-proxy-docker.yml New workflow to build/push the redis-proxy image to GHCR on relevant changes.


RUN CGO_ENABLED=0 go build -o /redis-proxy ./cmd/redis-proxy/

FROM gcr.io/distroless/static:latest
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The runtime image runs as root by default. For a network-facing proxy, consider switching to a non-root distroless variant (or setting an explicit unprivileged USER) to reduce impact if the process is compromised.

Suggested change
FROM gcr.io/distroless/static:latest
FROM gcr.io/distroless/static:nonroot

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +15
Pre-built images are published to GitHub Container Registry on every push to `main`:

```
ghcr.io/bootjp/elastickv/redis-proxy:latest
ghcr.io/bootjp/elastickv/redis-proxy:sha-<commit>
```

The CI workflow (`.github/workflows/redis-proxy-docker.yml`) builds the image automatically when files under `cmd/redis-proxy/`, `proxy/`, or `Dockerfile.redis-proxy` change.

Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The guide says images are published “on every push to main”, but the workflow is path-filtered and will only run when specific files change. Please update this sentence to match the workflow behavior (or remove the path filters if the intent really is every push).

Copilot uses AI. Check for mistakes.
Comment on lines +69 to +75
```bash
docker run --rm \
ghcr.io/bootjp/elastickv/redis-proxy:latest \
-listen :6379 \
-primary redis.internal:6379 \
-mode redis-only
```
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the “Minimal (redis-only)” docker run example, the container listens on :6379 but no -p/--publish is set, so the proxy won’t be reachable from the host in a typical local run. Consider adding the appropriate -p 6379:6379 mapping (or clarify that this example assumes a user-defined Docker network / --network host).

Copilot uses AI. Check for mistakes.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

bootjp and others added 4 commits March 20, 2026 18:32
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bootjp
Copy link
Owner Author

bootjp commented Mar 20, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Mar 20, 2026

@bootjp I've opened a new pull request, #368, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Mar 20, 2026

@bootjp I've opened a new pull request, #369, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 5 commits March 20, 2026 09:35
Co-authored-by: bootjp <1306365+bootjp@users.noreply.github.com>
Co-authored-by: bootjp <1306365+bootjp@users.noreply.github.com>
docs: add missing port mapping to minimal redis-proxy docker run example
@bootjp bootjp requested a review from Copilot March 20, 2026 09:49
Fix redis-proxy deployment docs: workflow trigger accuracy and docker run port mapping
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

bootjp and others added 2 commits March 20, 2026 18:54
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bootjp bootjp requested a review from Copilot March 20, 2026 10:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.

Comment on lines +49 to +52
| Mode | Reads from | Writes to | Use case |
|------|-----------|-----------|----------|
| `redis-only` | Redis | Redis only | Transparent proxy. Route traffic through the proxy first |
| `dual-write` | Redis | Redis + ElasticKV | Begin data sync. Populate ElasticKV |
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The proxy modes table also starts with a double leading pipe (||), which will render an extra empty column. Use a single leading pipe for proper markdown table formatting.

Copilot uses AI. Check for mistakes.
Comment on lines +211 to +214
| Metric | Type | Description |
|--------|------|-------------|
| `proxy_command_total` | Counter | Commands processed (labels: command, backend, status) |
| `proxy_command_duration_seconds` | Histogram | Backend command latency |
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Key Metrics markdown table uses a double leading pipe (||), which typically renders as an extra empty column. Switch to a single leading pipe for the header and separator rows.

Copilot uses AI. Check for mistakes.
Comment on lines +253 to +257
| Parameter | Value | Description |
|-----------|-------|-------------|
| Connection pool size | 128 | go-redis pool size per backend |
| Dial timeout | 5s | Backend connection timeout |
| Read timeout | 3s | Backend read timeout |
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Internal Parameters markdown table also starts with a double leading pipe (||), which usually creates an empty first column. Use a single leading pipe for correct table formatting.

Copilot uses AI. Check for mistakes.
images: ghcr.io/${{ github.repository }}/redis-proxy
tags: |
type=sha
type=ref,event=branch
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow publishes a branch tag (e.g., :main) via type=ref,event=branch. The deployment guide currently documents only :latest and :sha-...; either drop the branch tag here or update the docs so users know all published tags.

Suggested change
type=ref,event=branch

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +31
| Flag | Default | Description |
|------|---------|-------------|
| `-listen` | `:6479` | Proxy listen address |
| `-primary` | `localhost:6379` | Primary (Redis) address |
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The markdown table header uses a double leading pipe (|| ... |), which renders as an extra empty column in most Markdown viewers. Use a single leading pipe for the header and separator row (and apply the same fix to the other tables in this doc).

Copilot uses AI. Check for mistakes.
Comment on lines +7 to +12
Pre-built images are published to GitHub Container Registry when relevant files change on `main` (see path filters in the workflow):

```
ghcr.io/bootjp/elastickv/redis-proxy:latest
ghcr.io/bootjp/elastickv/redis-proxy:sha-<commit>
```
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The docs list only latest and sha-... image tags, but the workflow configuration also publishes a branch tag (e.g., :main) via type=ref,event=branch. Either document the additional tag here or remove the branch tag from the workflow to match the docs.

Copilot uses AI. Check for mistakes.
@bootjp bootjp enabled auto-merge March 20, 2026 10:13
bootjp and others added 2 commits March 20, 2026 19:13
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bootjp bootjp merged commit 0ae8389 into main Mar 20, 2026
8 checks passed
@bootjp bootjp deleted the feature/redis-proxy branch March 20, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants