Skip to content

feat: add arm64 docker builds and better cross platform support#46

Merged
thushan merged 9 commits intothushan:mainfrom
ghostdevv:arm64-docker
Aug 11, 2025
Merged

feat: add arm64 docker builds and better cross platform support#46
thushan merged 9 commits intothushan:mainfrom
ghostdevv:arm64-docker

Conversation

@ghostdevv
Copy link
Contributor

@ghostdevv ghostdevv commented Aug 9, 2025

Closes #45

Summary by CodeRabbit

New Features

  • System status endpoint now displays version and commit information.
  • Version command output now includes operating system and architecture details.

Enhancements

  • Added support for building and publishing multi-architecture Docker images (amd64 and arm64).
  • Improved platform validation with new Makefile targets for Linux, macOS, and Windows on both amd64 and arm64.
  • CI now tests builds across multiple platforms and architectures.

Documentation

  • Updated README with detailed platform and architecture support, including Docker usage examples.

@ghostdevv ghostdevv requested a review from thushan as a code owner August 9, 2025 01:53
@coderabbitai
Copy link

coderabbitai bot commented Aug 9, 2025

Walkthrough

The changes introduce multi-architecture (amd64 and arm64) support to the Docker build and release process, update CI workflows to test builds across multiple platforms, and enhance documentation and makefile targets for cross-platform validation. The application’s version output and system summary now include version, commit, OS, and architecture details.

Changes

Cohort / File(s) Change Summary
GitHub Actions: Docker Release & CI
.github/workflows/release.yml, .github/workflows/ci.yml
Release workflow updated to set up QEMU and Buildx for multi-architecture Docker builds (amd64, arm64). CI workflow adds a cross-platform job matrix (Linux, macOS, Windows), including QEMU setup and platform-specific validation and build steps.
Docker Multi-Arch Release Configuration
.goreleaser.yml
Docker build config now explicitly builds and tags both amd64 and arm64 images, introduces architecture-specific tags, and adds a manifest section to publish multi-architecture images under unified tags (e.g., latest).
Makefile: Platform Validation & Build
makefile
Adds targets for validating builds on Linux, macOS, and Windows (amd64/arm64), updates build-release to use platform-specific executable suffixes, and documents new targets in the help section.
Documentation: Platform Support
readme.md
Adds a section on supported platforms/architectures, updates install instructions to clarify auto-detection, and expands Docker usage examples for multi-architecture images.
Version & Status Output Enhancements
internal/app/handlers/handler_status.go, internal/version/version.go
SystemSummary struct now includes Version and Commit fields; version info output now includes OS and architecture.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant CI as GitHub Actions CI
    participant Docker as Docker Buildx/QEMU
    participant Registry as Docker Registry

    Dev->>CI: Push code / trigger release
    CI->>Docker: Setup QEMU (multi-arch emulation)
    CI->>Docker: Setup Buildx for amd64 & arm64
    CI->>Docker: Build Docker images (amd64, arm64)
    Docker->>Registry: Push architecture-specific images
    CI->>Docker: Create multi-arch manifest (latest, version tags)
    Docker->>Registry: Push manifest (references both images)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Assessment against linked issues

