<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Justyn on Medium]]></title>
        <description><![CDATA[Stories by Justyn on Medium]]></description>
        <link>https://medium.com/@justynroberts?source=rss-960f8ec74a3d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*BesNdYtb3pVCwBXELMtrMg.png</url>
            <title>Stories by Justyn on Medium</title>
            <link>https://medium.com/@justynroberts?source=rss-960f8ec74a3d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 16:43:49 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@justynroberts/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Saturday Project: The CYD as a PagerDuty Desktop Dashboard.]]></title>
            <link>https://medium.com/@justynroberts/saturday-project-the-cyd-as-a-pagerduty-desktop-dashboard-f6b3d30e9b21?source=rss-960f8ec74a3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f6b3d30e9b21</guid>
            <category><![CDATA[cyd]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[esp32]]></category>
            <dc:creator><![CDATA[Justyn]]></dc:creator>
            <pubDate>Sun, 10 May 2026 13:53:44 GMT</pubDate>
            <atom:updated>2026-05-10T16:20:53.638Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been meaning to spend a little time with the 3&quot; device affectionately known as the CYD (Cheap Yellow Device).</p><p>Continuing with the theme of Claude for tasks closer to hardware from last month, I wanted to build a small companion for PagerDuty Alerts, using the awesome API from <a href="https://developer.pagerduty.com/">https://developer.pagerduty.com/</a></p><p>A few ideas before I started writing code, and in my PRD, for my greatest developer companion, Claude :-</p><ul><li>Glanceable. Numbers big enough to read from across the room. If a high-urgency incident fires I should see it without focusing my eyes.</li><li>Touch, not buttons. A keyboard on a 320×240 screen is a non-starter, so any action has to be a tap or a swipe.</li><li>Self-contained setup. Drop a fresh device on a colleague’s desk → they paste a PagerDuty token via captive portal → it works. No re-flashing.</li><li>Stays running. Survives WiFi blips, doesn’t crash on a memory leak after a week, doesn’t need a watchdog reset every morning.</li></ul><p>All of those turned out to be harder than they sound on a chip with 320 KB of RAM.</p><h3>The hardware</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-HhFPONNgoPvEWY7fE7DFw.jpeg" /></figure><p>The board is the ESP32–2432S028R v2 — the USB-C revision with the ST7789 display driver. About £6–10 depending on where you buy. It’s notorious for poor color accuracy and worse documentation, but for a desk display it’s perfect.</p><p>Inside there’s an ESP32 with WiFi and Bluetooth, a 2.8&quot; 320×240 TFT, a resistive touch panel (XPT2046 on a separate SPI bus from the display), a tiny piezo, an LDR for ambient light, and a single RGB LED. P</p><p>The screen is not great. Off-axis viewing is dim, color shifts heavily, and the contrast ratio is mediocre. The first lesson was: design for the worst case. Body text at default #7A8A82 mid-gray on a near-black background was unreadable across the room. Bumping it to #B5C4BC made everything legible without losing the dark-mode aesthetic.</p><p>But I love it :)</p><h3>The stack</h3><p>(I’d already used a lot of this stack in my e-paper project, and built a MCP that handled PlatformIO)</p><ul><li>PlatformIO + Arduino-ESP32. ESP-IDF would give finer control but the LVGL + TFT_eSPI ecosystem assumes Arduino, and that’s a fight I didn’t want to pick.</li><li>LVGL 8.3.x for the UI. Pre-rendered bitmap fonts, dirty-region tracking, swipe gestures, the lot. Works inside 56 KB of memory with care.</li><li>TFT_eSPI for the display, configured entirely via build flags rather than the usual User_Setup.h voodoo.</li><li>A custom captive portal (originally WiFiManager — kept silently dropping form submissions on ESP32 Arduino 2.x; replaced it with ~100 lines of WebServer + DNSServer and never looked back).</li><li>PagerDuty REST API v2. Token in NVS, US/EU region selectable.</li></ul><p>The two cores actually matter here. WiFi and TLS handshakes can take 2–3 seconds, and you absolutely cannot block the UI for that long. So the WiFi/network code lives on core 0 as a FreeRTOS task, and LVGL runs on core 1. The two communicate through a couple of portMUX_TYPE-protected globals — strings get queued from core 0, the main loop drains them on core 1 and applies them to LVGL.</p><p>Without that split, every WiFi reconnect would freeze the screen.</p><h3>What it ended up looking like</h3><p>A captive portal, that i connect to with my phone, and set up my local wifi. After that point, it just sits on my network with no companion.<br>http://pagerduty.local (I love mDns, just makes this simpler)</p><figure><img alt="Captive Portal" src="https://cdn-images-1.medium.com/max/996/1*peoHy9N1Aqq-qW4XVfzptg.png" /></figure><p>Yeah yeah — I have the best Harry Potter pun for a Wifi APN ;)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*16qJ7j2ONWkQfKPZVcBRIw.jpeg" /></figure><p>Five rotating screens, auto-rotating every 10 seconds, swipeable, with tappable page dots at the bottom for direct navigation:</p><ol><li>Overview — the PagerDuty wordmark across the top, then two huge numeric cards: OPEN (red) and ACK (yellow). Tap either to drill into the filtered list. There’s a small ⚙ icon top-right that pops a Status screen with WiFi info, free heap, last poll, region.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1N3j6tyPLcBWvyQUInTiw.jpeg" /></figure><p>Incidents — scrollable list with severity badges as 24×24 PNGs, color-coded by status. Filter chips at the top for ALL / TRIG / ACK / SVC. Each chip change triggers a server-side narrowing of the API call so the response stays small no matter how many incidents you have open.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSHhbg1FAQP9N65gvJKEOA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eNpc0uHMVBPXH75okAxwnQ.jpeg" /></figure><p>Services — every service with open incidents, sorted by impact, color-coded by whether it has triggered or only acked issues. Tap a row to drill into Incidents filtered to that service.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iLz2vj1hMbkY6HwsiyfZyg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Yy37PxDfWUMkV3xfsHRww.jpeg" /></figure><p>On-Call — current on-call rotation across schedules, with level number and escalation policy.</p><p>Tap an incident → detail screen with title, service, responder, plus the full timeline pulled from /incidents/{id}/log_entries. Color-coded by event type. A big BACK button on the left, ACK on the right, no other actions to confuse anyone.</p><p>I have a ton of cases for the CYD on Makerworld, but still looking for something with a little style.<br>Might try my hand at some CAD design..</p><p>As always, this is available on my github. I’m always looking for collaborations on Hardware/Software/Music Projects..</p><p>Source: <a href="https://github.com/justynroberts/pagerduty-cyd">https://github.com/justynroberts/pagerduty-cyd</a></p><p>JR</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f6b3d30e9b21" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WiFi E-Paper Display in a few hours (And My Code Editor Never Saw a Web App)]]></title>
            <link>https://medium.com/@justynroberts/wifi-e-paper-display-in-a-few-hours-and-my-code-editor-never-saw-a-web-app-1b2badc70c73?source=rss-960f8ec74a3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b2badc70c73</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[esp32]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Justyn]]></dc:creator>
            <pubDate>Sat, 25 Apr 2026 20:28:24 GMT</pubDate>
            <atom:updated>2026-04-25T20:29:54.595Z</atom:updated>
            <content:encoded><![CDATA[<p>There’s a certain kind of project that lives in the back of your head for months.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDVQ2zNtqqJY6Nyfser1yA.jpeg" /></figure><p>Mine was an e-paper display sitting on my desk, showing me whatever I wanted — the time in three cities, a deployment countdown, a QR code for the office WiFi, or just a giant skull emoji when I’m in do-not-disturb mode.</p><p>I had the hardware. An ESP32-S3 dev board and a 4.2-inch black-and-white e-paper panel from WeAct, bought on impulse during a late-night AliExpress session. Total cost (about £20).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xP6WIuinciwWii86-lHCLQ.jpeg" /></figure><p>They’d been sitting in a drawer for weeks. The gap between “I have parts” and “I have a working thing” felt wide.</p><p>Then I sat down with Claude Code on a Saturday morning, and by Saturday afternoon I had a fully working device with a web UI, REST API, WiFi setup portal, and flicker-free partial refresh.</p><p>No soldering iron drama.</p><p>No three-hour debugging sessions staring at SPI timing diagrams.</p><p>Just a conversation.</p><h3>Claude Code is Not Just for Web Apps</h3><p>Most people don’t realise this about Claude Code: it’s not a React scaffold generator. It’s not a “make me a landing page” tool.</p><p>It works with whatever you’re building — including embedded C++ running on a microcontroller with 320KB of RAM.</p><p>My project involved:</p><p><strong><em>PlatformIO</em></strong><em> build configs for ESP32-S3</em></p><p><strong><em>GxEPD2 </em></strong><em>e-paper driver library with SPI pin mapping</em></p><p><strong><em>Raw pixel manipulation</em></strong><em> for 32x32 bitmap icons</em></p><p><strong><em>AsyncWebServer</em></strong><em> running on the ESP32 itself</em></p><p><strong><em>NVS flash storage</em></strong><em> for persisting WiFi credentials across reboots</em></p><p><strong><em>DNS server hijacking</em></strong><em> for a captive portal</em></p><p><strong><em>Partial refresh algorithms</em></strong><em> to avoid e-paper flicker</em></p><p>Not a `node_modules` folder in sight. And Claude Code handled all of it.</p><h3><strong>The Process: From Idea to Blinking Pixels</strong></h3><p><strong>Step 1: Get Something on the Screen</strong></p><p>I described what I had — an ESP32-S3, a 4.2&quot; e-paper display, and a list of GPIO pins from the datasheet. Claude Code set up the PlatformIO project, configured the SPI bus, initialized the display driver, and got “Hello World” rendering on the panel.</p><p>That took maybe ten minutes. The display refreshed, text appeared, Boom!</p><p>This is the critical moment in any hardware project — the point where it stops being “a circuit board and some wires” and starts being “a thing that does something.”</p><p><strong>Step 2: Make it Useful</strong></p><p>Next came the web server. The ESP32 runs a full async HTTP server on port 80, serving a dark-themed control panel with tabs for different display modes. Text, notifications, dashboards with widget grids, QR codes, weather layouts, countdown timers, emoji, image uploads, and eventually a live world clock.</p><p>Each feature followed the same pattern: I’d describe what I wanted, Claude Code would write the render function (calculating text bounds, positioning elements on a 400x300 pixel canvas), add the API endpoint, add the HTML/JS tab, and we’d compile and flash. `pio run -t upload`, wait 30 seconds, test it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DvFfjJa5hXmdaZBeOBcOlA.jpeg" /></figure><p>The web UI lives entirely in a PROGMEM string literal inside a header file. No build step, no bundler, no npm. Just raw HTML, CSS, and JavaScript served directly from the microcontroller’s flash memory. It’s around 12KB and it includes toast notifications, button loading spinners, collapsible curl command boxes, and a responsive mobile layout. Sometimes constraints produce better results than freedom.</p><p><strong>Step 3: Stop Hardcoding WiFi Credentials</strong></p><p>This is where the project went from “cool demo” to “something that starts to look like a actual product.” <br>Hardcoded WiFi credentials mean reflashing every time you change networks. Fine for development, not fine for something you want to hand to someone.</p><p>The WiFi manager was the most complex piece. On first boot (or after a reset), the device:</p><p>1. Creates an open access point named `EPaper-XXXX` (last four of the MAC address)</p><p>2. Starts a DNS server that redirects every domain to itself (captive portal)</p><p>3. Serves a setup page where you scan for networks, pick one, enter the password</p><p>4. Saves credentials to NVS (non-volatile storage that survives reboots and reflashes)</p><p>5. Reboots and connects to your actual WiFi</p><p>Android, iOS, and Windows all have captive portal detection. When you connect to the AP, a browser window pops up automatically. The setup page has signal strength bars, a lock icon for secured networks, and a spinner while it saves and reboots. It feels polished.</p><p>The e-paper display shows the AP name and IP address during setup, so you don’t need to guess where to connect. After setup, it shows the assigned IP and `epaper.local` via mDNS.</p><p>All of this — the DNS hijacking, the NVS read/write, the AP/station mode switching, the captive portal detection endpoints for three different operating systems — came together in a single header file. Claude Code knew the ESP32 Arduino APIs, the Preferences library, the DNSServer library. I didn’t have to look up a single function signature.</p><p><strong>Step 4: Fix the Flicker</strong></p><p>E-paper displays have a characteristic double-flash when they refresh. The panel inverts twice (black-white-black) to prevent ghosting. It’s fine for a Kindle turning pages, but jarring when a clock is updating every second.</p><p>The fix: partial refresh. Instead of the full inversion cycle, you just update the pixels that changed. GxEPD2 supports this — you call `setPartialWindow()` instead of `setFullWindow()`. The trade-off is that ghosting slowly accumulates, so you need an occasional full refresh to clean it up.</p><p>I set content updates to use partial refresh and scheduled a full refresh every 300 updates (about 5 minutes at 1 update/second). The clock now ticks smoothly with zero flicker. The countdown timer counts down in real seconds. And if ghosting builds up, hitting “Clear” forces a full refresh.</p><p>This is a good example of a decision that’s easy to describe but fiddly to implement. Every render function needed to be updated. The full refresh counter needed to be shared state. Boot screens needed to force full refresh regardless. Claude Code made all the changes across multiple files in one pass, and it compiled clean on the first try.</p><p><strong>Step 5: The World Clock</strong></p><p>By this point the pattern was established. “Add a clock with multiple timezones.”</p><p>Claude Code added the `ClockZone` struct, a render function that does a large primary time display with smaller secondary timezone columns, a web UI tab with timezone offset dropdowns (including half-hour zones like India and Nepal), the API endpoint, and the 1-second update loop. Compile, flash, done.</p><p>The clock shows the primary timezone large with the full date, up to three additional timezones in columns below with day-of-week, and a UTC reference in the footer. 12-hour and 24-hour formats. It looks genuinely good on the e-paper — high contrast black on white with clean typography.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wi2K-jzT_PIbajWBvtnNFA.png" /></figure><h3>What I Learned About Working with AI on Hardware</h3><p><strong>Describe the hardware once, reference it forever.</strong></p><p>I put the pin mapping, display dimensions, and driver model in a `CLAUDE.md` file at the project root. Every subsequent conversation started with that context already loaded. No re-explaining.</p><p><strong>The compile-flash-test cycle is your friend.</strong></p><p>After every significant change, `pio run -t upload` and check the serial output. Claude Code treated this the same way it treats `npm run build` — a validation step, not an afterthought.</p><p><strong>Embedded C++ is still C++.</strong>Claude Code didn’t struggle with PROGMEM, volatile variables, ISR-safe data structures, or any of the embedded-specific patterns. It knew that e-paper refresh takes 3.5 seconds and the watchdog timer needs to be extended.</p><p>It knew that `send_P` sends from program memory. It knew that AsyncWebServer body handlers need a specific lambda signature.</p><p><strong>The web UI is the easy part.</strong> I expected the HTML/CSS/JS to be straightforward and the embedded code to be hard. It was the opposite. The tricky parts were all on the display side — calculating text bounds for centered rendering, scaling bitmap icons, managing the partial/full refresh lifecycle. The web UI was just forms and fetch calls.</p><p><strong>Flash size matters more than you think</strong> The entire firmware including the web UI, captive portal, all icon bitmaps, and every display layout fits in 930KB of flash (29.6% of the 3MB partition). RAM usage is 21%. When you can’t `npm install` your way to a solution, code stays small.</p><h3>The Result</h3><p>A desk gadget that:</p><p>- Sets up its own WiFi on first boot via captive portal</p><p>- Serves a full control panel from the device itself (no cloud, no app)</p><p>- Accepts REST API calls for automation (hook it up to CI/CD, monitoring, home automation, whatever)</p><p>- Displays a live world clock with per-second updates and no flicker</p><p>- Runs indefinitely on USB power, no maintenance</p><p>Total time from “parts in a drawer” to “pushed to GitHub”: 5 hours</p><p>The repo is at <a href="https://github.com/fintonlabs/epaper">https://github.com/fintonlabs/epaper</a> if you want to build one yourself. You need an ESP32-S3 and a 4.2&quot; e-paper panel.</p><p>Eight wires. One USB cable. `pio run -t upload`.</p><p>Connect to the AP. Pick your WiFi. Done.</p><blockquote>Claude Code didn’t write software for me. It built a hardware product with me. The distinction matters.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KhRu7FNZlbIfPbGmIrMuYQ.jpeg" /></figure><p>I made every design decision — the captive portal flow, the partial refresh strategy, the world clock layout.</p><p>Claude Code turned those decisions into working C++ that compiled clean and ran correctly on a microcontroller. That’s the part that usually takes a weekend by itself, not the whole project.</p><p>If you’re sitting on a hardware idea because the firmware feels like too much work, this is your sign to start. The gap between “I have parts” and “I have a working thing” is a lot smaller than it used to be.</p><p>Get Building folks. Its exciting. 3D Printed case next….</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b2badc70c73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ GenAI AutoDocumentation assistant for Rundeck]]></title>
            <link>https://medium.com/@justynroberts/genai-autodocumentation-assistant-for-rundeck-ce72b4dcd2d1?source=rss-960f8ec74a3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce72b4dcd2d1</guid>
            <category><![CDATA[rundeck]]></category>
            <dc:creator><![CDATA[Justyn]]></dc:creator>
            <pubDate>Tue, 16 Jul 2024 15:48:43 GMT</pubDate>
            <atom:updated>2024-07-16T15:48:43.756Z</atom:updated>
            <content:encoded><![CDATA[<h3>An experiment to standardize and shorten the worst part of automation development.</h3><h3>The Documentation Dilemma</h3><p>In my last 3 years working with Rundeck/PagerDuty Automation, one thread that annoyed me particularly is that you CAN build amazing markdown in Rundeck, but well, <strong>who has time for that</strong>?<br>This experiment came from a existing customer wanting to add disclaimers to all of their jobs, and copying Jobs directly to confluence.</p><p>This is the code I sent as a “starter” for this process.</p><p>It covers the basics for you to build upon:</p><h3>What is the GenAI AutoDocumentation?</h3><p>At its core, the GenAI AutoDocumentation is a Rundeck job that harnesses the power of OpenAI’s GPT models to generate comprehensive, accurate documentation for your Rundeck jobs. Here’s what it does:</p><ol><li>Fetches job definitions directly from your Rundeck server</li><li>Generates new documentation based on the job definition using OpenAI</li><li>Updates the job’s description in Rundeck with the freshly generated content</li><li>Optionally uploads the documentation to Confluence for centralized access</li></ol><h3>Key Features</h3><ul><li><strong>Automatic Documentation Generation</strong>: Leverage OpenAI’s advanced language models to create detailed, context-aware documentation.</li><li><strong>Seamless Rundeck Integration</strong>: Easily fetch and update job definitions within your existing Rundeck environment.</li><li><strong>Confluence Integration</strong>: Optionally store your documentation in Confluence for improved accessibility and organization.</li><li><strong>Customizable AI Model</strong>: Choose the OpenAI model that best fits your needs and budget.</li></ul><h3>Getting Started</h3><p>To start using the GenAI Documentation Assistant, you’ll need:</p><ul><li>An active Rundeck/RBA/PAOP instance</li><li>A valid OpenAI API token (But it wouldnt be hard to convert to an openLLM)</li><li>Python environment with requests and openai libraries</li><li>(Optional) Confluence access for documentation uploads</li></ul><p>Setup is straightforward:</p><ol><li>Import the provided JSON file into your Rundeck instance.</li><li>Configure the job options according to your environment.</li><li>Ensure your Rundeck server has the necessary Python environment and libraries.</li></ol><h3>How It Works</h3><p>Using the GenAI AutoDocumentation is as simple as:</p><ol><li>Navigate to the job in your Rundeck instance.</li><li>Fill in the required options, including the Job UUID and necessary API tokens.</li><li>Some options are hidden options</li><li>Run the job.</li></ol><p>The assistant will then work its magic, fetching the job definition, generating new documentation, updating Rundeck, and optionally uploading to Confluence.</p><p>Lets Analyze a Self Service Job:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hb71WqR0lBZFDt2hT8qHWw.png" /><figcaption>Before</figcaption></figure><p>Take the Job ID</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*8vqm5hZk9Gl95U5OPDG7Bw.png" /></figure><p>Add the ID in the Documentation Job</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JmnEXERHdv6b7S7JxTFrUQ.png" /></figure><p>A few seconds later:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*UwUysjKxMTu9aHvMiPJsDQ.png" /></figure><p>Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*Wd0zgyhCeHDZniuIoL4Inw.png" /></figure><p>It offers a great starter for well formatted documentation as well as offering the capability to upload to confluence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*KOuTk6nPpK0Mb01Qxz-xzQ.png" /><figcaption>Confluence Sample</figcaption></figure><h3>The Benefits</h3><p>By implementing the GenAI AutoDocumentation, you can:</p><ul><li><strong>Save Time</strong>: Automate a traditionally time-consuming task. At least some of the time, if not all of it</li><li><strong>Improve Accuracy</strong>: Ensure your documentation always reflects the current state of your jobs.</li><li><strong>Enhance Collaboration</strong>: With up-to-date docs, team members can quickly understand and work with any job.</li><li><strong>Reduce Errors</strong>: Clear, current documentation minimizes the risk of operational mistakes.</li></ul><p>There are tons of chances to improve this, and I look foreward to seeing your enhancements.</p><h3>Conclusion</h3><p>Code available here <a href="https://github.com/justynroberts/OpenAIdocumentation">https://github.com/justynroberts/OpenAIdocumentation</a></p><p>Code Supplied as is, not official by PagerDuty or Rundeck. Its not that complex anyway :)</p><p>Give it a try, it was a fun and useful experiment. Enjoy and iterate!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce72b4dcd2d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Adding a Brain to Rundeck with ChatGPT]]></title>
            <link>https://medium.com/@justynroberts/adding-a-brain-to-rundeck-with-chatgpt-cae6a4829746?source=rss-960f8ec74a3d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cae6a4829746</guid>
            <category><![CDATA[pagerduty]]></category>
            <category><![CDATA[rundeck]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Justyn]]></dc:creator>
            <pubDate>Wed, 05 Apr 2023 09:58:45 GMT</pubDate>
            <atom:updated>2023-04-05T12:47:22.806Z</atom:updated>
            <content:encoded><![CDATA[<h4>🧪A Saturday afternoon experiment 🧪</h4><p>I often describe PagerDuty Operations Cloud as the action engine for signals :-</p><h4>👂🏻<strong>Listen (To incoming information),</strong></h4><h4>🧠 <strong>Think (Reduce Noise, Contextualise)</strong></h4><h4>💪🏻 <strong>Action (Enable or implement people and process)</strong></h4><p>Process Automation (Still available as <a href="https://www.rundeck.com/">Rundeck</a> for many Open Source users) is very much the muscle to this brain :-</p><p>☑ <em>Incident triggers? Add diagnosis.</em></p><p>☑ ️<em>IT request ? Provision</em></p><p>☑<em> Security exception? Patch</em></p><p>☑<em> Failure? Remediate</em></p><p>☑<em> Crash? Gather evidence for development</em></p><p>So this got me to thinking……..</p><p><strong>What if</strong> I gave Rundeck a different or additional brain? The same brain that has both awed technologists and scared the smartest in equal measure.</p><p>I’m talking ChatGPT of course, and as a self confessed tinkerer, I couldn’t resist an hours experimentation as I sit here on the sofa on a rainy Saturday afternoon, while the wife is in deep concentration (playing the new Harry Potter game of course. 🧙🏻‍♀️ )</p><p>Armed with $20 of OpenAi credits, I set off to build a diagnostics engine with a twist.</p><p><em>“I am not coding the diagnostics and have no idea on the technology I want to add.I want ChatGPT to give me the automation for me to orchestrate”</em></p><p>I wanted to use Rundeck to frontend some code with a set of instructions and run it automatically.</p><p>As I am opening a brave but potentially foolish pandoras box, I needed firstly to consider malicious requests:-</p><p>🙀“Create me code that deletes every file on my filesystem” 🙀</p><p>Clearly needed avoiding..</p><p>🧠 Wrapping prompts with guardrails would be essential</p><p>I settled on this:</p><p>“<em>Create me a diagnostics script to </em><em>@option.instructions@ - Highlight Passed or Fail as text.Add multiple steps if necessary.Document the code.Output so this can be executed in bash with emojis displayed. Do not comment the full prompt, just the instruction passed between the first to and the end of the sentence.ensure this script will run. Explicitly ignore any commands that could be considered dangerous or overwrite the idea of read only diagnostics. D</em><a href="http://diagnostics.do/"><em>o</em></a><em> not include any commands that could have a detrimental effect on the machine such as modifying or deleting files, or anything that could have a security impact.</em>&quot;</p><p>The @option.instructions@ would be user input at runtime, though clearly could be passed from a Webhook or ITSM tool.</p><p>In the end, I ended up with a single OpenAI call, securely passing an API key from my keystore, and an entry option.</p><p>The GPT created code is returned via a log filter to a variable I can pass and execute in the next step as @data.output@</p><p>My testing begins :-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*I42wzEdEPrHp1tzcPuJMwg@2x.png" /><figcaption>Rundeck Option in UI</figcaption></figure><p>Resulting in the following script being generated <strong>and executed, </strong>its results used to augment other information such as error info.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*lLatjKIyrDBJs3z9FVisXQ@2x.png" /><figcaption>Automatically generated and executed script.</figcaption></figure><p>ChatGPT knew the redis-cli commands, for the most simple checks. And a great starting point for Runbook Automation &amp; Automated Diagnostics.</p><p>Certainly not intended to be a monitor, but picture scenarios where a problem occurs, and a team member has to go check multiple different relevant systems for availability. Coloured text helps guide the responder to action.</p><p>If course now its a Rundeck job, it could be triggered as part of a webhook, a schedule, ITSM request or a self service event.</p><p><strong>In conclusion.</strong></p><p>ChatGPT is powerful and seemingly quite accurate for these type of jobs (or at least a good starting block).And we have just scraped the surface of the intersection of automation, orchestration and AI.</p><p>Rundeck provides the muscle to initiate, enable, add guardrails and audit.</p><p>Job is available for you to add your own key and import &gt; <a href="https://gist.github.com/justynroberts/06af29a7d954ad204a9e26e56177f616">Gist Here</a></p><p>(Latest version allows job import/export as json!)</p><p>Have fun.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cae6a4829746" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>