Hacker News new | ask | show | jobs
by rglullis 816 days ago
This seems like a terrible case of not separating concerns and needless optimization. It may work for you, but what if someone who does not know Go but wants to use your project on a provider that is not hetzner?
3 comments

> It may work for you, but what if someone who does not know Go but wants to use your project on a provider that is not hetzner?

Well they'd run into the same problem if the script was Python, wouldn't they?

And Go is ultimately far far easier to read, modify[1] and debug for someone who doesn't know it than Python is.

[1] For example, adding a third-party library to handle new cases. I've never had a good time doing it with Python's various package management, but Go seems pretty good at it.

> Well they'd run into the same problem if the script was Python, wouldn't they?

No, they would just use whatever tool is more appropriate for the job.

Fabric would be fine, ansible would be fine, salt would be fine, putting it on Docker and deploying via compose would be fine. None of these tools force you to learn the implementation details of the application.

> Fabric would be fine, ansible would be fine, salt would be fine, putting it on Docker and deploying via compose would be fine.

That still leaves them the problem of "If I don't know this tech stack, what do I do?"

You are working on the assumption that everyone already knows Fabric, Ansible, salt or Docker.

Whichever poison you choose, people who don't know that particular poison won't know how to install to a different provider anyway!

You're making an argument against one particular poison, but I don't see it as any better or any worse than the others, which all have enough complexities to fill a book.

> "If I don't know this tech stack, what do I do?"

If you don't know how to use a tool that does one job, either you learn it or you just delegate that job to someone who knows it already. But defending the practice of having your application code also responsible in dealing with deployment and packaging smells a lot of "coders are gonna code".

> If you don't know how to use a tool that does one job, either you learn it or you just delegate that job to someone who knows it already.

How is that different from "If you don't know how to use the tool (Go), either you learn it or you just delegate that job to someone who knows it."?

> But defending the practice

Woah there cowboy, I wasn't advocating an architectural decision suitable for a FAANG. I was "defending" the position of "why you an extra tool for this one program that has no other dependencies?"

> of having your application code also responsible in dealing with deployment and packaging smells a lot of "coders are gonna code".

In much the same vein, switching to Ansible, Fabric, etc simply to install a single binary to a single place smells a lot like "resume-driven-development".

You are being needlessly picky here, Golang is in fact a very viable replacement for both sh/bash/zsh and Python scripts, it compiles to a single static binary, can be cross-compiled to every supported OS on another host, and is thus easy to distribute.

I already started replacing parts of my shell scripts with Golang programs and the experience is miles ahead.

And if the project is already written in Golang, it makes even more sense if the dev is also partially the DevOps. Why wouldn't they make the experience as seamless as possible for themselves and the rest of the dev team? What good would Ansible do if everyone has to yet learn it?

As for the person you originally replied to, I'd definitely make a separate program that provides tooling related to the main program... but that's the only different thing I'd do.

Your snarky "coders gonna code" comment is detached from reality, we have jobs to do, and within deadlines.

> it compiles to a single static binary, can be cross-compiled to every supported OS on another host, and is thus easy to distribute.

You could say the same thing about Java or C++. Would you argue then that the best way to deploy java applications is by writing a java library and embed into your program?

> if the project is already written in Golang, it makes even more sense if the dev is also partially the DevOps.

I really don't see how that one follows from the other, and I really don't understand this conflation between roles and tooling. There is a lot more to "DevOps" than packaging/distributing/deploying. It's not just because your application code is in Go that your tooling needs to be as well.

> Why wouldn't they make the experience as seamless as possible for themselves and the rest of the dev team?

Because it's a fragile solution. You are tying the implementation of your problem to a very narrow space out of immediate convenience. I've had my share of projects with "experienced" node.js developers who are trying to do everything in node instead of reaching out of their comfort zone and looking for existing solutions elsewhere.

> we have jobs to do, and within deadlines.

Yeah, and a lot of those jobs could have been made in a fraction of the time if the developers were not trying to use their screwdrivers as hammers, and put some effort to figure out how to use the hammer in the first place.

Well, maybe he never wants "someone" to deploy his project. I think it is perfectly legitimate to handle it this way for a one-man hobby project.