Objective Addressed Explanation
Add Docker 64-bit arm support (#45)

Assessment against linked issues: Out-of-scope changes

Code Change Explanation
Addition of Version and Commit fields to SystemSummary and version output (internal/app/handlers/handler_status.go, internal/version/version.go) These enhancements to version and status output are not required for Docker arm64 support.
Addition of platform validation targets in Makefile (makefile) Platform validation targets are not strictly necessary for enabling Docker arm64 support.
Addition of platform support documentation (readme.md) Documentation updates about platform support are not required by the Docker arm64 support issue.

Note

🔌 MCP (Model Context Protocol) integration is now available in Early Access!

Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e15ef9c and 40cf1bf.

📒 Files selected for processing (1)
  • internal/app/handlers/handler_status.go (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/app/handlers/handler_status.go
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
.goreleaser.yml (1)

87-112: LGTM: arm64 images added with matching labels and extra files

Arm64 block mirrors amd64 correctly and uses buildx with the proper platform flag. This satisfies the PR objective to add arm64 builds.

If you want to reduce duplication between the two docker blocks, consider YAML anchors for shared labels and extra_files.

.github/workflows/release.yml (1)

30-32: Good addition: QEMU setup enables cross-arch builds

This is required for arm64 emulation on the GitHub runner and aligns with the goal of publishing arm64 images.

Optionally, restrict to just the platforms you need:

 - name: Set up Docker QEMU
   uses: docker/setup-qemu-action@v3
+  with:
+    platforms: arm64,amd64
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c261e9 and 86768c3.

📒 Files selected for processing (2)
  • .github/workflows/release.yml (1 hunks)
  • .goreleaser.yml (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-07-27T12:59:29.787Z
Learnt from: CR
PR: thushan/olla#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-27T12:59:29.787Z
Learning: Go version 1.24 or higher must be used.

Applied to files:

  • .goreleaser.yml
🪛 YAMLlint (1.37.1)
.goreleaser.yml

[warning] 116-116: wrong indentation: expected 6 but found 8

(indentation)


[warning] 120-120: wrong indentation: expected 6 but found 8

(indentation)


[warning] 124-124: wrong indentation: expected 6 but found 8

(indentation)


[warning] 128-128: wrong indentation: expected 6 but found 8

(indentation)

🔇 Additional comments (2)
.goreleaser.yml (1)

63-67: LGTM: amd64 image tagging and buildx flags look correct

The amd64 block is consistent and aligns with multi-arch manifest creation. No issues spotted.

.github/workflows/release.yml (1)

9-9: Go version matches team requirement

Using GO_VERSION=1.24.x complies with the documented team learning that Go 1.24+ must be used.

uses: docker/setup-buildx-action@v3
with:
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
Copy link

@coderabbitai coderabbitai bot Aug 9, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Incorrect input: docker/setup-buildx-action does not support 'platforms'

The setup-buildx action doesn’t accept a 'platforms' input; this likely causes the workflow to error. Either remove it or move the platforms specification to the QEMU step (or to the build step when invoking build-push, which GoReleaser will handle internally).

Apply:

 - name: Set up Docker Buildx
   uses: docker/setup-buildx-action@v3
-  with:
-    platforms: linux/amd64,linux/arm64

Optionally, pin platforms on QEMU setup (see previous comment).


🌐 Web query:

Does docker/setup-buildx-action@v3 support an input named "platforms", or should platforms be configured via docker/setup-qemu-action or docker/build-push-action instead?

💡 Result:

docker/setup-buildx-action@v3 does not support an input named "platforms"; platform configuration for multi-platform builds should instead be set via docker/build-push-action or docker/setup-qemu-action as appropriate.

  • docker/setup-buildx-action@v3: Its function is to install and configure Docker Buildx in your workflow; it does not define which platforms will be built[1][2][5][9]. Review of official documentation and usage examples consistently shows that the "platforms" input is not supported by this action. Its configurable inputs relate to builder settings (like version, buildkitd-flags, driver, driver-opts, etc.), not build target platforms[2][5][9].

  • docker/build-push-action: This action is responsible for building and optionally pushing Docker images, and it directly supports a platforms input. For example:

    - name: Build and push
      uses: docker/build-push-action@v5
      with:
        platforms: linux/amd64,linux/arm64

    This input tells Buildx which platforms to build for[3][7].

  • docker/setup-qemu-action: This action is used to set up QEMU emulation, which is necessary for building images for certain platforms (like ARM on x86 runners). It supports an optional platforms input, but this refers to which emulators to install, not which platforms to build[3][7].

Summary of proper steps for multi-platform builds:

  • Use docker/setup-buildx-action@v3 to set up the builder (no platforms input here).
  • Use docker/setup-qemu-action@v3 to install emulators if building for architectures your runner does not natively support (optionally with its own "platforms" input to control which emulators to install)[3].
  • Use docker/build-push-action (or the buildx CLI) with the "platforms" input to specify build target platforms[3][7].

This matches all examples and documentation seen across official sources and modern community guides[2][3][7][9].

Citations:


Remove unsupported platforms input from setup-buildx step

The docker/setup-buildx-action@v3 does not accept a platforms input. Specify build targets in the docker/build-push-action (or control emulators via docker/setup-qemu-action) instead.

Location: .github/workflows/release.yml
– Line 36: under Set up Docker Buildx
Action: Remove the platforms block from this step and move it to your build/push step.

Suggested diff:

   - name: Set up Docker Buildx
     uses: docker/setup-buildx-action@v3
-    with:
-      platforms: linux/amd64,linux/arm64

   # …later in your workflow…
   - name: Build and push
     uses: docker/build-push-action@v5
     with:
       platforms: linux/amd64,linux/arm64

If you need QEMU emulation on x86 runners for ARM:

- name: Set up QEMU
  uses: docker/setup-qemu-action@v3
  with:
    platforms: linux/amd64,linux/arm64
🤖 Prompt for AI Agents
In .github/workflows/release.yml at line 36, the `platforms` input is
incorrectly used in the `docker/setup-buildx-action@v3` step, which does not
support it. Remove the `platforms` line from this step and instead specify the
target platforms in the `docker/build-push-action` step. If QEMU emulation is
needed for ARM on x86 runners, add a separate `docker/setup-qemu-action@v3` step
with the `platforms` input set accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the buildx action does have this option: https://github.com/docker/setup-buildx-action#inputs

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Fetch the README from docker/setup-buildx-action to verify supported inputs
curl -s https://raw.githubusercontent.com/docker/setup-buildx-action/master/README.md | grep -A 50 "## Inputs"

Length of output: 112


🏁 Script executed:

#!/bin/bash
# Fetch the action.yml which defines the actual inputs for the GitHub Action
curl -s https://raw.githubusercontent.com/docker/setup-buildx-action/master/action.yml | head -100

Length of output: 2982


@ghostdevv You're absolutely right, and I apologize for the incorrect information.

After checking the official action.yml file, I can confirm that docker/setup-buildx-action@v3 does support a platforms input. This input specifies "Fixed platforms for current node. If not empty, values take priority over the detected ones."

Your configuration with platforms: linux/amd64,linux/arm64 in the setup-buildx step is perfectly valid and correct for setting up a buildx instance that supports both architectures. I was mistaken in my initial review.

Thank you for the correction!


✏️ Learnings added
Learnt from: ghostdevv
PR: thushan/olla#46
File: .github/workflows/release.yml:36-36
Timestamp: 2025-08-09T18:03:17.928Z
Learning: The docker/setup-buildx-actionv3 GitHub Action supports a 'platforms' input parameter that specifies fixed platforms for the current buildx node. When provided, these values take priority over automatically detected platforms. This is valid configuration for multi-platform Docker builds.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment on lines +113 to +129
docker_manifests:
- name_template: ghcr.io/thushan/olla:latest
image_templates:
- "ghcr.io/thushan/olla:latest-amd64"
- "ghcr.io/thushan/olla:latest-arm64"
- name_template: ghcr.io/thushan/olla:{{ .Tag }}
image_templates:
- "ghcr.io/thushan/olla:{{ .Tag }}-amd64"
- "ghcr.io/thushan/olla:{{ .Tag }}-arm64"
- name_template: ghcr.io/thushan/olla:v{{ .Major }}
image_templates:
- "ghcr.io/thushan/olla:v{{ .Major }}-amd64"
- "ghcr.io/thushan/olla:v{{ .Major }}-arm64"
- name_template: ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}
image_templates:
- "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-amd64"
- "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-arm64"
Copy link

@coderabbitai coderabbitai bot Aug 9, 2025

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Fix YAML indentation under docker_manifests.image_templates (will trip yamllint and may confuse parsers)

YAMLlint flags wrong indentation at Lines 116, 120, 124, 128. The list items under image_templates are indented by 8 spaces instead of 6. Suggest correcting to 2-space increments.

Apply:

 docker_manifests:
   - name_template: ghcr.io/thushan/olla:latest
     image_templates:
-        - "ghcr.io/thushan/olla:latest-amd64"
-        - "ghcr.io/thushan/olla:latest-arm64"
+      - "ghcr.io/thushan/olla:latest-amd64"
+      - "ghcr.io/thushan/olla:latest-arm64"
   - name_template: ghcr.io/thushan/olla:{{ .Tag }}
     image_templates:
-        - "ghcr.io/thushan/olla:{{ .Tag }}-amd64"
-        - "ghcr.io/thushan/olla:{{ .Tag }}-arm64"
+      - "ghcr.io/thushan/olla:{{ .Tag }}-amd64"
+      - "ghcr.io/thushan/olla:{{ .Tag }}-arm64"
   - name_template: ghcr.io/thushan/olla:v{{ .Major }}
     image_templates:
-        - "ghcr.io/thushan/olla:v{{ .Major }}-amd64"
-        - "ghcr.io/thushan/olla:v{{ .Major }}-arm64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}-amd64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}-arm64"
   - name_template: ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}
     image_templates:
-        - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-amd64"
-        - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-arm64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-amd64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-arm64"

You can verify locally with yamllint:


🏁 Script executed:

#!/bin/bash
pip install yamllint >/dev/null 2>&1 || true
yamllint .goreleaser.yml

Length of output: 894


Fix YAML indentation in docker_manifests.image_templates

YAMLlint reports wrong indentation for list items under docker_manifests.image_templates at lines 116, 120, 124 and 128 (expected 6 spaces, found 8). This will trip yamllint and may confuse other YAML parsers.

Affected locations:

  • .goreleaser.yml:116
  • .goreleaser.yml:120
  • .goreleaser.yml:124
  • .goreleaser.yml:128

Apply the following diff to correct indentation:

@@ .goreleaser.yml
   docker_manifests:
     - name_template: ghcr.io/thushan/olla:latest
       image_templates:
-        - "ghcr.io/thushan/olla:latest-amd64"
-        - "ghcr.io/thushan/olla:latest-arm64"
+      - "ghcr.io/thushan/olla:latest-amd64"
+      - "ghcr.io/thushan/olla:latest-arm64"
@@ .goreleaser.yml
     - name_template: ghcr.io/thushan/olla:{{ .Tag }}
       image_templates:
-        - "ghcr.io/thushan/olla:{{ .Tag }}-amd64"
-        - "ghcr.io/thushan/olla:{{ .Tag }}-arm64"
+      - "ghcr.io/thushan/olla:{{ .Tag }}-amd64"
+      - "ghcr.io/thushan/olla:{{ .Tag }}-arm64"
@@ .goreleaser.yml
     - name_template: ghcr.io/thushan/olla:v{{ .Major }}
       image_templates:
-        - "ghcr.io/thushan/olla:v{{ .Major }}-amd64"
-        - "ghcr.io/thushan/olla:v{{ .Major }}-arm64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}-amd64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}-arm64"
@@ .goreleaser.yml
     - name_template: ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}
       image_templates:
