News for hackers. Stuff that matters.
Re:The Simplicity of Single-File Golang Deployments by zer00eyz on Wednesday March 22, 2023 @10:21AM (#35261432)
From the article:

"Standing here it looks like Docker was invented to manage dependencies for Python, Javascript and Java. It looks strange from a platform that deploys as one single binary."

Let me say the quiet part out loud: Docker is covering up the fact that we don't write deployable software any more.

Go isn't perfect either. The author isn't dealing with assets (images anyone?).

I think there is plenty of room for innovation here, and were over due for some change.

Re:The Simplicity of Single-File Golang Deployments by joncfoo on Wednesday March 22, 2023 @10:35AM (#35261684)
Assets of any kind can be embedded in the executable and accessed via the embed.FS interface. This makes it trivial to bundle up all dependencies if desired.
Re:The Simplicity of Single-File Golang Deployments by cytzol on Wednesday March 22, 2023 @01:56PM (#35264724)
Embedding your assets like this isn't always an improvement. For example, I work on a site with a Go server and static content pages, and I like that I can update one of the pages and see the change instantly without having to re-compile the entire server binary just to get the new files included.
Re:The Simplicity of Single-File Golang Deployments by mftb on Wednesday March 22, 2023 @10:07PM (#35269641)
Easy enough to have the app check the regular file system first, then fallback to the embedded fs. You could have the best of both worlds.
Re:The Simplicity of Single-File Golang Deployments by candiodari on Wednesday March 22, 2023 @06:00PM (#35267649)
Of course Visual Basic 2.0 and Delphi 1.0 both had embeddable filesystems. Even updateable embedded filesystems (which worked because the exe would really be a zip files. Zip files are indexed from the end of the file. So you can prepend the actual executable code and that would work. Zip files are updateable ...)

I believe after a while you also had sqlite-inside-the-exe things.

Re:The Simplicity of Single-File Golang Deployments by galdor on Wednesday March 22, 2023 @10:34AM (#35261658)
I'm unsatisfied with the current situation too, but it's a hard problem. You can either go full container (which means no BSD, and having to deal with Docker or Kubernetes and all the associated woes), or fallback to native packages which are a huge PITA to build, deploy and use.

I think that Nix and Guix have part of the solution: have a way to build fully independent packages that can be easily installed. But I'm not comfortable with the complexity of Nix, and Guix does not run on FreeBSD. And ultimately you still have to handle distribution and configuration of the base system you deploy on.

Innovation is possible, but there are a lot of expectations for any system dealing with building and deploying software. I feel that there are fundamental limitations inherited from the way UNIX OS work, and I wish we had lower level operating systems focused on executing services on multiple machines in a way similar to how mainframes work. One can dream.

Re:The Simplicity of Single-File Golang Deployments by indymike on Wednesday March 22, 2023 @12:04PM (#35263167)
I'm really growing tired of significant effort development effort going to dealing with deployment on the part of our stack that isn't written in Go. The Go side, deployment is replace binary, restart app, done. The Python and Javascript code we maintain takes significant effort to deploy, and builds can be brittle due to dependency issues.

> I feel that there are fundamental limitations inherited from the way UNIX OS work

There are, but the way go does deployments plays to Unix's strengths.

Re:The Simplicity of Single-File Golang Deployments by xyzzy4747 on Wednesday March 22, 2023 @12:16PM (#35263351)
Just curious, what’s the benefit of using FreeBSD versus Debian/Ubuntu?
Re:The Simplicity of Single-File Golang Deployments by lmm on Wednesday March 22, 2023 @09:18PM (#35269362)
Not the person you replied to, but it tends to be more stable (commands and interfaces change less) and have better backwards compatibility; also ZFS is better-integrated than on Linux and better than any of the other options on Linux. (Jails used to be another advantage, but these days linux containers can more or less do most of the same things)
Re:The Simplicity of Single-File Golang Deployments by lmm on Wednesday March 22, 2023 @09:11PM (#35269327)
IMO if you're doing containers and cloud deployment then there's no point bothering with the OS layer. It'd be better to just build unikernels and deploy those directly. Some of the stripped down base images are going in this direction, and MirageOS looks pretty impressive although I've not been able to use it for real yet.
Re:The Simplicity of Single-File Golang Deployments by ElevenLathe on Wednesday March 22, 2023 @10:23AM (#35261456)
Anymore? When were we writing "deployable" software in the past?
Re:The Simplicity of Single-File Golang Deployments by zer00eyz on Wednesday March 22, 2023 @10:36AM (#35261700)
I'll bite!

We used to ship software, on discs, and we didn't have the Internet to update it.

There is plenty of software out there that works via your linux distress package manager. Note that this isn't everything you can get from your package manager. Plenty of things that are available are broken or miersable to get working unless you get the container/vm version.

Re:The Simplicity of Single-File Golang Deployments by tomcam on Wednesday March 22, 2023 @01:22PM (#35264220)
I remember those days well. It really meant you had to be careful with bugs and documentation. It is not clear to me that the we are winning with daily or multiple times daily release schedules at this point.
Re:The Simplicity of Single-File Golang Deployments by jrockway on Wednesday March 22, 2023 @05:52PM (#35267567)
Were people careful with bugs and documentation? I remember the Internet blowing up one day because every Windows install was sending every IP on the Internet a virus, and there was nothing anyone could do about it. (And yes, Unix also had similar worms, though they largely predate me!) Word used to crash and corrupt your entire novel. There was no online banking. I'm not sure the rose-colored glasses are a realistic take on changing software quality.

Today, the tools are available to move quickly and maintain quality. You probably do what was months of manual testing every time you save a file, and certainly every time you commit a set of changes. There are fuzz testers to find the craziest bugs that no human could even imagine. There are robots that read your PR and point out common errors. HN really likes to pan on software quality, but "I don't like this feature" is not a bug per se, just a company you don't like. There are a lot of those, but there are more lines of code than ever, and a lot more stuff works than 30 years ago. I think we, as a field, are getting better.

Re:The Simplicity of Single-File Golang Deployments by tomcam on Thursday March 23, 2023 @03:27AM (#35271501)
I ran a software company that predated the web. Yes, we were incredibly careful. When you ran the risk of having to send out updates on disks QC was a big thing.
Re:The Simplicity of Single-File Golang Deployments by marcosdumay on Wednesday March 22, 2023 @10:34AM (#35261655)
You used to buy a disk, put it on your computer and run the thing there.
Re:The Simplicity of Single-File Golang Deployments by ElevenLathe on Wednesday March 22, 2023 @11:44AM (#35262848)
Isn't that just "running" the software? To me, "deployment" implies some repeated process that actually wasn't especially valuable to automate or be very careful about when software was released once a year (and hence the reason it wasn't).

Also, disks are a horrible way to deploy software. They have all the same problems of just distributing a random tarball: What operating system is it for? What version? Where do I copy the files? How do I get the OS to automatically start the service on startup? What version of make does it use? How about which libc and cc? You can say this stuff in the README (or printed docs) but isn't something more "deployable" when it's all machine-readable and can be reasoned about automatically? This is what package managers were invented for.

Re:The Simplicity of Single-File Golang Deployments by xyzzy4747 on Wednesday March 22, 2023 @12:20PM (#35263398)
My father told me a story about when he was in college, he had to find a book in the library catalogue with the program he wanted, order it and check it out, and then type it up and test/debug it. After that all his colleagues and professors wanted to borrow it as well. This was in the 70s.
Re:The Simplicity of Single-File Golang Deployments by Jtsummers on Wednesday March 22, 2023 @10:50AM (#35261923)
A better question is what is deployable software? How does it contrast from non-deployable so we can understand what we're even talking about. Software gets "deployed" all the time so in what way is it currently non-deployable versus some rose tinted view of yesteryear's software?
Re:The Simplicity of Single-File Golang Deployments by bojanz on Wednesday March 22, 2023 @10:46AM (#35261839)
Go isn't perfect either. The author isn't dealing with assets (images anyone?).

Go supports embedding assets since 1.16, the author mentions embedfs in the post.

Re:The Simplicity of Single-File Golang Deployments by divan on Wednesday March 22, 2023 @11:26AM (#35262509)
And people are using go-bindata since Go<1.0, so Go supports embedding assets since forever.
Re:The Simplicity of Single-File Golang Deployments by acatton on Wednesday March 22, 2023 @10:48AM (#35261871)
> Go isn't perfect either. The author isn't dealing with assets (images anyone?).

From the article: "The Go web application had all files like configurations (no credentials), static css and html templates embedded with embedfs (and proxied through a CDN)."

See https://pkg.go.dev/embed

Re:The Simplicity of Single-File Golang Deployments by zer00eyz on Wednesday March 22, 2023 @11:05AM (#35262160)
OP here,

How are you doing caching without a mod time?

https://github.com/golang/go/issues/44854

Are you re-naming or hashing for cache clearing?

Re:The Simplicity of Single-File Golang Deployments by acatton on Wednesday March 22, 2023 @11:33AM (#35262640)
I'm not the author of the post, so I can't tell you.

What I do in my projects is that I tell varnish-cache to cache assets in "/static/..." forever. And when I have a "curl -X PURGE <varnish_endpoint>" as part of the "ExecStartPre=" of my go binary.

• https://varnish-cache.org/docs/trunk/users-guide/purging.htm...

• https://www.freedesktop.org/software/systemd/man/systemd.ser...

Re:The Simplicity of Single-File Golang Deployments by ed25519FUUU on Wednesday March 22, 2023 @11:35PM (#35270238)
Clever solution! Why not make it part of the startup of your binary?
Re:The Simplicity of Single-File Golang Deployments by acatton on Thursday March 23, 2023 @03:44PM (#35280278)
Sorry to reply a day later. GP here, it's a simple separation of concern. IMHO the binary should not be aware that it is cached and/or how it's deployed. I separate "business logic" from "devops", and I consider purging the cache to be "devops". This is why I let systemd do it.

Of course, at the end it's a question of preference. People might disagree.

Re:The Simplicity of Single-File Golang Deployments by pjmlp on Wednesday March 22, 2023 @05:01PM (#35267041)
Java never needed Docker, in fact the Docker / Kubernetes is now re-inventing Java Application Servers with WASM containers.
Re:The Simplicity of Single-File Golang Deployments by VBprogrammer on Wednesday March 22, 2023 @07:32PM (#35268543)
XML ruined Java.
Re:The Simplicity of Single-File Golang Deployments by pjmlp on Thursday March 23, 2023 @02:25AM (#35271086)
Yep, that is why everyone keeps adding patches on top of JSON and YAML tooling to make them usable.
Re:The Simplicity of Single-File Golang Deployments by VBprogrammer on Thursday March 23, 2023 @04:58AM (#35272002)
Not back in the good days of VB6 when I adopted the nickname.
Re:The Simplicity of Single-File Golang Deployments by Rapzid on Wednesday March 22, 2023 @05:52PM (#35267558)
> we don't write deployable software any more

What did it use to look like exactly, this "deployable" software? Going back to the birth of web 2.0 we had Perl, PHP, Java(?), .Net Framework a few years later. These all required tons of pre-configured infrastructure on the servers to run..

> It looks strange from a platform that deploys as one single binary

It's just a tool with many uses. I CAN deploy my Asp.Net app as a self-contained(even single) file.. But the size of updates is smaller between images if I copy the app into an image that already has the .Net and Asp.Net library code in the base layers.

Re:The Simplicity of Single-File Golang Deployments by ed25519FUUU on Wednesday March 22, 2023 @11:37PM (#35270251)
You can do that without ever touching the system libraries?
Re:The Simplicity of Single-File Golang Deployments by golergka on Thursday March 23, 2023 @08:38AM (#35273775)
> Docker is covering up the fact that we don't write deployable software any more.

We do. It's just software now is a container image, and Docker is a development tool like Make.