Hacker News new | ask | show | jobs
by matthews2 789 days ago
Zero dependencies seems like a weird selling point, especially since it depends on Clap, Tokio, a Rust compiler...

A neat project, though. I think that this is best solved in the application itself (e.g. your server starts but returns HTTP errors while the database is unavailable), but being able to retrofit this behaviour into any existing application seems useful. Feels like something very similar should be built into tools like docker-compose.

6 comments

>Feels like something very similar should be built into tools like docker-compose.

In docker compose you can use `depends_on` [0] to define dependencies between containers and by default it will wait until a dependent container is "ready".

But you can also use a more verbose syntax to wait until a container is "healthy", as defined by its own healthcheck.

    services:
      web:
        depends_on:
          db:
            condition: service_healthy
      db:
        image: postgres

[0] https://docs.docker.com/compose/compose-file/05-services/#de...
That's true.

For example, in the case of PostgreSQL, there is already a tool called pg_isready [0] to do this inside a healthcheck as you described.

services: postgres-db: image: postgres healthcheck: test: ["CMD-SHELL", "pg_isready -U postgres"]

  application:
    image: image
    depends_on:
      postgres-db:
        condition: service_healthy
However, this is not the case for other databases/services.

[0] https://www.postgresql.org/docs/current/app-pg-isready.html

Regarding zero dependencies, I meant that it is a static binary and does not need any external tools to be installed. For example, some alternatives require netcat to be installed.
This is fine, and what I understood from "zero dependencies", that I can drop it in a directory and it'll just work. As far as I'm concerned, this complaint is moot.
I took the statement to imply no runtime dependencies, as no compile-time dependencies doesn’t really make sense.
The Linux kernel itself to handle the syscalls is probably also implied in this.
glibc ftw
The IMO superior https://github.com/F1bonacc1/process-compose project has this built in, while allowing to manage regular programs that don't require containers.

See: https://f1bonacc1.github.io/process-compose/health/?h=port#r...

`process-compose` is a "scheduler and orchestrator". `is_ready` only checks for services to be ready so it seems great when you want to start the services by other means and wait for them to be avialabe (for example, services started in another node of a cluster).
I have systemd manage my containers and system processes. Are there any benefits to process-compose over just using systemd?
It works on MacOS/Windows, unlike systemd. Therefore it's well suited for development environment setups for polyglot teams.

https://devenv.sh/ is one example that uses it to do just that.

Interesting project, I was not familiar with that. Thanks for letting me know :)
Colloquially a lot of people understand “zero dependencies” to mean “you don’t have to deal with pip/virtualenv/npm/yarn” BS. So, a static binary.
> Zero dependencies seems like a weird selling point, especially since it depends on Clap, Tokio, a Rust compiler...

Came here to make the same comment. 0 dependencies would mean/infer (at least, to me) a lack of any dependencies but that doesn't seem to be the case[1]. There are 30 matches for the word `dependencies`.

[1] - https://github.com/Stavrospanakakis/is_ready/blob/main/Cargo...

When you see someone advertise a tool to put in your containers to do something, why are you immediately thinking "no compile-time dependencies", rather than "no runtime dependencies"?
> When you see someone advertise a tool to put in your containers to do something...

The title claims "0 dependencies", not "0 runtime dependencies" nor "0 compile-time dependencies". In other words, the word dependencies - by itself - is encompassing both runtime and compile-time dependencies.

Think of reading the title at face-value - but as if someone else had written it, with no exposure to your project, its use-case, behaviour, etc. - before it was read.

Someone else did write it, and I didn't have any exposure to the project, use case, behaviour, etc, before I read it.
Ah, thought you were the OP. That's my bad.

The "dependencies" point still stands, though, in that the term - generally - encompasses both.

To be honest, I wanted to make the title more specific regarding dependencies but the title was already too big.