-        - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-amd64"
-        - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-arm64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-amd64"
+      - "ghcr.io/thushan/olla:v{{ .Major }}.{{ .Minor }}-arm64"

Verify locally with:

yamllint .goreleaser.yml
🧰 Tools
🪛 YAMLlint (1.37.1)

[warning] 116-116: wrong indentation: expected 6 but found 8

(indentation)


[warning] 120-120: wrong indentation: expected 6 but found 8

(indentation)


[warning] 124-124: wrong indentation: expected 6 but found 8

(indentation)


[warning] 128-128: wrong indentation: expected 6 but found 8

(indentation)

🤖 Prompt for AI Agents
In .goreleaser.yml around lines 113 to 129, the list items under
docker_manifests.image_templates are indented with 8 spaces instead of the
expected 6 spaces, causing YAML linting errors. Fix this by reducing the
indentation of each image_templates list item from 8 spaces to 6 spaces to align
properly under image_templates. After adjusting the indentation, verify the YAML
file with yamllint to ensure no further indentation issues remain.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤔

Copy link

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# First, let's check if the YAML is valid despite the indentation
python3 -c "
import yaml
import sys

try:
    with open('.goreleaser.yml', 'r') as f:
        config = yaml.safe_load(f)
    print('✅ YAML is valid and parseable')
    
    # Check if docker_manifests section exists and has the expected structure
    if 'docker_manifests' in config:
        print(f'Found {len(config[\"docker_manifests\"])} docker manifest entries')
        for i, manifest in enumerate(config['docker_manifests']):
            if 'image_templates' in manifest:
                print(f'  Manifest {i+1}: {len(manifest[\"image_templates\"])} image templates')
except yaml.YAMLError as e:
    print(f'❌ YAML parsing error: {e}')
    sys.exit(1)
"

echo -e "\n--- Checking goreleaser validation ---"
# Check if goreleaser can validate the config
if command -v goreleaser &> /dev/null; then
    goreleaser check --config .goreleaser.yml 2>&1 || true
else
    echo "goreleaser not installed, checking examples in the repo..."
fi

echo -e "\n--- Checking other goreleaser configs for indentation patterns ---"
# Search for other docker_manifests examples in the codebase
rg -A 5 "docker_manifests:" --type yaml 2>/dev/null | head -20 || true

echo -e "\n--- Checking GoReleaser documentation examples ---"
# Let's check if there are any other YAML files that might show the pattern
fd -e yml -e yaml | xargs grep -l "image_templates" 2>/dev/null || true

Length of output: 1849


@ghostdevv, you're right to question this! The current 8-space indentation is functionally valid - the YAML parses correctly and GoReleaser will process it without issues.

This is primarily a style consistency issue flagged by yamllint. While fixing it to 6 spaces would align with YAML best practices and satisfy linters, it's not breaking anything as-is.

Feel free to leave it if you prefer - it's working fine! The choice is yours whether to prioritize linter compliance or keep the current working configuration.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🔭 Outside diff range comments (3)
internal/app/handlers/handler_status.go (3)

112-112: Bug: wrong error variable logged.

Logs err instead of emErr, masking the real failure from GetEndpointModelMap.

-    a.logger.Warn("Failed to get model map", "error", err)
+    a.logger.Warn("Failed to get model map", "error", emErr)

149-151: Guard against division by zero when no endpoints are configured.

Avoids NaN/Inf and makes status classification explicit.

- healthyRatio := float64(len(healthy)) / float64(len(all))
+ var healthyRatio float64
+ if len(all) > 0 {
+     healthyRatio = float64(len(healthy)) / float64(len(all))
+ }

Optional: decide desired default status when len(all) == 0 (e.g. degraded) and set it explicitly.


93-94: Data race risk: global mutable issuesPool is shared across requests.

issuesPool is mutated per request; concurrent requests can race.

Make it local to the function:

- var issuesPool = make([]string, 0, 4)
+ // removed: use local slice in getEndpointIssues to avoid races
 func (a *Application) getEndpointIssues(endpoint *domain.Endpoint, stats ports.EndpointStats, hasStats bool, successRate float64) string {
-    issuesPool = issuesPool[:0]
+    issues := make([]string, 0, 4)

     if endpoint.ConsecutiveFailures > 3 {
-        issuesPool = append(issuesPool, "consecutive failures")
+        issues = append(issues, "consecutive failures")
     }

     if hasStats {
         if successRate < 90.0 && stats.TotalRequests > 10 {
-            issuesPool = append(issuesPool, "low success rate")
+            issues = append(issues, "low success rate")
         }
         if stats.AverageLatency > 5000 {
-            issuesPool = append(issuesPool, "high latency")
+            issues = append(issues, "high latency")
         }
     }

     if endpoint.Status == domain.StatusOffline || endpoint.Status == domain.StatusUnhealthy {
-        issuesPool = append(issuesPool, "unavailable")
+        issues = append(issues, "unavailable")
     }

-    if len(issuesPool) == 0 {
+    if len(issues) == 0 {
         return emptyString
     }

-    return strings.Join(issuesPool, ", ")
+    return strings.Join(issues, ", ")
 }

Also applies to: 258-283

🧹 Nitpick comments (2)
internal/app/handlers/handler_status.go (2)

8-8: Consider exposing GOOS alongside GOARCH for completeness.

Given the PR adds arm64 builds, returning both runtime.GOARCH and runtime.GOOS makes the status payload more informative.

If you want this, add an OS field and populate it:

// in SystemSummary
OS string `json:"os"`

// in buildSystemSummary return
OS: runtime.GOOS,

142-147: Sum total traffic across all endpoints, not just those with active connections.

Current logic can undercount traffic for endpoints with no current connections.

- for url, conn := range connections {
-     totalConnections += conn
-     if stats, exists := endpointStats[url]; exists {
-         totalTraffic += stats.TotalBytes
-     }
- }
+ for _, conn := range connections {
+     totalConnections += conn
+ }
+ for _, stats := range endpointStats {
+     totalTraffic += stats.TotalBytes
+ }
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 86768c3 and 7f66f19.

📒 Files selected for processing (2)
  • internal/app/handlers/handler_process.go (3 hunks)
  • internal/app/handlers/handler_status.go (3 hunks)
✅ Files skipped from review due to trivial changes (1)
  • internal/app/handlers/handler_process.go
🧰 Additional context used
📓 Path-based instructions (1)
internal/{app,adapter}/**/*.go

📄 CodeRabbit Inference Engine (CLAUDE.md)

Endpoints should be exposed at /internal/health and /internal/status.

Files:

  • internal/app/handlers/handler_status.go
🧠 Learnings (2)
📚 Learning: 2025-07-27T12:59:29.788Z
Learnt from: CR
PR: thushan/olla#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-27T12:59:29.788Z
Learning: Applies to internal/adapter/proxy/*.go : Expose the following response headers: `X-Olla-Endpoint`, `X-Olla-Model`, `X-Olla-Backend-Type`, `X-Olla-Request-ID`, `X-Olla-Response-Time`.

Applied to files:

  • internal/app/handlers/handler_status.go
📚 Learning: 2025-07-27T12:59:29.787Z
Learnt from: CR
PR: thushan/olla#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-27T12:59:29.787Z
Learning: Go version 1.24 or higher must be used.

Applied to files:

  • internal/app/handlers/handler_status.go
🧬 Code Graph Analysis (1)
internal/app/handlers/handler_status.go (1)
internal/version/version.go (1)
  • Version (18-18)
🔇 Additional comments (4)
internal/app/handlers/handler_status.go (4)

36-38: LGTM: Added fields are backwards compatible and clearly named.

Adding version and arch to the status schema is sensible and non-breaking.


169-171: LGTM: Correctly populates version and arch.

Values sourced from version.Version and runtime.GOARCH are appropriate for the new fields.


14-14: Version injection via ldflags is correctly configured

I’ve confirmed that your .goreleaser.yml includes the necessary -X flags to set version.Version, Commit, Date and User at build time, and internal/version/version.go defines a default Version = "v0.0.x" which will be overridden by those ldflags.

• .goreleaser.yml (lines 49–54):
-s -w
-X "github.com/thushan/olla/internal/version.Version=v{{.Version}}"
-X "github.com/thushan/olla/internal/version.Commit={{.Commit}}"
-X "github.com/thushan/olla/internal/version.Date={{.CommitDate}}"
-X "github.com/thushan/olla/internal/version.User=goreleaser"

• internal/version/version.go (line 18):
Version = "v0.0.x"

No further action required here.


95-129: Route mapping for /internal/status confirmed
The statusHandler is correctly registered to /internal/status in the routing setup—no further changes needed.

• internal/app/handlers/server_routes.go:32 –
a.routeRegistry.RegisterWithMethod("/internal/status", a.statusHandler, "Endpoint status", "GET")

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🔭 Outside diff range comments (1)
.github/workflows/ci.yml (1)

91-128: Install GNU Make on Windows runners or skip make-based targets

windows-latest doesn’t include make by default; the “Build and test native platform” step will fail on Windows.

Add a Windows-only step before invoking make:

   cross-platform:
     name: Cross-Platform Build Validation
     strategy:
       matrix:
         os: [ubuntu-latest, macos-latest, windows-latest]
     runs-on: ${{ matrix.os }}
     steps:
       - name: Checkout
         uses: actions/checkout@v4

       - name: Configure Go
         uses: actions/setup-go@v5
         with:
           go-version: ${{ env.GO_VERSION }}
           cache: true

+      - name: Install make on Windows
+        if: runner.os == 'Windows'
+        run: choco install make -y
+        shell: powershell
+
       - name: Build and test native platform
         run: |
           if [ "${{ runner.os }}" = "Linux" ]; then
             make validate-linux
           elif [ "${{ runner.os }}" = "macOS" ]; then
             make validate-darwin
           elif [ "${{ runner.os }}" = "Windows" ]; then
             make validate-windows
           fi
         shell: bash

Alternative: avoid make on Windows and run the equivalent go build commands inline. Happy to draft that if preferred.

🧹 Nitpick comments (2)
internal/version/version.go (1)

62-65: Clarify labels for OS/Arch and align consistently

“For/On” can be ambiguous. Recommend explicit labels “OS” and “Arch” for readability.

Apply this diff for clearer output:

-    b.WriteString(fmt.Sprintf("    For: %s\n", runtime.GOOS))
-    b.WriteString(fmt.Sprintf("     On: %s\n", runtime.GOARCH))
+    b.WriteString(fmt.Sprintf("    OS: %s\n", runtime.GOOS))
+    b.WriteString(fmt.Sprintf("  Arch: %s\n", runtime.GOARCH))

Optionally, for neat alignment irrespective of label length:

-    b.WriteString(fmt.Sprintf("    OS: %s\n", runtime.GOOS))
-    b.WriteString(fmt.Sprintf("  Arch: %s\n", runtime.GOARCH))
+    b.WriteString(fmt.Sprintf(" %6s: %s\n", "OS", runtime.GOOS))
+    b.WriteString(fmt.Sprintf(" %6s: %s\n", "Arch", runtime.GOARCH))
makefile (1)

279-283: Help text minor typo/alignment

Missing space after “validate-windows” breaks alignment.

-  @echo "  validate-windows- Build and test Windows binaries (AMD64 + ARM64)"
+  @echo "  validate-windows  - Build and test Windows binaries (AMD64 + ARM64)"
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7f66f19 and e94aefe.

📒 Files selected for processing (4)
  • .github/workflows/ci.yml (1 hunks)
  • internal/app/handlers/handler_status.go (3 hunks)
  • internal/version/version.go (2 hunks)
  • makefile (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/app/handlers/handler_status.go
🔇 Additional comments (2)
internal/version/version.go (1)

6-6: Importing runtime is appropriate here

Good addition to enable reporting of GOOS/GOARCH at runtime.

.github/workflows/ci.yml (1)

91-128: Cross-platform validation approach looks solid

Matrix across Ubuntu/macOS/Windows plus post-build version check aligns well with the new multi-arch build goals.

@thushan
Copy link
Owner

thushan commented Aug 9, 2025

okay, I've made some small changes to your awesome PR:

  • add build and runtime tests (just checks can it run --version) for builds (outside of Apple Silicon), in ci.yaml
  • adds some new targets in makefile to make it easier to manage
  • adds some new status bits for showing arch/os in APIs.
  • update the readme

Thoughts? I'll suss out the yaml issues coderabbit mentions tomorrow, about to board a flight home.

@ghostdevv ghostdevv changed the title feat: add arm64 docker builds feat: add arm64 docker builds and better cross platform support Aug 9, 2025
@ghostdevv
Copy link
Contributor Author

Sweet! I tweaked the pr title a bit, but I'm sure it could be refined further

adds some new status bits for showing arch/os in APIs.

I think this could be considered a bad practise considering it's volunteering potentially useful information to bad actors about the system and maybe versions (not sure what those fields contain)

SEE: https://owasp.org/www-project-web-security-testing-guide/latest/4-Web_Application_Security_Testing/01-Information_Gathering/02-Fingerprint_Web_Server

@thushan
Copy link
Owner

thushan commented Aug 10, 2025

I think this could be considered a bad practise considering it's volunteering potentially useful information to bad actors about the system and maybe versions (not sure what those fields contain)

Yes very much so, we usually block all /internal endpoints from being visible outside of localhost but not sure its wise to allow this by default. Will rethink this. We have it in the CLI version tag anyway.

There's a safety PR coming before next release that removes endpoints etc leftover, so I will review the rest there and tone this one down too. Good feedback thanks.

This reverts commit 08ceebe.

Revert "adds goos/version to status handlers"

This reverts commit 7f66f19.
Copy link
Owner

@thushan thushan left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for your contribution!

@thushan thushan merged commit 3110b40 into thushan:main Aug 11, 2025
6 checks passed
@ghostdevv ghostdevv deleted the arm64-docker branch August 12, 2025 08:02
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.

Docker 64-bit arm support

2 participants