Skip to content

fix(paperclip): bind to 0.0.0.0 on kyber to fix k3s ingress 502 - #1507

Merged
shunkakinoki merged 9 commits into
mainfrom
twinkly-dazzling-stroustrup
Apr 19, 2026
Merged

fix(paperclip): bind to 0.0.0.0 on kyber to fix k3s ingress 502#1507
shunkakinoki merged 9 commits into
mainfrom
twinkly-dazzling-stroustrup

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Apr 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Paperclip was returning 502 at paperclip.shunkakinoki.com because it bound to 127.0.0.1:3100 while the k3s nginx ingress routes via 172.17.0.1 (Docker bridge)
  • Changed bind address to 0.0.0.0 on kyber in both the config hydration template and the systemd service environment
  • Local (non-kyber) hosts remain bound to 127.0.0.1

Test plan

  • Deploy via home-manager switch
  • systemctl --user restart paperclip
  • Verify paperclip.shunkakinoki.com returns 200

shunkakinoki and others added 5 commits April 18, 2026 10:13
…lures

- Extract inline writeShellScript in secure-dotenv to external .sh file
- Fix nixfmt drift in ollama/default.nix (multi-line args)
- Fix shfmt drift in clipboard_copy_spec.sh (here-string spacing)
- Switch Docker cache from GHA to registry-based to avoid auth timeout
…r reinfection

Postgres container was compromised via public 0.0.0.0:5432 binding with trust auth.
Invert the enable condition so docker-postgres only runs on galactica and matic.
@mesa-dot-dev

mesa-dot-dev Bot commented Apr 18, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Apr 18, 2026

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Fixed configuration file handling to dynamically substitute home directory paths instead of hardcoded values.
  • Chores

    • Updated system username configuration across deployments.
    • Reconfigured Paperclip service network binding to listen on all available network interfaces for Kyber deployments, replacing localhost-only access.

Walkthrough

This PR updates the Kyber host configuration to use username "shunkakinoki" instead of "ubuntu" across multiple files, updates the Paperclip service network binding to 0.0.0.0 on Kyber, and refactors the mempalace configuration to use dynamic path substitution via __HOME_DIR__ placeholder.

Changes

Cohort / File(s) Summary
Username Configuration
flake.nix, named-hosts/kyber/default.nix
Updated Kyber host username from "ubuntu" to "shunkakinoki" across flake configuration and host definition.
Mempalace Configuration
config/mempalace/default.nix, config/mempalace/config.json
Enabled dynamic path resolution by changing module parameter to { config, ... }, renaming palace to palace_path, and implementing __HOME_DIR__ placeholder substitution at evaluation time to replace hardcoded paths.
Paperclip Network Binding
config/paperclip/default.nix, home-manager/services/paperclip/default.nix
Updated Paperclip service to bind to 0.0.0.0 instead of 127.0.0.1 on Kyber systems, affecting both configuration generation and systemd service environment.

Possibly related PRs

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 A kyber hops with new identity true,
From ubuntu's path to shunkakinoki's debut,
Placeholders dance where hardcodes once stood,
Paperclip listens to all as it should! 🎉

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title 'fix(paperclip): bind to 0.0.0.0 on kyber to fix k3s ingress 502' directly addresses the paperclip binding fix, but the PR includes significant additional changes (username change, MemPalace config, secure-dotenv extraction, Docker cache switch, docker-postgres disabling) that are not reflected in the title. Update the title to reflect the primary change (username update from ubuntu to shunkakinoki) or use a more comprehensive title covering the major refactors included in this PR.
Description check ⚠️ Warning The description focuses exclusively on the paperclip 502 fix and k3s ingress binding issue, but the PR summary indicates this PR primarily changes the kyber username from 'ubuntu' to 'shunkakinoki' with multiple related refactors (secure-dotenv extraction, MemPalace hydration, Docker cache, docker-postgres disabling). Update the description to cover the primary objective (username change) and mention other significant changes (secure-dotenv extraction, MemPalace fix, Docker cache switch, docker-postgres disabling).
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch twinkly-dazzling-stroustrup

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@mesa-dot-dev

