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

fix: check the correct port for the container #275

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JinsYin
Copy link

@JinsYin JinsYin commented Dec 17, 2024

What this PR changes/adds

Set up the correct health check for the Dockerfile.

Why it does that

When starting the container and changing the WEB_HTTP_PORT environment, the container is unhealthy.

Further notes

List other areas of code that have changed but are not necessarily linked to the main feature. This could be method
signature changes, package declarations, bugs that were encountered and were fixed inline, etc.

Linked Issue(s)

Closes #276

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are always happy to welcome new contributors ❤️ To make things easier for everyone, please make sure to follow our contribution guidelines, check if you have already signed the ECA, and relate this pull request to an existing issue or discussion.

@ndr-brt
Copy link
Member

ndr-brt commented Dec 17, 2024

@JinsYin please follow the contribution guide and do not propose PR out-of-the-blue: https://eclipse-edc.github.io/documentation/for-contributors/guidelines/pr-checklist/

(small doc fix PRs are accepted tho, as the one you opened on IdentityHub)

@JinsYin
Copy link
Author

JinsYin commented Dec 18, 2024

@ndr-brt I have made the necessary changes.

Copy link
Member

@ndr-brt ndr-brt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice since we're working here, to add a pair of tests in the pipeline that ensures that the containers are starting correctly.

@@ -17,7 +17,7 @@ EXPOSE 8182
ENV WEB_HTTP_PORT="8181"
ENV WEB_HTTP_PATH="/api"

HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:8181/api/check/health
HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:$WEB_HTTP_PORT/api/check/health
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could worth also to replace the /api with WEB_HTTP_PATH in the url

@@ -17,7 +17,7 @@ EXPOSE 8182
ENV WEB_HTTP_PORT="8181"
ENV WEB_HTTP_PATH="/api"

HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:8181/api/check/health
HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:$WEB_HTTP_PORT/api/check/health
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@ndr-brt ndr-brt added the build label Dec 18, 2024
@JinsYin
Copy link
Author

JinsYin commented Dec 18, 2024

@ndr-brt Thank you, I have made a new commit.

@@ -17,7 +17,7 @@ EXPOSE 8182
ENV WEB_HTTP_PORT="8181"
ENV WEB_HTTP_PATH="/api"

HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:8181/api/check/health
HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:$WEB_HTTP_PORT/$WEB_HTTP_PATH/check/health
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:$WEB_HTTP_PORT/$WEB_HTTP_PATH/check/health
HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:$WEB_HTTP_PORT$WEB_HTTP_PATH/check/health

please note that the PATH starts with a slash, so it should not be reported in the url

@@ -17,7 +17,7 @@ EXPOSE 8182
ENV WEB_HTTP_PORT="8181"
ENV WEB_HTTP_PATH="/api"

HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:8181/api/check/health
HEALTHCHECK --interval=5s --timeout=5s --retries=10 CMD curl --fail http://localhost:$WEB_HTTP_PORT/$WEB_HTTP_PATH/check/health
Copy link
Member

@ndr-brt ndr-brt Dec 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto. plus, as I said in my previous comment could you add a test for each of these dockerfile that will assert that the containers will start correctly? (tests already exist, so...) change launcher tests so they will verify also the healthcheck with a different port/path?

@ndr-brt
Copy link
Member

ndr-brt commented Dec 20, 2024

@JinsYin updated a comment of mine because tests already exist, but they should be improved to cover the case when the default http port/path are configured

@JinsYin
Copy link
Author

JinsYin commented Dec 20, 2024

@ndr-brt Thank you for your help. As I am not yet familiar with this code, I will need to spend some time.

@ndr-brt
Copy link
Member

ndr-brt commented Dec 20, 2024

@ndr-brt Thank you for your help. As I am not yet familiar with this code, I will need to spend some time.

NP, it's just a call to the docker command, you just need to adapt it as the one you reported in the issue and it should be enough:

docker run -d --rm --name fcc \
-e "WEB_HTTP_CATALOG_PORT=8183" \
-e "WEB_HTTP_CATALOG_PATH=/catalog" \
federated-catalog:mocked

Copy link

This pull request is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Dec 28, 2024
Copy link

github-actions bot commented Jan 4, 2025

This pull request was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions bot closed this Jan 4, 2025
@ndr-brt ndr-brt reopened this Jan 7, 2025
@ndr-brt
Copy link
Member

ndr-brt commented Jan 7, 2025

@JinsYin are your still committed to this pr?

@github-actions github-actions bot removed the stale label Jan 8, 2025
Copy link

This pull request is stale because it has been open for 7 days with no activity.

@github-actions github-actions bot added the stale label Jan 16, 2025
@ndr-brt ndr-brt removed the stale label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: container is unhealthy when changing the WEB_HTTP_PORT environment
2 participants