For a project where multiple people are involved, I think it's better to split concerns. Deployment should be handled transparently and reproducible in a CI pipeline that the team members who are allowed to deploy have access to.

But if you are a one-man show (and you want to keep it that way) you are in no condition to tell what would be the best practice for a team.
Yes you are. You are telling yourself what's the best way to do things in your own team, that is comprised of only yourself.
If your argument can only be made in a very specific set of conditions and only applies to yourself, it's just a preference.

I don't care how you prefer to do things on your own, but if I were interviewing you for a senior position in a team with a handful of people, and you tell me that's how you want them to work, it would be an almost immediate NO HIRE.

Yes, but you are moving goalposts. I was under the impression we were talking about the one-man army case only, not how they conduct themselves on interviews which is a VERY different topic.
The blog post was about the context of a team with multiple people.

OP's comment was "I do this for my Go project's" and goes on to describe how to use a (open source) library that even deploys to Hetzner.

So, either the commenter was trying to extend their practice to the point of the blog post or the comment was just expressing a preference when working by themselves, which has little to do with the content of the post.

Not OP, but I presume that one could add `-deploy-aws` cmd-line to the Go binary with whatever steps AWS requires.
Yeah, this is the way to end up with ad-hoc, bug-ridden, half-baked implementation of fabric (or ansible, salt, helm, nix, or any tool that is more appropriate for this job)

And you haven't addressed the issue that whoever is performing the role of DevOps on this project must know Go.

If your person doing DevOps can't learn GoLang, you have bigger problems.
Nice "No true Scotsman", and you are completely missing the point.
You are erroneously invoking a fallacy that does not apply here. A qualified DevOps engineer will be able to pick up GoLang. I didn't claim that a DevOps engineer already knows GoLang, but that they're able to pick it up. If I'd say only true devops engineer's already know golang, you'd have a point.

Unfortunately, you missed it too.

> qualified DevOps engineer

Which is not something that one professional needs to be in order to have to perform some duties that fall within the role of DevOps.

I am, first and foremost, an application developer using Python and JavaScript. But I also have extensive experience:

- setting up Docker Swarm clusters

- managing cloud infrastructure with Terraform

- configuring deployments with Ansible

- setting up observability on Prometheus/Loki/Grafana stack

- putting up together CI servers for my team

- setting up backup/restore infrastructure.

- deploying and managing internal OSS tools for a dev/data team: Gitea, Taiga, Redash, Apache Airflow, Baserow...

These are all tasks that could be part of a "DevOps Engineer" job description, but if you tell me that "to work with a primarily Golang dev team you need to pick up Golang", I'd be assuming that you are not looking primarily for a DevOps Engineer, but a Go Developer who can do DevOps. And because I am not a Go Developer, you'd be putting my whole application on the bottom of the Stack.

Do fabric,ansible, salt, helm, or nix have the functionality of deploying to cloud infrastructures? There is a lot more to deploying to cloud infrastructures then just provisioning a server.

I've never seen these tools used in this capacity, especially nix.

I think such things have existed, but Nix deployment tools being relatively small projects with small teams or solo devs, a more common approach is to piggyback off of other IaC tools provisioning cloud infrastructure, e.g. by templating Terraform in Nix¹.

From a Nix user's perspective, this leaves a lot to be desired, because tools like Terraform are much less reliable than Nix tools that target local machines, and their management of, say, a VPC, is much less comprehensive than NixOS' management of an individual operating system. And they're slow as hell. But for the most part these issues are inherited from the APIs cloud providers expose, which don't meaningfully or uniformly support immutability.

--

1: https://github.com/terranix/terranix

One could argue that if you are at the stage of "provisioning a server", then you should be using something like Terraform or Pulumi, not configuration tools like the one I mentioned.

Anyway, for the specific case of "deploying to hetzner":

- ansible has a whole collection of modules for hetzner: https://docs.ansible.com/ansible/latest/collections/hetzner/...

- For Nix, there is NixOps

- if no one in the team wants to learn any of that, Hetzner provides a CLI to interact with their whole cloud.

To repeat: the last thing I'd want from an application is to have its own deployment system.