Ask
82
@rabbitroomie ·

first vps — is ssh in and docker compose up -d really the whole deploy Compose

Two months into the first thing I've had actually online. I ssh into a $5 box, git pull, docker compose up -d --build, and it works. Every tutorial past this point is CI pipelines, blue-green, staging environments, terraform.

Is what I'm doing an embarrassing beginner thing I should fix before anyone sees it, or is it genuinely fine at this size? Nine users, all friends, but I'd rather not build habits I have to unlearn.

11 answers Share
Report

Answering anonymously — a moderator will review it first.

  • @mulch_mule · 5d ago · 3 replies

    It's genuinely fine and you should keep doing it until something specific hurts. The pipeline material exists to solve problems you don't have — several people deploying at once, needing to know who shipped what, needing to roll back at 2am without your laptop.

    Three habits worth building now though, because they're cheap and annoying to retrofit:

    • put the deploy in a script in the repo, even if it's three lines. Then it's documented, and "run this from CI" is later a five-minute change
    • never edit files on the server. Everything comes from git. The moment you fix something with vim on the box, you have a state you cannot reproduce
    • .env on the server, never in the image, and write down somewhere which keys it needs

    That's it. Blue-green at nine users is cosplay.

    97
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @rabbitroomie · 7d ago

      I have definitely edited a file on the server. Twice. Fixing that now.

      26
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
    • @coworking_cass · 4d ago

      Everyone has. The tell is when a redeploy mysteriously breaks something that was working — that's your server-only edit getting overwritten.

      19
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @negativesplitz · 6d ago

    One thing to change before it bites: --build on the server means your app competes with the build for CPU on a $5 box. Fine at nine users. The day it isn't, it shows up as timeouts during deploys and it's confusing.

    Also do backups now rather than later. Whatever your data is, a nightly dump piped to a bucket is 20 minutes of work and it's the only item on any of these lists that's unrecoverable if you skip it.

    54
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @edge_runtime_bo · 4d ago · 2 replies

    What you're doing has a name, it's just called deployment. Tutorials sell complexity because complexity is what there is to teach — nobody writes a course called "ssh in and restart it".

    The one thing I'd add at your size is knowing how to get back. Tag your images with something other than latest, or at minimum know the git SHA that's running. When you break it, "go back to the previous thing" should be a command you already know rather than one you look up while it's down.

    33
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @rabbitroomie · 7d ago

      Everything is latest. I see the problem.

      15
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @rubberduck_rae · 6d ago · 3 replies

    Add a firewall today if there isn't one. ufw allowing 22, 80 and 443 and denying everything else, and check postgres isn't published. The number of compose files with ports: - "5432:5432" reachable from the open internet is genuinely alarming, and scanners find them within hours.

    20
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @rubberduck_rae · 7d ago

      Change the password too, and have a look at pg_stat_activity for connections you don't recognise. Probably nothing. Check anyway.

      18
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
    • @rabbitroomie · 4d ago

      ...it was published. It is no longer published. Thank you.

      17
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @muslin_mira · 5d ago

    Staging is the one people skip that's actually cheap. Not a whole second environment — a second compose project on the same box with different ports and its own database. Ten minutes. Then you can try a scary migration somewhere other than the thing your friends are using.

    21
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @oncall_omar · 5d ago

    you'll know it's time for CI the first time you try to deploy from a train on a phone hotspot and it dies halfway. that's the actual trigger for most people

    9
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report