Live data from Hacker News

Containerize Go and SQLite with Docker

awstip.com

51–60 of 90 posts

Re: Containerize Go and SQLite with Docker

#51
post #2

Add -ldflags '-s -w' to go build to strip DWARF, symbol table and debug info. See also: -trimpath

Doesn't that make crashes much more difficult to debug? Or can you re-attach this information later on if you get a crash report?

I mean sure, in theory you shouldn't get any of those in production, but no software is perfect.

Re: Containerize Go and SQLite with Docker

#52
post #37
post #29

Earlier quoted context omitted.

Ease of deployment?

Seems more difficult. Without Docker I don't have to bother with a new technology, use new commands and learn new syntax.

No, but you do have to deal with... however you deploy your app right now.

If that works for you, then there's no need to change. But if you ever end up in an environment where multiple different applications are deployed, or if your app needs to be deployed a thousand times, that's where e.g. Docker may come in handy.

Re: Containerize Go and SQLite with Docker

#53
post #39

I'm currently being forced to use Docker against my will, with exactly this setup. The CGO overhead every time the container is built is absurd, making developemnt and testing painful. I habe to try this article out, but it doesn't seem like it solves the problem. Does anyone have advice how to solve this without too much Docker magic?

Why are you forced? We rarely touch docker any more, even though our prod apps run on K8s.

Re: Containerize Go and SQLite with Docker

#54
post #47
post #42

Earlier quoted context omitted.

Yeah, but for Docker to handle the complexities of deployment, you first need to handle the complexities of Docker. So OP's question is valid: for most Go apps, all you have to do is compile a binary and copy it to the server - no Docker or other paraphernalia required. Of course that may not be so simple due to various reasons, but it helps to keep that possibility in mind...

> you first need to handle the complexities of Docker The complexity of Docker is not that big for a Go deployment though, especially if you have all the other bits for orchestrating your Docker containers (for the rest of your stack) already in place. You mostly just copy the binary into a slim image and you are done.

Agree, and most complexities will occur in enterprise environments when the os/hardware is locked down — which can make something like SQLite “hard” as would any cpu/disk-bound container. However that should be a platform teams job to resolve, not a backend dev.

Re: Containerize Go and SQLite with Docker

#55
post #40

Earlier quoted context omitted.

Docker isn't a cache-all for containers. Docker has a pretty terrible deployment story at this point and I forsee in a couple years it will probably be considered legacy compared to Podman/K3d/Local K8s/etc

> Docker has a pretty terrible deployment story (...) This is the very first time I ever heard such nonsense. In all companies I've been, Docker is a renowned problem solver, not only for production deplyments but also for local testing environments and deployments. It even shines as a stand-alone barebones clustering solution with Docker swarm mode.

I’ve honestly not touched docker in years, but all of my prod apps run in docker. So it’d be paradoxical for me to see I don’t need docker, but I really want to.

Re: Containerize Go and SQLite with Docker

#56
this makes sense for the scenario- a mock server.

Our backend teams rarely do anything with containers, but all apps deploy to K8s (platform team manages).

We deploy SQLite… don’t remember any Cgo requirements, however we’re also deploying each SQLite “instance”, or db-files, to a node directly, and for low data gravity on SSDs. Go interacts with database/sql.

Re: Containerize Go and SQLite with Docker

#57

> C libraries are required to interact with SQLite Or: modernc.org/sqlite (plus https://github.com/zombiezen/go-sqlite ), "an automatically generated translation of the original C source code of SQLite into Go" as mentioned yesterday: https://news.ycombinator.com/item?id=29959193#29960726

[deleted]

Re: Containerize Go and SQLite with Docker

#58
post #42

Earlier quoted context omitted.

Perhaps because Docker has great stories for deployment. Many of the complexities of deployment are handled for you (writing a systemd unit, managing rollback, etc).

Yeah, but for Docker to handle the complexities of deployment, you first need to handle the complexities of Docker. So OP's question is valid: for most Go apps, all you have to do is compile a binary and copy it to the server - no Docker or other paraphernalia required. Of course that may not be so simple due to various reasons, but it helps to keep that possibility in mind...

> all you have to do is compile a binary and copy it to the server

Docker does this quite well, and solves a bunch of other problems you're likely to have regardless. One really simple example is "how do you copy it to the server?" Do you have ssh keys for your server on development machines? How do you handle the "Oh I'll just remote in and fix this one X"?

It's also _crazily_ easy to get started with, and handle middling amounts of scale. If you're on AWS, Elastic Beanstalk is plug and play. If you're not, DigitalOcean App platform will host it for you, with automated deployments from git for $5/month with basically no configuration needed from you.

Re: Containerize Go and SQLite with Docker

#59
post #53
post #39

I'm currently being forced to use Docker against my will, with exactly this setup. The CGO overhead every time the container is built is absurd, making developemnt and testing painful. I habe to try this article out, but it doesn't seem like it solves the problem. Does anyone have advice how to solve this without too much Docker magic?

Why are you forced? We rarely touch docker any more, even though our prod apps run on K8s.

It was a requirement for the project I was working on (even though I disagree).
Post reply on HN