<?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 Nil Borodulia on Medium]]></title>
        <description><![CDATA[Stories by Nil Borodulia on Medium]]></description>
        <link>https://medium.com/@brdnlsrg?source=rss-4c610c90bf37------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YAgcpMYI6l2_jdBRNarezg.png</url>
            <title>Stories by Nil Borodulia on Medium</title>
            <link>https://medium.com/@brdnlsrg?source=rss-4c610c90bf37------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 04:17:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@brdnlsrg/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[Don’t Let AI Take the Wheel]]></title>
            <link>https://medium.com/@brdnlsrg/dont-let-ai-take-the-wheel-9d804c31106b?source=rss-4c610c90bf37------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d804c31106b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Nil Borodulia]]></dc:creator>
            <pubDate>Fri, 20 Mar 2026 13:49:21 GMT</pubDate>
            <atom:updated>2026-03-20T13:49:21.284Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="vibecoding" src="https://cdn-images-1.medium.com/max/1024/1*Vy9MuyLnRjb7SLPY2NXS0g.jpeg" /></figure><h3><strong>Introduction</strong></h3><p>Vibecoding is having a moment — and for good reason. AI can catch mistakes that we as developers might easily miss. But if you stop paying attention to what’s actually accumulating in your repository, you’ll end up with a pile of working code that nobody can maintain — including you. I want to talk about how to keep vibecoding under control, so your project doesn’t turn into chaos. How do you make working with AI genuinely better, not just faster?</p><p>I’ve noticed a pattern: everyone who starts vibecoding goes through the same stages. First comes the euphoria — AI generates code, everything compiles, features ship instantly, and it all just works. Then comes the creeping chaos — the code is there, but you’re no longer quite sure why half of it exists or how it fits together. And finally, if you don’t catch yourself in time — the classic swamp you can’t crawl out of.</p><p>I’ve been through it myself. Here’s what helped me stay afloat.</p><p>Vibecoding isn’t a problem or a danger in itself. It’s a tool with very sharp edges. On one side, it gives you incredible speed. On the other, you can miss the moment when your project became a black box that only the AI understands. Maybe that’s where things are headed eventually — but right now, developers still need to stay on top of what’s happening in their own codebases.</p><h3><strong>The Rules I Live By</strong></h3><h4><strong>Start with yourself, not the prompt</strong></h4><p>Before you open a chat — try to explain the service’s architecture in your own words. If you can’t, AI isn’t your savior here. It’ll just get you to chaos faster.</p><blockquote><em>”Programs must be written for people to read, and only incidentally for machines to execute.</em></blockquote><blockquote>— Harold Abelson, SICP</blockquote><p>That was written long before LLMs existed, but it’s never been more relevant. If the code is clear to a human — it’s clear to AI, to your teammates, and to yourself three months from now.</p><p>Before asking AI to write any code, ask it to make a plan first. Just say: `”don’t write any code yet, start by creating a plan”`. That way you walk through the architecture and patterns step by step before a single line of code appears. For complex tasks, you can even spin up multiple agents, each exploring the problem from a different angle. Once the plan is solid and you understand the mechanics — then you write code.</p><h4><strong>Stick to the language you actually know</strong></h4><p>Write in the language where you’re a genuine expert. Not because new languages are bad — but because when something goes wrong (and it will), you need to be able to debug it by hand. Without AI, just by reading the logs. If you can’t do that, the project effectively doesn’t answer to you.</p><p>Example: you have a new task, your main language is Go or PHP, but you want to build a new service in Rust because it’s trendy right now. If you’ve never written Rust before, you probably don’t know the debugging and deployment pitfalls. You’ll ship a cool service — but nobody except the AI will understand it. Then there’s a bug in production. What do you do? Stick to the language where you’re the expert, or at least know the syntax well.</p><h4><strong>Context is your most valuable currency</strong></h4><p>LLMs work beautifully when they have good context. And poorly when they don’t — or when it’s stale. So one of my non-negotiable rules: `CLAUDE.md` or `AGENTS.md` is not optional. It’s the first thing you write — by hand or with AI’s help.</p><p>What belongs in there:</p><ul><li>Architecture and key modules</li><li>Which patterns are used (and why)</li><li>What’s off-limits (e.g., don’t generate new abstractions without review)</li><li>Stack and dependency versions</li><li>Where tests live and how to run them</li></ul><p>Without this, AI is guessing. And guesses in code are expensive.</p><h4><strong>Linters and analyzers — not a suggestion, a requirement</strong></h4><p>I won’t spend long on this one. Set it up and forget it. The more the better. Let them catch what AI dashed off in a hurry. The key is running them in CI, not just locally — because locally you can forget, but CI won’t let you merge without a green check.</p><p>One thing worth watching: when AI fixes a linter error, check whether it actually fixed the problem or just suppressed the rule. Those are very different things.</p><h4><strong>Comments: less is more</strong></h4><p>LLMs have a stubborn habit of commenting every function, every parameter, every return statement. The result is three lines of explanation for every one line of code. That’s not documentation — that’s noise.</p><p>Robert Martin wrote about this in Clean Code, and it’s only become more relevant since AI entered the picture:</p><blockquote><em>“Every time you write a comment, you should grimace and feel the failure of your ability of expression.”</em></blockquote><blockquote>— Robert C. Martin</blockquote><p>Harsh, but accurate. A comment is an admission that the code doesn’t explain itself. Sometimes that’s justified — but most of the time, renaming the function or variable is better than explaining what it does.</p><p>A good comment explains WHY, not WHAT. <em>// workaround for Safari 16 bug</em>` — useful. <em>// returns the sum of numbers</em> — delete it immediately.</p><p>Tell your LLM: comments only where the logic isn’t obvious or where there’s important context. Everything else is clutter.</p><h4><strong>Tests: make sure AI isn’t playing against you</strong></h4><p>This is one of the sneakiest traps. AI can write a test that passes — but not a test that verifies correct behavior. It might:</p><ul><li>Hardcode the expected result instead of computing it</li><li>Mock so aggressively that the test doesn’t test anything at all</li><li>Delete assertions that were getting in the way of passing</li></ul><p>Michael Feathers put it simply in <strong>Working Effectively with Legacy Code</strong>:</p><blockquote><em>”Code without tests is legacy code.”</em></blockquote><blockquote>— Michael Feathers</blockquote><p>With AI, this problem has gotten sharper — code appears fast, and tests either don’t get written at all, or get written just to check a box.</p><p>My rule: read the tests AI wrote just as carefully as the business logic. Better yet — write the test cases yourself (even just as comments) and let AI implement them.</p><h4><strong>The illusion of quality</strong></h4><figure><img alt="illusion" src="https://cdn-images-1.medium.com/max/1024/1*4SCv1-VCZohaFWdBj-Pf1A.jpeg" /></figure><p>The code looks clean. The PR looks good. That doesn’t mean it’s correct. AI is confident in its answers even when it’s wrong — and that confidence is contagious. You read nice-looking code and think: yeah, this is fine.</p><p>Fine — until the first edge case in production.</p><p>Brian Kernighan, one of the authors of C and co-creator of Unix, once wrote what I think is the most honest observation about programming:</p><blockquote><em>”Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”</em></blockquote><blockquote>— Brian Kernighan</blockquote><p>Now imagine “as cleverly as possible” isn’t you — it’s AI. There’s your problem.</p><p>Check the logic at the edges. What happens when the list is empty? When the string contains an emoji? When there’s a timeout? AI rarely thinks about edge cases unless you explicitly ask.</p><h4><strong>Drift between code and documentation</strong></h4><p>Fast vibecoding creates one specific problem — the documentation and the code start to diverge. You updated the logic, but `CLAUDE.md` still describes the old architecture. AI reads the stale context and generates solutions based on outdated information. This is invisible technical debt.</p><p>Make it a habit: if you changed something significant, update the context file immediately. It takes a minute and saves hours.</p><h4><strong>Secrets and credentials — a separate conversation</strong></h4><p>Never, not once, under any circumstances — paste production keys, tokens, or passwords into a prompt. Not to “just take a look.” Not into a local chat. Not even when you’re sure it’s fine.</p><p>Use environment variables, `.env.example` without real values, and if you need to show AI the structure — mask it: ‘<em>sk-***…’</em>. This isn’t paranoia — it’s basic security hygiene.</p><p>One more thing people underestimate: the model may train on your data. There’s a real, if unlikely, risk that your key could surface in someone else’s completely unrelated conversation. It’s improbable — but possible. Is it worth it?</p><h4><strong>Small commits and git as a safety net</strong></h4><p>Another habit that saves you: make small, atomic commits with clear messages. Not ‘<em>wip’</em>, not ‘<em>fix stuff’</em> — something specific. When AI goes off the rails, you can roll back to a clean state without drama. A massive commit touching 40 files is already a problem.</p><h4><strong>Pre-session checklist</strong></h4><p>Before any serious vibecoding session, I ask myself:</p><ul><li>Can I explain this service’s architecture in my own words — without AI?</li><li>Did I ask AI to make a plan before writing any code?</li><li>Is ‘CLAUDE.md’ / ‘AGENTS.md’ up to date?</li><li>Is CI set up with linters and tests?</li><li>Do I have a specific task — not “improve the code”, but a clear what and why?</li><li>Did I tell AI to skip unnecessary comments?</li><li>Will I actually read the tests after changes — and do they test real behavior, not just pass?</li><li>Is there anything sensitive in my clipboard?</li><li>Is there a git checkpoint before I start?</li></ul><h3><strong>Conclusion</strong></h3><figure><img alt="vibecoding" src="https://cdn-images-1.medium.com/max/1024/1*GrLp5qBg8euPDniOEF598g.jpeg" /></figure><p>Vibecoding isn’t going away. If anything, it’s going to get faster and more powerful. But the stronger the tool, the more important it is to understand when and how to use it.</p><p>The core thing I’ve taken away from my own experience: AI is not an autopilot — it’s an amplifier. It amplifies your good decisions and your mistakes in equal measure. If you know what you’re building and keep your processes in order, it gives you superpowers. If you don’t, it just gets you to chaos faster.</p><p>Keep the architecture in your head and in your docs. Write in the language you know. Don’t trust code you don’t understand. And remember: you’re still the one responsible for the project — not the chat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d804c31106b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MeetingReminder — I built a macOS app without knowing SwiftUI]]></title>
            <link>https://medium.com/@brdnlsrg/meetingreminder-i-built-a-macos-app-without-knowing-swiftui-4c04f9efc11f?source=rss-4c610c90bf37------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c04f9efc11f</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[swift]]></category>
            <dc:creator><![CDATA[Nil Borodulia]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 09:13:38 GMT</pubDate>
            <atom:updated>2026-03-16T09:13:38.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5l00gFTSiCZI4MmDOn1dgg.jpeg" /></figure><h4><strong>Background</strong></h4><p>For a long time I used a paid app that locked the screen before meetings. You open your laptop and there it is: “meeting in one minute”. Handy. But at some point I asked myself — what’s actually inside? Calendar sync and an NSPanel sitting on top of everything. Is that really worth a subscription?</p><p>My stack is PHP and Go. I had never touched SwiftUI. Not once. But I thought: for a utility that only I need — why not try? The worst case was spending an evening and getting nothing.</p><p>It worked. In one evening, together with Claude Code, we built a fully functional app with themes, Zoom/Meet/Teams support, tests, and a menu bar icon.</p><h4><strong>How it started</strong></h4><p>usually follow a rule: write in the language you know, because when things go wrong you need to be able to debug without AI, just by opening the logs. But this was a special case — I didn’t need to maintain a large service. I needed a small personal utility. So I decided to break my own rule and see what happens.</p><p>Before writing the first line of code — I asked Claude to make a plan. No code, just architecture: what components are needed, how they interact, where to store state. It looked roughly like this:</p><pre>CalendarService → MeetingMonitor → OverlayWindowController<br>     ↑                                        ↓<br>  EventKit                             NSPanel (screen saver level)</pre><p>Simple data flow, clear separation of concerns. Only after I understood the architecture did we start writing code.</p><h4><strong>Gotchas</strong></h4><p><strong>NSPanel vs SwiftUI windows</strong></p><p>The first and biggest stumbling block — the full-screen overlay. It sounds simple: just show a window. But macOS really doesn’t like it when something tries to capture the screen without permission. Standard SwiftUI windows can’t sit on top of everything. The solution — `NSPanel` with `.screenSaver` level and the right collection behaviors:</p><pre>let panel = NSPanel(<br>    contentRect: screen.frame,<br>    styleMask: [.borderless, .nonactivatingPanel],<br>    backing: .buffered,<br>    defer: false<br>)<br><br>panel.level = .screenSaver<br>panel.collectionBehavior = [.canJoinAllSpaces, .fullScreenAuxiliary]<br>panel.isOpaque = false<br>panel.backgroundColor = .clear<br>panel.hidesOnDeactivate = false<br><br>panel.orderFrontRegardless()<br>panel.makeKey()<br>NSApp.activate(ignoringOtherApps: true)</pre><p>The key part — <em>.canJoinAllSpaces</em> lets the panel appear on all Spaces, not just the current one. Without it the overlay would only show on whichever desktop you happen to be on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e30bEI49t9KRR985ml4RHg.png" /><figcaption>lock screen</figcaption></figure><p><strong>EventKit and event filtering</strong></p><p>The second gotcha — raw EventKit returns everything, including all-day events and meetings you declined. Without filtering, you’d get reminders for a colleague’s birthday and meetings you already said no to.</p><pre>let ekEvents = eventStore.events(matching: predicate)<br><br>events = ekEvents<br>    .filter { event in<br>        // No all-day events<br>        guard !event.isAllDay else { return false }<br><br>        // No declined meetings<br>        if let attendees = event.attendees,<br>           let me = attendees.first(where: { $0.isCurrentUser }),<br>           me.participantStatus == .declined {<br>            return false<br>        }<br><br>        return true<br>    }</pre><p><strong>@MainActor and timers</strong></p><p>Third — Swift Concurrency. `CalendarService` and `MeetingMonitor` are marked `@MainActor`, but timers run on their own thread. Without an explicit `Task { @MainActor in … }` wrapper around updates — the compiler either complains or you get a runtime race condition. Coming from Go this concept is familiar, but in SwiftUI it looks a bit different:</p><pre>refreshTimer = Timer.scheduledTimer(withTimeInterval: 300, repeats: true) { [weak self] _ in<br>    Task { @MainActor in<br>        self?.fetchEvents()<br>    }<br>}</pre><h4><strong>What we ended up with</strong></h4><p>The app lives in the menu bar and doesn’t take up space in the Dock. Every 30 seconds it checks whether there’s a meeting coming up within N minutes (1/2/5/10 — configurable). If there is — a full-screen overlay appears on all connected monitors with a live countdown.</p><p>The overlay automatically detects video call links via regex — Zoom, Google Meet, Teams, Webex, Slack Huddle. If found — it shows a “Join” button right on the overlay:</p><pre>private static let patterns: [(name: String, pattern: String)] = [<br>    (&quot;Zoom&quot;,           #&quot;https?://[\w.-]*zoom\.us/j/\S+&quot;#),<br>    (&quot;Google Meet&quot;,    #&quot;https?://meet\.google\.com/[a-z]+-[a-z]+-[a-z]+\S*&quot;#),<br>    (&quot;Microsoft Teams&quot;,#&quot;https?://teams\.microsoft\.com/l/meetup-join/\S+&quot;#),<br>    (&quot;Webex&quot;,          #&quot;https?://[\w.-]*webex\.com/\S+&quot;#),<br>    (&quot;Slack Huddle&quot;,   #&quot;https?://app\.slack\.com/huddle/\S+&quot;#),<br>]</pre><p>And nine overlay themes — from plain Dark to Cyber and Night Ocean with gradients defined with precise RGB values. Why not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*6Kpq-weXEQgzfODKRT6p2g.png" /></figure><p>General settings — reminder timing at 1/2/5/10 minutes, sound, launch at login:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*QeasDs4FTiVsXQ9_8q5Tqw.png" /></figure><h4><strong>About tests</strong></h4><p>I was pleasantly surprised — Claude wrote real tests, not tests that just compile and pass regardless of what’s actually happening in the code.</p><p>Four test files, ~43 cases:</p><p>- <strong>VideoLinkDetectorTests</strong>— covers all 5 platforms, cleanup of trailing characters (`)` `&gt;` `”`) that regex might capture along with the URL</p><p>- <strong>MeetingEventTests</strong> — time formatting (“Now”, “in 3m 45s”, “in 1h 20m”), `isHappeningSoon`, `isInProgress`</p><p>- <strong>ClampedExtensionTests</strong>— helper that clamps reminder minutes to the 1–30 range</p><p>- <strong>OverlayBackgroundTests</strong> — all 9 themes have non-empty display names, raw value round-trip</p><p>What’s not tested — calendar/EventKit integration and NSPanel. That would require mocking, and for a personal utility it’s overkill.</p><p>The rule I followed: read the tests as carefully as the business logic. AI can write a test that passes but checks nothing — hardcoded expected values, too much mocking. It worked out fine here, but the habit of checking stays.</p><h4><strong>Conclusion</strong></h4><p>I don’t know SwiftUI. But now I have a SwiftUI macOS app that I open every morning.</p><p>The interesting part isn’t even that it works — it’s that I understand it. Because before the code there was a plan, before the plan there was the question “why does this need to exist at all”, and at every step I knew what was happening. The AI wrote the code, but the architecture was mine.</p><p>If this were a production service with a team — I’d think twice before picking up an unfamiliar language. But for a utility that solves a specific problem for specifically me — it was the perfect case. Minimal risk, maximum freedom.</p><p>Repo here: <a href="https://github.com/nilBora/meeting-reminder"><strong>meeting-reminder</strong></a></p><p>If you end up using it — a star on GitHub is a nice way to let me know it’s useful to someone other than just me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c04f9efc11f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Journey with PHP Deployment: From FTP to Automated Workflows]]></title>
            <link>https://medium.com/@brdnlsrg/my-journey-with-php-deployment-from-ftp-to-automated-workflows-36ece9f2b5a5?source=rss-4c610c90bf37------2</link>
            <guid isPermaLink="false">https://medium.com/p/36ece9f2b5a5</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Nil Borodulia]]></dc:creator>
            <pubDate>Wed, 04 Jun 2025 07:29:20 GMT</pubDate>
            <atom:updated>2025-06-04T07:29:20.388Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Hello there!</strong></p><p>Today, I’d like to share my experience deploying PHP projects. You might think there’s nothing simpler than uploading your code to a production server — but as it turns out, there are tons of options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JY_obY3YrcJPVg4p1Ejh1A.png" /><figcaption>push. pull.ship.</figcaption></figure><h4><strong>Why PHP Deployment Isn’t That Straightforward</strong></h4><p>PHP is an interpreted language. Unlike Go or other compiled languages, we can’t just build a binary and deploy it. With PHP, we need to transfer the entire codebase — files, templates, dependencies. This comes with both pros and cons.</p><p>On the one hand, it’s flexible — you can tweak things right on the server. On the other hand, the risk of errors increases if the deployment process isn’t properly controlled.</p><h4><strong>Exploring New Approaches</strong></h4><p>A few months ago, I started thinking about better ways to deploy a new project. I wanted to try something new — maybe more modern.</p><p>I came up with a few ideas but also asked the community on Reddit how they deploy their code.</p><p><a href="https://www.reddit.com/r/PHP/comments/1fgq9xo/how_do_you_deploy_php_code/">Link to the post</a> — it might be useful to check out the replies.</p><p>One comment really stuck with me:</p><blockquote><strong>No rebuild, no containers. Just a cronjob that does ‘git pull’ every few minutes and you’re golden.</strong></blockquote><p>It’s surprisingly common to see developers go with this kind of setup — just a git pull in a cronjob and call it a day. While it might work for some, it’s far from a reliable solution and definitely not something to rely on in the long run.</p><h4><strong>Flashback to the Good Old Days</strong></h4><p>I remembered my first deployments. It was 2010. Back then, we all worked with LAMP, XAMPP, Denwer — and it was cool. Deployment was extremely straightforward:</p><p><strong>FTP manager + file copy = live site.</strong></p><p>No branches, no CI/CD. Just connect and drag files — done. I’m sure many still use this for simple landing pages or small websites.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*XYk2uzooPrakj3CLisaq0A.jpeg" /><figcaption>copy files from FTP to server</figcaption></figure><h4><strong>Direct Deployment to Server</strong></h4><p>Next, we connected via SFTP and edited code live on the server. One project — one developer. No version control — it wasn’t mainstream yet. But it worked.</p><p><strong>First Deployment Scripts</strong></p><p>Then came the first deployment scripts. For example:</p><pre>mv /var/www/html /var/www/html_backup<br>mv /var/www/html_new /var/www/html</pre><p>Since everything in Linux is a file, directory renaming took minimal time.</p><p>Later, we switched to an even simpler approach:</p><pre>ln -s /var/www/html /var/www/html_new</pre><p>This really worked — especially for small web projects like business card sites or light landings.</p><p><strong>The Rise of Git: A Breath of Fresh Air</strong></p><p>Then came Git — a real game changer. Deployment, like development itself, entered a new era. Git became our go-to file manager.</p><pre>git pull origin main</pre><p>— one command and your code is updated. And you can enjoy switching branches right on production and rolling back changes quickly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*W2lBgKY-GDuQvan07luPIQ.png" /><figcaption>classic php server</figcaption></figure><p><strong>From XAMPP to Docker</strong></p><p>Over time, XAMPP gave way to Docker — first on dev machines, then on production servers. But Git remained deployment tool #1.</p><p>Here’s an example architecture I now use in many projects:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*EL6iEoKJ7dHMs0c_ygfuFQ.png" /><figcaption>php architecture</figcaption></figure><p>The server runs Nginx as a reverse proxy for worker containers. Since PHP doesn’t have a built-in web server, I run an Nginx container paired with a PHP-FPM container.</p><p>Example <strong><em>docker-compose.yml</em></strong>:</p><pre>version: &quot;3.7&quot;<br><br>services:<br>  nginx:<br>    container_name: ${APP_COMPOSE_PROJECT_NAME}_nginx<br>    image: nginx:alpine<br>    networks:<br>      - backend<br>    working_dir: /app<br>    volumes:<br>      - ./.docker/nginx/default.conf:/etc/nginx/conf.d/default.conf<br>      - ./:/app<br>    ports:<br>      - &#39;${APP_PORT:-9505}:80&#39;<br><br>  php-fpm:<br>    container_name: ${APP_COMPOSE_PROJECT_NAME}_php_fpm<br>    build:<br>      context: ./.docker/php${PHP_VER}-${APP_ENV}<br>    networks:<br>      - backend<br>    env_file:<br>      - .env<br>    user: ${UID:-1000}:${GID:-1000}<br>    extra_hosts:<br>      - &#39;host.docker.internal:host-gateway&#39;<br>    volumes:<br>      - ./:/app:rw<br>    working_dir: /app<br><br>  tasks:<br>    container_name: ${APP_COMPOSE_PROJECT_NAME}_tasks<br>    build:<br>      context: ./.docker/php${PHP_VER}-${APP_ENV}-cli<br>    networks:<br>      - backend<br>    env_file:<br>      - .env<br>    user: ${UID:-1000}:${GID:-1000}<br>    extra_hosts:<br>      - &#39;host.docker.internal:host-gateway&#39;<br>    volumes: <br>      - ./:/app:rw<br>    working_dir: /app<br>    restart: always<br>    command: &#39;/usr/bin/supervisord&#39;</pre><p>For local environments, there’s a separate <strong><em>docker-compose.shared-services.yml</em></strong> with services like MySQL, RabbitMQ, Redis — which already run as separate containers on the server.</p><p><strong>Deployment Script</strong></p><p>Git is still irreplaceable. Here’s an example deployment script:</p><pre>git fetch origin &amp;&amp; git checkout -- . &amp;&amp; git checkout $CI_COMMIT_REF_NAME &amp;&amp; git pull origin $CI_COMMIT_REF_NAME<br>make composer-install<br>make migration-migrate<br>docker-compose run --rm tasks sh -lc &#39;./bin/console messenger:stop-workers&#39;</pre><p>But there’s a catch — during deployment, the server might return a 500 error. That’s bad for both users and developers: DB isn’t migrated, cache isn’t refreshed, but the code is already live.</p><p>What to do?</p><p><strong>Why Not Kubernetes (Yet)</strong></p><p>Kubernetes is powerful, but my services aren’t heavy enough to justify the architectural complexity.</p><p><strong>Canary Deployments</strong></p><p>With this approach, you need twice as many containers and more complicated Nginx setup. But the upside is you can load balance better using Traefik.</p><p>I needed something in-between — simple to implement.</p><p><strong>My Choice: Docker Swarm</strong></p><p>And that’s how I discovered <strong>Docker Swarm</strong>.</p><p>Maybe later I’ll switch to Kubernetes or implement canary deployments with Traefik. But for now, my choice is Docker Swarm — it enables <strong>seamless deployments</strong>.</p><p>The idea: I create an image with all code, push it to GitLab, and the server holds no code — just <strong><em>docker-compose.yml</em></strong> with volumes for logs, static files, and <strong><em>.env</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*qCUv_rvBrWpbu-pwS2CxNw.png" /><figcaption>php plus docker swarm</figcaption></figure><p>In this setup, I simplified architecture — combining PHP and Nginx into one container. This allows for a universal image with a <strong><em>/ping</em></strong> endpoint for health checks.</p><p><strong>Example deployment script:</strong></p><pre>docker pull gitlab.com:5001/path/to/registry/main:$CI_COMMIT_REF_NAME<br><br>docker service update --with-registry-auth --force --image gitlab.com:5001/path/to/registry/main:$CI_COMMIT_REF_NAME $SWARM_SERVICE_NAME;</pre><p>Swarm automatically:</p><p>- spins up a new container,</p><p>- checks its health,</p><p>- switches traffic,</p><p>- stops the old container.</p><p>Users don’t see 500 errors — everything works smoothly.</p><ul><li><strong>Example <em>docker-compose </em>for Laravel:</strong></li></ul><pre>version: &quot;3.7&quot;<br><br>services:<br>  my-service:<br>    image: gitlab.com:5001/my-service/my-service-main:${APP_TAG_NAME}<br>    container_name: my-service<br>    env_file:<br>      - .env<br>    restart: &quot;no&quot;<br>    ports:<br>      - &quot;8181:80&quot;<br>    volumes:<br>      - /etc/localtime:/etc/localtime<br>      - ./.env:/var/www/html/.env<br>      - ./storage/logs:/var/www/html/storage/logs<br>      - ./storage/app:/var/www/html/storage/app<br>      - ./storage/app/public:/var/www/html/storage/app/public<br>    extra_hosts:<br>      - &#39;host.docker.internal:host-gateway&#39;<br>    command: &#39;sh run.sh&#39;<br>    healthcheck:<br>        test: curl -sS http://127.0.0.1:8181/ping || echo 1<br>        interval: 30s<br>        timeout: 3s<br>        retries: 12</pre><p>In the <strong><em>run.sh</em></strong> script, I run migrations and start workers:</p><pre>#!/bin/bash<br>php artisan queue:work &amp;<br>php artisan migrate --force<br>php artisan optimize:clear<br><br>nginx -g &quot;daemon off;&quot;</pre><p><strong>In Conclusion</strong></p><p>This setup is <strong>simple and stable</strong> if you want deployment control and zero downtime. Just make sure to optimize your Dockerfile and don’t forget a <strong><em>.dockerignore</em></strong> to skip unnecessary files (like docs/, tests/, .git/ etc).</p><h4><strong>Conclusion</strong></h4><p>Always assess your project:</p><p>- If it’s a simple static site — good old FTP might be enough.</p><p>- For internal projects — Git-based deployment could work.</p><p>- For user-facing apps with moderate load — Docker Swarm is optimal.</p><p>- For high-load production — Kubernetes is the way to go.</p><p>Don’t be afraid to try new things — a developer’s stack should evolve. Yes, there’s the “if it works — don’t touch it” rule, but if that “don’t touch” slows you and your users down — it’s time to change your approach.</p><p>Thanks for reading!</p><p>Hope this article helps someone improve their PHP deployment strategy.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36ece9f2b5a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>