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

Add curl for basic healthcheck #2186

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

dvanderveer
Copy link
Contributor

Description

This change adds curl to the lemmy-ui container for basic Docker healthcheck purposes. The lemmy.world admins would like this as it can give more immediate feedback when performing site maintenance.

Before

Without the change, any Docker healthcheck using curl will fail because the the command does not exist inside the container:

$ grep -A2 lemmy-ui docker-compose.yml
  lemmy-ui:
    image: dessalines/lemmy-ui:0.18.5
    healthcheck:
      test: curl -f http://127.0.0.1:1234 || exit 1

After

With the change, a simple curl healthcheck shows the lemmy-ui container as healthy when correctly configured:

$ grep -A5 lemmy-ui docker-compose.yml
  lemmy-ui:
    image: dvlemmyui
    healthcheck:
      test: curl -f http://127.0.0.1:1234 || exit 1
    environment:
      - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
$ docker ps | grep lemmy-ui
5691ba6273d2   dvlemmyui                 "docker-entrypoint.s…"   About a minute ago   Up About a minute (healthy)   127.0.0.1:1235->1234/tcp   selfhost_lemmy-ui_1

And a misconfigured lemmy-ui container shows as unhealthy:

$ grep -A5 lemmy-ui docker-compose.yml
  lemmy-ui:
    image: dvlemmyui
    healthcheck:
      test: curl -f http://127.0.0.1:1234 || exit 1
    environment:
      - LEMMY_UI_LEMMY_INTERNAL_HOST=doesnt.exist:8536
$ docker ps | grep lemmy-ui
090161ee9d14   dvlemmyui                 "docker-entrypoint.s…"   About a minute ago   Up About a minute (unhealthy)   127.0.0.1:1235->1234/tcp   selfhost_lemmy-ui_1

@SleeplessOne1917 SleeplessOne1917 merged commit 68f0b65 into LemmyNet:main Oct 19, 2023
@dvanderveer dvanderveer deleted the healthcheck branch October 20, 2023 02:15
dvanderveer added a commit to Fedihosting-Foundation-Forks/lemmy-ui that referenced this pull request Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants