If most of your deployment experience comes from platforms like Render, Railway, or Vercel, your mental model of "deploying" probably looks like this:

  1. Push your code to GitHub.
  2. Paste some environment variables into a clean dashboard.
  3. Watch a build log scroll by for three minutes.
  4. Click a *.onrender.com URL that already has HTTPS. It's fast, predictable, and asks you to know almost nothing about what happens underneath your code. I loved it. Then I built something that PaaS couldn't host, and I got a crash course in everything it had been quietly doing for me.

The Project That Broke My Comfort Zone

I was deploying dns-blocker, a project with a Go backend (nullify) and a React dashboard, onto an Oracle Cloud Infrastructure (OCI) Always Free VM.

The reason was simple: a DNS resolver needs port 53 and persistent control over the network. Web-focused PaaS platforms aren't built to give you that. So moving to Infrastructure-as-a-Service (IaaS) wasn't an experiment. It was the only option.

What follows is the honest version of that journey: the silent freezes, the debugging, the fixes, and what I'd tell anyone about to make the same jump.

The Mental Shift: Ordering Delivery vs. Renting a Kitchen

Before I touched a single config file, the biggest hurdle was conceptual.

On a PaaS, you're paying for an abstraction layer. Most PaaS companies don't own bare-metal data centers. They rent big pools of IaaS servers from AWS, GCP, or Oracle and build orchestration on top. When you click "Deploy," a pipeline provisions a container, injects your secrets, configures a reverse proxy, issues a TLS certificate, and wires up a GitHub webhook.

On IaaS, you get an empty Linux box and a public IP address. That's it. There's no git push trigger, no automatic domain, and no friendly UI for environment variables. My first thought, while SSHing in just to run docker compose up, was that this felt less like "real deployment" and more like running my app on a remote laptop.

Then it clicked: this is production. Everything PaaS gave me for free is still available. I just have to assemble it myself.

It's the difference between ordering delivery and renting a kitchen. The food can be just as good, but now you're the one who has to find the pans.

Challenge 1: The Silent SSH Freeze

The first wake-up call came the morning after my initial setup. I'd connected to my Ubuntu instance fine the day before, set up a few things, and logged off. The next morning I ran my SSH command and got... nothing. No "permission denied." No timeout. Just a blinking cursor.

If you're used to PaaS dashboards with clear status badges (Building, Live, Deploy Failed), a silent terminal is genuinely disorienting. I even wondered whether I needed the Oracle Cloud console open while connecting. (You don't. Once an instance is running, it lives on its own on the public internet.)

Instead of guessing, I reran SSH in verbose mode:

ssh -v -i ~/Downloads/ssh-key.key ubuntu@<PUBLIC_IP> 

The output stopped after two crucial lines:

debug1: Connection established. ... debug1: Local version string SSH-2.0-OpenSSH_10.2p1 Ubuntu-2ubuntu3.8 

What that actually meant

Connection established ruled out half the usual suspects at once. Oracle's Security List wasn't blocking me, and port 22 was open. My laptop had completed the TCP handshake and sent its SSH greeting, and it was now waiting for the server to answer with its own banner.

When a Linux server accepts a TCP connection at the kernel level but never replies from userspace (sshd), it usually means one thing: the machine is so starved for RAM that the SSH daemon can't get any CPU time to respond.

Lesson one: ssh -v is your new status badge. Learn to read it.

Challenge 2: Out-of-Memory Thrashing During docker compose up

After force-rebooting from the Oracle console and getting back in, I wanted to see the freeze happen in real time. So I went to my dns-blocker directory and ran:

docker compose up -d 

Docker pulled the base images (golang:1.26-alpine and alpine:3.20), downloaded the Go modules, copied the source, and reached the last step:

=> [builder 6/6] RUN go build -o nullify . 

At 401.6s, the terminal froze. SSH went dead again. Mystery solved.

Why PaaS hides this problem

On a PaaS, builds often run on separate, beefier workers before your app ever lands on a small runtime container. On a 1 GB IaaS instance (VM.Standard.E2.1.Micro), your build environment and your production environment are the same constrained machine.

By default, go build spreads work across every available CPU core and holds a lot in memory at once. Add the linker at the end, and a build can spike past what a 1 GB box can handle. With no swap configured, Linux spends nearly all its CPU time trying to free memory pages, and the whole machine locks up before the OOM killer can even step in.

The two-part fix

First, I added a 2 GB swap file so memory spikes spill onto disk instead of freezing the kernel:

sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile sudo mkswap /swapfile sudo swapon /swapfile echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab 

Pro tip: double-check your terminal prompt before running system-level commands like these. Running them in the wrong tab will happily allocate swap on your laptop instead of your server.

Second, I changed the Dockerfile to trade a few extra seconds of build time for much lower peak memory:

FROM golang:1.26-alpine AS builder WORKDIR /app COPY go.mod go.sum ./ RUN go mod download COPY . . # -p 1: compile one package at a time (prevents parallel RAM spikes) # GOMEMLIMIT & GOGC=50: force aggressive garbage collection during compilation # -ldflags="-s -w": strip debug symbols to reduce linker memory & binary size RUN CGO_ENABLED=0 GOMEMLIMIT=450MiB GOGC=50 go build -p 1 -ldflags="-s -w" -o nullify . FROM alpine:3.20 RUN apk add --no-cache ca-certificates WORKDIR /app COPY --from=builder /app/nullify . CMD ["./nullify"] 

With swap enabled and -p 1 limiting compiler concurrency, the build finished cleanly. No freeze, no drama, and a very satisfying green checkmark.

Challenge 3: Rebuilding PaaS Conveniences by Hand

With the container running, the next question was: how do people actually use this?

For dns-blocker, I needed two things exposed to the world:

  1. Port 53 (TCP and UDP) so devices can send DNS queries to the server.
  2. Ports 80 and 443 so users can open the React dashboard in a browser without typing http://<IP>:3000. On IaaS, exposing an app means touching layers PaaS never shows you:
  • Two layers of firewall. In Oracle Cloud, opening a port in your VCN Security List is only half the job. Ubuntu images on OCI also ship with strict iptables rules by default. Traffic has to be allowed at both the cloud perimeter and the OS level. Forgetting the second one is a classic "I opened the port, why is it still closed?" moment.
  • A domain and a reverse proxy. Point a domain (or a free dynamic DNS subdomain like DuckDNS) at your public IP with an A record. Then put Caddy in front of your containers. It routes yourdomain.com to the React frontend and something like api.yourdomain.com to the Go backend, and it provisions Let's Encrypt certificates automatically. That's the same HTTPS experience PaaS gives you, in a few lines of config.
  • Secrets and CI/CD. Instead of a settings tab, secrets live in a git-ignored .env file on the server, referenced by docker-compose.yml. Instead of a built-in GitHub integration, a short GitHub Actions workflow can SSH in on every push to main, pull, and rebuild. Even better, build the React frontend and Go binary inside GitHub's CI runners and scp the compiled artifacts over, so the 1 GB server never has to compile anything again. None of this is hard, exactly. It's just a lot of small things that a PaaS bundles into one button.

Challenge 4: Never Compile on the Server Again

The swap file saved me, but it also felt like a bandage. A 1 GB machine shouldn't be doing the heaviest job in the whole pipeline. The better fix is to move the build somewhere with real resources and send the server only the finished product.

GitHub Actions is a good fit. Its runners have far more RAM than my VM, and they're free for public repos (with a generous allowance for private ones). The plan:

  1. On every push to main, build the Go binary and the React frontend on a GitHub runner.
  2. Copy the compiled artifacts to the server over SSH.
  3. Restart the containers, which now only run code and never build it. ### Step 1: Add secrets to your repo

Under Settings → Secrets and variables → Actions, add three secrets:

  • SSH_HOST: your server's public IP or domain
  • SSH_USER: ubuntu on my instance
  • SSH_KEY: the full contents of your private key file I'd strongly recommend generating a dedicated deploy key for this instead of reusing your personal one. If it ever leaks, you revoke one key and nothing else.

Step 2: Write the workflow

Create .github/workflows/deploy.yml:

name: Deploy on: push: branches: [main] jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: go-version-file: go.mod # OCI's E2.1.Micro is x86_64, so target amd64  - name: Build Go binary run: | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ go build -ldflags="-s -w" -o nullify . - uses: actions/setup-node@v4 with: node-version: 20 cache: npm cache-dependency-path: frontend/package-lock.json - name: Build React frontend working-directory: frontend run: | npm ci npm run build - name: Copy artifacts to server uses: appleboy/scp-action@v0.1.7 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_KEY }} source: "nullify,frontend/dist/*" target: "~/dns-blocker/deploy" - name: Restart services uses: appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USER }} key: ${{ secrets.SSH_KEY }} script: | cd ~/dns-blocker docker compose up -d --force-recreate 

Adjust the frontend/ paths to match your repo layout. Mine keeps the React app in its own folder.

Step 3: Slim down the Dockerfile

Since the binary arrives pre-built, the runtime image no longer needs the Go toolchain at all. The Dockerfile I sweated over in Challenge 2 shrinks to this:

FROM alpine:3.20 RUN apk add --no-cache ca-certificates WORKDIR /app COPY deploy/nullify . CMD ["./nullify"] 

No compiler, no memory spikes, and an image that builds in seconds.

What I like about this setup

A push to main now triggers a deploy with no SSH session from me, which is the closest thing to PaaS's "just push" feeling I could recreate. When something breaks, the Actions log tells me exactly which step failed, so I get my status badges back too (Building, Live, Deploy Failed, just with different names).

It does have rough edges. There's no automatic rollback, and --force-recreate means a few seconds of downtime. For a personal DNS blocker, I'll take that trade. If you can't, look at tagging images and keeping the previous version around so you can switch back.

The Trade-Offs: PaaS vs. IaaS

After going through this, the trade-offs felt a lot clearer:

Dimension PaaS (Render, Railway) IaaS (Oracle Cloud, AWS EC2)
Setup speed Minutes. Connect repo, add env vars, ship. Hours. Provision the VM, harden SSH, configure swap, firewalls, and a reverse proxy.
Network and protocol control Restricted, usually HTTP/HTTPS on standard ports. Total control: custom DNS servers (port 53), VPNs, raw TCP/UDP sockets, background daemons.
Resource limits and cost Predictable tiers, but free tiers often spin down when idle and costs climb quickly. Generous always-on compute (like OCI's Always Free tier), but you manage tight RAM and CPU budgets yourself.
Build pipeline Handled on separate build infrastructure. Runs on your server unless you offload to GitHub Actions or cross-compile locally.
Maintenance No OS patching, no SSL renewals. You own security updates, disk cleanup (docker builder prune), and crash recovery.

What I Took Away From It

Stepping down a layer in the cloud stack came with friction, but it gave me things I couldn't get on a standard PaaS:

  1. True protocol freedom. A custom Go DNS blocker and a React dashboard on one always-on IP, with no cold starts and no HTTP-only restrictions. That's exactly why IaaS exists.
  2. Sharper debugging instincts. Reading ssh -v output, recognizing OOM thrashing, adding swap, and tuning Go compiler flags (GOMEMLIMIT, -p 1) turned "the cloud" from a magic black box into ordinary Linux processes I can reason about.
  3. Don't build on tiny servers. Just because a small VM can compile Go or bundle React doesn't mean it should. Build locally or in GitHub Actions and ship lightweight binaries and static assets.
  4. PaaS makes more sense after IaaS. You don't fully appreciate what those platforms automate until you've set up firewalls, swap, a reverse proxy, and a deploy pipeline by hand. ## So, PaaS or IaaS?

If you're building a standard web app or REST API and want to focus on product features, stick with PaaS. Paying for abstraction is a smart engineering trade.

But if your app needs custom network ports, always-on background services, tight cost control, or you just want to understand how production infrastructure works under the hood, spin up a raw Linux VM. When it inevitably freezes on your first build, you'll learn more in two hours of debugging than in twenty one-click deploys.

Have you made the PaaS-to-IaaS jump? I'd love to hear what bit you first. Drop it in the comments.