mesa-dot-dev Bot commented Apr 18, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Switch kyber host user from ubuntu to shunkakinoki, harden .env handling, and fix MemPalace path hydration. CI is more reliable, and docker-postgres now runs only on galactica/matic.

What changed?

  • flake.nix: The username for the 'kyber' host configuration has been updated from "ubuntu" to "shunkakinoki".
  • named-hosts/kyber/default.nix: The default username for the Kyber server configuration has been updated from "ubuntu" to "shunkakinoki".
  • config/mempalace/config.json: Renamed the 'palace' key to 'palace_path' and modified its value to use the __HOME_DIR__ placeholder.
  • config/mempalace/default.nix: Dynamically processes config.json by reading its content, replacing the __HOME_DIR__ placeholder with the NixOS configured home directory path.
  • Refactor secure-dotenv: Extracted secure-dotenv into home-manager/modules/secure-dotenv/secure-dotenv.sh using pkgs.replaceVars, along with new spec/secure_dotenv_spec.sh and coverage checks.
  • CI Enhancement: Switched Docker build cache to registry in .github/workflows/docker.yml to mitigate GHA authentication timeouts.
  • Deployment Security: Inverted docker-postgres enablement to run only on galactica and matic to prevent unwanted exposure.

Description generated by Mesa. Update settings

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

Copy link
Copy Markdown
Contributor

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 refactors the secure-dotenv module by externalizing its logic into a dedicated shell script and adding comprehensive tests. It also updates the default username for the kyber host and modifies the activation logic for the PostgreSQL service. Feedback identifies a potential logic inversion in the PostgreSQL service configuration and suggests improving the robustness of the secure-dotenv script by using null delimiters to handle filenames with special characters.

I am having trouble creating individual review comments. Click here to see my feedback.

home-manager/services/docker-postgres/default.nix (9)

high

The logic for enabled has been completely inverted from !(isGalactica || isMatic) to isGalactica || isMatic. This change is not mentioned in the PR description and will result in the service being disabled on kyber (and other hosts that are not Galactica or Matic). Please confirm if this was intentional or a regression.

home-manager/modules/secure-dotenv/secure-dotenv.sh (7-10)

medium

To robustly handle filenames that might contain special characters or newlines, it is recommended to use -print0 with find and read -d ''. This is a safer way to parse command output in shell scripts and aligns with the general rule regarding robust parsing.

@find@ "${HOME_DIR}" \
  -maxdepth 4 \
  \( -name '.env' -o -name '.env.*' -o -name '*.env' \) \
  -print0 2>/dev/null | while IFS= read -r -d '' f; do
References
  1. To robustly parse command output in shell scripts, use a unique delimiter (e.g., tab) in the format string and read with a matching IFS. This is safer than splitting by spaces with cut, especially when data fields might contain spaces.

MemPalace reads `palace_path` from config but the key was `palace`,
causing all writes to go to the default ~/.mempalace/palace instead
of the wiki repo. Switch to template-based hydration using
builtins.replaceStrings to make the path portable across devices.
Paperclip was binding to 127.0.0.1 but the k3s nginx ingress routes
via 172.17.0.1 (Docker bridge), causing connection refused errors.
@shunkakinoki shunkakinoki changed the title fix(kyber): change username from ubuntu to shunkakinoki fix(paperclip): bind to 0.0.0.0 on kyber to fix k3s ingress 502 Apr 19, 2026
@shunkakinoki
shunkakinoki merged commit 53e10a8 into main Apr 19, 2026
26 of 30 checks passed
@shunkakinoki
shunkakinoki deleted the twinkly-dazzling-stroustrup branch April 19, 2026 11:21
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.

1 participant