Dependencies is not really a problem with Docker, nor the thing it is designed to solve. If dependencies was the problem people cared about, everyone would just go with the single statically linked executable/fat JAR and no one would ever be bothered with Docker.
Docker is primarily about containerization, but it's also about ease of packaging and deployment. It's also a deployment format that provides horizontal scaling for free.
Also, the one-database-per-service architecture pattern is quite common, as well as ephemeral databases and local caching, and keep in mind that SQLite also supports in-memory databases.
> It's also a deployment format that provides horizontal scaling for free.
Um. Docker does not provide horizontal scaling at all, for that you need orchestration. And those tools are anything but free if your time has any value.
Docker swarm mode is pretty good and terribly easy to get up and running in no time.
I have a few small personal projects hosted on Herzner on a couple of Docker swarm mode deployments with 100% uptime in the past two years, and all it took to get that infra up and running is installing Docker on a bare Linux node.
The only downside I'm aware is that inter-node traffic speeds can be relatively low.
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
The discussion of building fully static go binaries for docker has been rehashed a million times on the internet, the modernc.org/sqlite is at version 3+, so nothing in this should be new information for anyone that has an interest in the topic.
I strongly dislike this type of content that just repacks basic existing information and uses it as an excuse to click bait people on to a spammy blog.
A bunch of other options in the docs as well
[0]: https://kubernetes.io/docs/tasks/debug-application-cluster/d...
[1]: https://kubernetes.io/docs/tasks/configure-pod-container/sha...
I was originally turned onto this by a post on the repl.it blog about using Nix this way.
You can also do this with other build systems or using weird docker file hacks by hand.
Here's some idea of what the syntax looks like:
https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-supp...
At $work we use the following template. Sharing in case you find it interesting:
FROM golang:1.17.1-alpine3.14 as builder
RUN apk update && apk add ca-certificates curl git make tzdata
RUN adduser -u 5003 --gecos '' --disabled-password --no-create-home mycompany
COPY . /app
WORKDIR /app
RUN make build
FROM scratch
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /app/bin/app-3 /bin/app-3
COPY --from=builder /etc/passwd /etc/passwd
USER mycompany
CMD ["app-3"]
And a very simple makefile: help:
@echo "Please use 'make <target>' where <target> is one of the following:"
@echo " test to run unit tests."
@echo " build to build the app as a binary."
@echo " build-image to build the app container."
@echo " run to run the app with go."
run:
go run -ldflags="$(govvv -flags -pkg) -w -s" ./cmd/app-3/main.go
test:
go test -v -coverpkg=./... -coverprofile=profile.cov ./...
go tool cover -func profile.cov
rm profile.cov
build:
CGO_ENABLED=0 go build -mod=readonly -a -ldflags="$(govvv -flags -pkg $(go list ./info)) -w -s -linkmode external -extldflags '-static'" -o ./bin/app-3 ./cmd/app-3/*
build-image:
docker build -t mycompanytown/app-3:latest .See also: -trimpath
https://blog.filippo.io/shrink-your-go-binaries-with-this-on...
I mean sure, in theory you shouldn't get any of those in production, but no software is perfect.
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.
Has anyone actually used it?
If you haven't jumped on the bandwagon yet, don't do it. It's a sucker's game.
I got sucked into the Docker hype some years ago and the demos worked well enough in isolation.
I pushed it on a small team that didn't need it. One of the biggest regrets of my career.
Docker may be useful if an application has enormous reach and needs Google scale, but very few apps do.
1) It is incredibly slow to build
2) It is slow to run
3) It is an unbelievable resource hog
4) It has an entirely new set of problems (file system, networking, etc.) that must be understood to get it working
5) Hard deploy time dependency on Docker's web app?!
6) If you do not believe me on the complexity, just observe how docker arguments always seem to turn into k8s (or other orchestration) arguments. It is hard to reason about, hard to deploy, hard to coordinate.
K8s is a total disaster for a small team working on a small project.
We lost many months by choosing these tools for a startup that didn't (yet) need them, and the ongoing, neverending pile of problems and distractions they generated was shocking.
I still feel bad about it. The company could have run on a couple $400 machines under a desk for years, but instead spent tens of thousands on AWS services it didn't need.
Of course, YMMV
It sounds like (no offence) issues that containerization solved were missed and you had no dedicated operations/build-engineer guy on your team that could've explained/fixed these things for you and steer your infra in a right direction.
> I still feel bad about it. The company could have run on a couple $400 machines under a desk for years, but instead spent tens of thousands on AWS services it didn't need.
Does not sound like a docker issue. If you actually plan to run a money making business that your livelihood depends on, then running it under your desk is not something that you can reliably do even 10-15 years ago.
AWS is a money hog with a lot of things that are a distraction for a small project and it is easy to assume that their products are necessary to run your app effectively, but most often it is not. There is plenty of cloud providers that are not as expensive, and are much easier to manage compared to AWS.
> K8s is a total disaster for a small team working on a small project.
This is truly a YMMV thing. in my experience managed k8s for a small team can be a godsend for infra management after some level of complexity is reached, while self-hosted bare-metal k8s can utterly decimate the team. But again YMMV.
I am currently running several clusters of Nomad for different types of workloads each. CI, HPC, VM's, public facing services you name it. Containerization makes it all possible to run (mostly) single-handedly.