Skip to main content
    Norditco logo
    All engineering posts
    Published November 18, 2025Norditco Engineering

    Keeping a Single VPS Reliable - Edge Routing, Cold Apps, and a Lean Footprint

    • infrastructure
    • reliability
    • edge
    • architecture

    Norditco runs its public web surface on one virtual server. Learn Persian with Sepideh, the norditco.com hub, the Midad writing tool, the Farsi text-to-speech service, an API, and a monitoring dashboard all share roughly 1.9 GiB of RAM and about 40 GB of disk. That is a deliberate choice. A single host is easy to reason about and honest about its limits. It is also unforgiving. One memory-hungry container can take the neighbors down with it, and a health check written for a typical web app will page you for things that are working as designed.

    This post describes how traffic reaches each of our applications, how we decide what stays running all day and what sleeps until someone asks for it, and the reliability work we shipped to make that arrangement dependable. It is a description of design and trade-offs, not an operations manual. The commands, paths and credentials stay in our private ops repository.

    The constraints we start from

    Every decision below follows from a short list of measured facts.

    • Memory is the scarce resource. A little under 2 GiB of RAM, with roughly 0.7 GiB available under load when we started this work. Swap was already in use.
    • Disk is tight. About 40 GB, with most of it occupied by container images and site content.
    • Traffic is very uneven. On a representative day in late October, norditco.com saw about 780 requests, Learn Persian about 360, the API about 120, the monitoring dashboard about 75, TTS about 27, and Midad about 5.
    • Not every app answers 200 on its root. Our API returns a 404 at / by design. A naive probe reads that as an outage.
    • Uptime for the hot product matters more than elegance. Learn Persian is the workload people notice when it breaks.

    The last two points shaped the reliability model more than any tool choice did. We will come back to them.

    One front door

    Every public hostname resolves to the same server, and every request enters through the same place: nginx on ports 80 and 443. nginx terminates TLS with certificates managed by Certbot, then forwards the request to an upstream that listens only on the loopback interface. No application port is reachable from the internet. Docker publishes container ports on localhost only, so there is no way to skip the front door by guessing a port number.

    The mapping is small enough to hold in your head:

    HostnameWhat it servesPosture
    learnpersianwithsepideh.norditco.comLearn Persian with Sepideh web appHot, always on
    norditco.comThe Norditco hub, a static marketing siteAlways on
    monitor.norditco.comDashboards for operatorsCold, wakes on demand
    api.norditco.comBackend APICold, wakes on demand
    tts.norditco.comFarsi text-to-speechCold, wakes on demand
    midad.norditco.comMidad, Arabic writing toolCold, wakes on demand, behind Traefik

    Some of these hosts are intentionally not indexed. The API, the monitoring dashboard and other operational endpoints exist for software and for our own team. They are not products, and a search engine has no business listing them. Keeping them out of indexes is part of the edge policy, in the same way that keeping them off public ports is.

    Architecture diagram. Expand for a larger view with zoom.

    Why nginx stays in front

    When we wrote down the roadmap for this server, edge routing was an open question. Caddy offers automatic HTTPS with less configuration. Traefik fits a label-driven, container-first model and would be the natural choice if we ever adopted Kubernetes. nginx was already working, uses very little memory, and every site on the box already had a tested server block.

    We decided by experiment instead of by fashion. The rule was to pick one low-traffic hostname, put it behind the candidate, and let everything else keep running on nginx. Midad was the right canary: small, rarely visited, and low blast radius if the experiment failed. The result is that Midad is routed nginx to Traefik to the on-demand layer, while every other host goes through nginx alone. nginx still terminates HTTPS for all of them, so certificates and renewal did not change. Traefik routes by hostname to the same wake proxy the other cold apps use.

    That arrangement is accepted, not a migration in progress. It gives us a real, running Traefik path to study, and it has a one-command undo that puts Midad back on plain nginx. The cost is a small always-on process, around 38 MiB, serving a single cold app. We have written down that if memory stays tight, folding Midad back to nginx-only is the simplest reclaim of RAM still available. A new edge is only worth keeping if it earns its RAM.

    Always on, sometimes asleep

    The central idea of the footprint work is that "running" is a property we assign per application, based on how often people visit it and what it costs to keep it warm. We use four classes.

    ClassMeaningPolicy
    HotDaily traffic mattersAlways on, memory capped, latency watched
    WarmNeeded but quietAlways on for now, strict memory cap, reviewed monthly
    ColdRare traffic, non-zero RAMSleeps when idle, wakes on the first request
    TaxOperational overhead such as monitoringSlim it first, relocate it if still heavy

    A rule of thumb comes out of the table. High memory with low traffic makes an application the first candidate to sleep, shrink or move. High traffic makes it the last thing we touch.

    Applied to the current stack:

    • Learn Persian is hot. It uses roughly 100 MiB, serves the most product traffic, and is the one workload we refuse to experiment on. It is the last thing we would migrate and the first thing we protect.
    • The norditco.com hub is warm and brand-critical. The public company site is a static build served by nginx, so the site itself costs almost no RAM. It is still always on, because it is the public face of the company and the Discovery Mesh entity hub. Heavier always-on cost on the box comes from product apps and any legacy content services that still share the host.
    • Midad, the API and Farsi TTS are cold. Together they receive a few percent of the traffic that Learn Persian gets, so keeping them resident is a poor use of memory. The TTS engine alone costs about 130 MiB idle for a handful of requests a day.
    • Monitoring is tax. The dashboard stack was close to 350 MiB while the operators who use it visit a few dozen times a day. It was the clearest case for a diet.

    How the on-demand layer works

    A cold application is not offline. It sits behind a small wake proxy. When a request arrives for a stopped app, the proxy starts its container, waits until it responds, and forwards the request. After about 30 minutes without traffic, the container stops again.

    Architecture diagram. Expand for a larger view with zoom.

    The trade-off is plain. The first visitor after an idle period pays a few seconds of startup latency. Every later visitor does not, and the server gets that memory back for everything else. For a writing tool that sees a handful of visits per day, and for a speech service that a few people use, that is a good trade. For Learn Persian it would not be, which is why it never goes cold.

    We also keep the idle timer tunable by class. The monitoring dashboard tolerates a shorter timeout because operators are patient and the dashboard is expensive. Brand-facing hosts would use a longer one if we ever put them on demand, because a slow first load is a worse impression there.

    Reliability on a box this small

    A lean footprint only helps if the things that remain are dependable. We organized the work into stages, and the order was deliberate: make the system tell the truth about its health, stop it from falling over, thin the monitoring footprint, and only then consider automating recovery.

    Health contracts instead of a single probe

    The first problem was the monitoring itself. A global rule such as "the root URL must return 200" produces false alarms on this stack. The API returns 404 at its root and is healthy. A cold app that is stopped returns nothing, which is also fine. An automatic recovery system driven by that probe would restart or roll back healthy services, and on a memory-starved host that makes things worse.

    So every service now carries an explicit health contract: which URL to check, which statuses count as healthy, whether the app is allowed to be asleep, and how long to wait after a wake before judging it. Failures are classified, not just counted.

    StateMeaningResponse
    SleepingOn-demand app is stoppedNone, this is normal
    WakingInside the startup grace windowNone
    Expected softNon-200 that the contract allows, such as the API rootNever treated as failure
    DegradedSlow, or the host is under memory pressureAlert only
    DownContract failed after the grace windowRestart in place, then alert

    The morning summary our team reads now distinguishes sleeping from down. The API no longer looks broken every day, and a stopped cold app is no longer reported as an outage. That distinction took very little code and removed most of the noise.

    Memory limits and swap

    The second change was to stop one container from consuming the machine. Always-on product containers, including Learn Persian, now run with explicit memory ceilings. We started conservative, in the low hundreds of MiB per service, and tuned from observation. Restart policies keep always-on containers coming back after a crash, and a repeated restart of a core container raises an alert.

    At the host level we expanded swap from 4 GiB to 8 GiB and raised the kernel's swappiness so the system moves idle pages out earlier and keeps working memory free for active requests. Container swap allowances are set to a multiple of each memory cap, so a spike degrades performance instead of triggering the out-of-memory killer. We are explicit that this is a safety margin, not a substitute for headroom. Heavy swapping hurts latency, so the real fix remains keeping the always-on set small.

    Slimming monitoring without going blind

    Monitoring was the largest block of memory that served no visitors. We did not delete it. We cut it to a minimal pulse:

    • Host metrics for memory, disk and load stay on.
    • A metrics store with short retention stays on.
    • Alerting stays on, with a short list of rules that matter: low host memory or disk, the web server down, or a hot application failing its contract.
    • A daily morning summary combines health classes, the previous day's traffic and memory use.
    • The dashboard UI moved onto the on-demand layer, and the log and container-stats components that were rarely read were turned off.

    The principle is that dashboards are for investigation, and a pulse is for knowing whether you need to investigate. The configuration remains in version control, so the richer setup can return when the host is larger or when monitoring moves off the box.

    After these changes the host recovered roughly 1.2 GiB of available memory, up from about 0.7 GiB under load. That headroom is the real deliverable. It is what lets a traffic spike be a spike instead of an incident.

    Deploys that check the right thing

    The deploy path got the same treatment. A deploy now evaluates each app against its own contract, skips the check while a cold app is asleep, wakes it and waits out the grace period when it needs to verify it, and requires repeated failures before concluding anything. Previous images are retained so a manual rollback is always available.

    We have not turned on automatic rollback, and that is intentional. The preconditions are that a deploy just happened, the contract still fails after the grace window, and a previous image exists. We want a stretch of dry-run logs showing zero false positives against sleeping and soft-failing apps before the system is allowed to act on its own. Reliable detection comes first, and automated action second.

    Checkpoints as the safety net

    Every non-trivial change to this server is bracketed by a named checkpoint: a record of the service set, image versions, the ops repository revision, and enough host state to reproduce the previous configuration. The routine is to create a checkpoint, make one change, check health, and create a second checkpoint if the result is stable. Restoring means going back to the earlier name and verifying the public URLs.

    This makes small steps low-risk and large steps unnecessary. The reliability changes in this post, memory caps, the lean monitoring core, the on-demand dashboard and the deploy health gate, all shipped on one day behind a single checkpoint pair, with the previous configuration one restore away. The rule we hold ourselves to is one app, one change, one checkpoint. We have also written down the failure we are guarding against: a big-bang rewrite on a host with no spare memory.

    Hardening, briefly

    Edge reliability and edge security are the same discussion on a single host. At a high level:

    • Only the standard web and SSH ports are meant to be reachable from outside, and application ports bind to localhost.
    • SSH uses key authentication only, with root login and passwords disabled, and brute-force protection active.
    • Automatic security updates are enabled on the host.
    • Secrets live outside compose files and outside version control, with application credentials moving to a protected location on the server.
    • Content databases and durable volumes are backed up, and restores are exercised, because an untested backup is a hope.
    • Disk hygiene is limited to safe pruning. Anything that could remove rollback images or data volumes requires explicit approval.

    Developer tooling such as the browser-based IDE is not a public site. It is reachable only through an authenticated tunnel, so it adds nothing to the public edge.

    What this costs us

    We prefer to be direct about the downsides.

    • Cold start latency is real. The first request after idle time to Midad, the API or TTS waits for a container to start. We accept that for rarely used tools and monitor it as a metric, rather than hiding it.
    • A single host is a single point of failure. There is no failover here. Our mitigations are fast restore, honest alerting and keeping the always-on set small. They reduce the blast radius of a bad change. They do not replace redundancy.
    • Two proxies are more than one. The Traefik path for Midad adds a component and a place for configuration to drift. We keep it because it is a useful, bounded experiment with an easy undo.
    • Monitoring is thinner than it was. We have fewer dashboards and less log retention. We chose that knowingly, and the pulse covers the failures that matter to visitors.

    What we measure

    The footprint work is only credible if we keep measuring it. These are the numbers we review.

    • Available memory trend on the host, and swap activity, weekly. The goal is a stable or rising baseline with no sustained swapping.
    • Requests versus memory per application, reviewed monthly, to reclassify hot, warm and cold. If a cold app's traffic grows, it graduates to always on.
    • Cold start time for each on-demand app, including the proportion of requests that hit a sleeping container.
    • Contract health by state, so we can see how often apps are sleeping, degraded or down, and how many alerts correspond to a real problem.
    • Restart counts for core containers, which is the earliest signal that a memory cap is set too low.
    • Time to restore from a checkpoint, measured in drills rather than assumed.

    What comes next

    Several concrete items are queued, in roughly this order.

    1. Dry-run auto-rollback. Log the rollbacks the system would have made for a week, confirm none of them touch sleeping or soft-failing apps, and only then enable it behind the deploy gate.
    2. Decide on Traefik for Midad. Compare its steady memory cost against its value as a reference path. If memory is still the constraint, move Midad back to nginx alone.
    3. A dedicated health endpoint for the API. Today its contract accepts a 404 at the root. A real health route would let us tighten the check to a normal 200.
    4. Off-box backups. Database dumps and checkpoints currently live on the same machine. A monthly off-host copy closes the largest remaining gap in our recovery story.
    5. A traffic study for the hub. If norditco.com's visit pattern allows, a longer idle policy could return a few hundred MiB of memory. This is the biggest remaining saving and also the one with the most brand risk, so it waits for data.
    6. A capacity decision. The options are to stay on this host, resize it, or add a small second node for cold workloads. A container orchestrator is only worth considering after that decision, and we practice it on a laptop cluster first, away from production.

    None of this requires a bigger server, though a bigger server remains a valid answer if the data says so. The goal is to keep the visitor experience of Learn Persian, Midad, Farsi TTS and the Norditco hub steady, while the infrastructure stays small enough to understand in one sitting.