Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide healthcheck feature in Docker image #1666

Open
dkarlovi opened this issue Sep 5, 2022 · 8 comments
Open

Provide healthcheck feature in Docker image #1666

dkarlovi opened this issue Sep 5, 2022 · 8 comments
Assignees
Labels
docker enhancement New feature or request

Comments

@dkarlovi
Copy link

dkarlovi commented Sep 5, 2022

Which service(blob, file, queue, table) does this issue concern?

Blob.

Which version of the Azurite was used?

3.19.0

Where do you get Azurite? (npm, DockerHub, NuGet, Visual Studio Code Extension)

DockerHub

What's the Node.js version?

In Docker image.

What problem was encountered?

When running in CI, the sequencing needs to be done correctly. This means the tests with the storage will try to use it at some point where it might or might not have already started.

When running with Docker, the common solution is to provide a healthcheck.

Steps to reproduce the issue?

Start Azurite in Docker and attempt to use it immediately from another process, the requests have a 50%-50% chance to fail since the process is not fully started yet.

Have you found a mitigation/solution?

Creating a healthcheck yourself.

Example Docker Compose file with healthcheck:

services:
    storage:
        image: mcr.microsoft.com/azure-storage/azurite:3.19.0
        healthcheck: 
            test: nc 127.0.0.1 10000 -z
            interval: 1s
            retries: 30
@blueww blueww self-assigned this Sep 6, 2022
@blueww blueww added the question Further information is requested label Sep 6, 2022
@blueww
Copy link
Member

blueww commented Sep 6, 2022

@dkarlovi

Thanks for raising this issue!
It looks you have already found a way to resolve this.

Feel free to raise if any further Azurite support needed.

@dkarlovi
Copy link
Author

dkarlovi commented Sep 6, 2022

Hey @blueww, you mistakenly tagged both of my created issues as questions, these are feature suggestions, there's no question asked here.

@blueww blueww added enhancement New feature or request docker and removed question Further information is requested labels Sep 7, 2022
@blueww
Copy link
Member

blueww commented Sep 7, 2022

@dkarlovi

Would you please describe what's the detail change you would like Azurite to take?

Azurite welcome contribution!
It would be great if you can raise a PR to add the new features to Azurite!

@dkarlovi
Copy link
Author

dkarlovi commented Sep 7, 2022

@blueww in short, Azurite should be able to answer a query if it's fully running or not (as in, init ready, sockets opened, ready for queries).

This could be done with having a dedicated HTTP endpoint (ie. /_health) or answer to a signal (say, SIGUSR1 or both, to confirm it's fully booted (or not).

Then, either one of the mechanisms would be either added to Dockerfile, like so

HEALTHCHECK ["kill", "-s", "USR1", "1"]

and the Docker image users could rely on

depends_on:
    azurite_container:
        condition: service_healthy

without needing to do anything themselves.

@blueww
Copy link
Member

blueww commented Sep 8, 2022

@dkarlovi

Thanks for the clarification!

Azurite welcome contribution!
It would be great if you could raise a PR to add the new features to Azurite!

@bogdanobogeanu
Copy link

Hello,

Was this implemented? Something like /_health, that dkarlovi mentioned?
I want to implement azurite into a hybris container and to expose it from AWS via an Application load balancer and without a health check, target groups will remain unhealthy and the connections will not be routed to NLB and container.

@dkarlovi
Copy link
Author

@bogdanobogeanu see #1665 (comment) as a poor-person's version of it.

@LeonardHd
Copy link

LeonardHd commented Jun 18, 2024

Have you found a mitigation/solution?

Creating a healthcheck yourself.

Example Docker Compose file with healthcheck:

services:
    storage:
        image: mcr.microsoft.com/azure-storage/azurite:3.19.0
        healthcheck: 
            test: nc 127.0.0.1 10000 -z
            interval: 1s
            retries: 30

@dkarlovi this worked for us thanks.

We had an issue with azurite not being ready when starting azurite via docker compose with -d. A health check would be great to have!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docker enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants