Skip to content

Add healthcheck commands to docker-compose.yml#9143

Merged
Gargron merged 1 commit intomastodon:masterfrom
BenLubar-PR:docker-compose-healthcheck
Dec 28, 2018
Merged

Add healthcheck commands to docker-compose.yml#9143
Gargron merged 1 commit intomastodon:masterfrom
BenLubar-PR:docker-compose-healthcheck

Conversation

@BenLubar
Copy link
Copy Markdown
Contributor

This will allow Docker to be automatically check the health of services.

Docker won't do anything other than showing the state in the output of docker-compose ps by default, but some management tools may watch for container health events.

Here's what my local instance looks like right now:

          Name                        Command                  State                     Ports
-------------------------------------------------------------------------------------------------------------
mastodon_db_1              docker-entrypoint.sh postgres    Up (healthy)
mastodon_es_1              /usr/local/bin/docker-entr ...   Up (healthy)
mastodon_redis_1           docker-entrypoint.sh redis ...   Up (healthy)
mastodon_redis_cache_1     docker-entrypoint.sh redis ...   Up (healthy)
mastodon_sidekiq_1         /sbin/tini -- bundle exec  ...   Up             3000/tcp, 4000/tcp
mastodon_streaming_1       /sbin/tini -- yarn start         Up (healthy)   3000/tcp, 127.0.0.1:4000->4000/tcp
mastodon_web_1             /sbin/tini -- bash -c rm - ...   Up (healthy)   127.0.0.1:3000->3000/tcp, 4000/tcp

This will allow Docker to be automatically check the health of services.

Docker won't do anything other than showing the state in the output of
"docker-compose ps" by default, but some management tools may watch for
container health events.

Here's what my local instance looks like right now:

          Name                        Command                  State                     Ports
-------------------------------------------------------------------------------------------------------------
mastodon_db_1              docker-entrypoint.sh postgres    Up (healthy)
mastodon_es_1              /usr/local/bin/docker-entr ...   Up (healthy)
mastodon_redis_1           docker-entrypoint.sh redis ...   Up (healthy)
mastodon_redis_cache_1     docker-entrypoint.sh redis ...   Up (healthy)
mastodon_sidekiq_1         /sbin/tini -- bundle exec  ...   Up             3000/tcp, 4000/tcp
mastodon_streaming_1       /sbin/tini -- yarn start         Up (healthy)   3000/tcp, 127.0.0.1:4000->4000/tcp
mastodon_web_1             /sbin/tini -- bash -c rm - ...   Up (healthy)   127.0.0.1:3000->3000/tcp, 4000/tcp
Comment thread docker-compose.yml
networks:
- internal_network
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why should we specify these explicitly? shouldn't these be part of the postgres docker image?

@nightpool
Copy link
Copy Markdown
Member

why was sidekiq excluded?

@Gargron Gargron merged commit 9b475a4 into mastodon:master Dec 28, 2018
@Gargron
Copy link
Copy Markdown
Member

Gargron commented Dec 28, 2018

@nightpool I don't know how you could check Sidekiq health from a script. It's not like it accepts connections...

hiyuki2578 pushed a commit to ProjectMyosotis/mastodon that referenced this pull request Oct 2, 2019
This will allow Docker to be automatically check the health of services.

Docker won't do anything other than showing the state in the output of
"docker-compose ps" by default, but some management tools may watch for
container health events.

Here's what my local instance looks like right now:

          Name                        Command                  State                     Ports
-------------------------------------------------------------------------------------------------------------
mastodon_db_1              docker-entrypoint.sh postgres    Up (healthy)
mastodon_es_1              /usr/local/bin/docker-entr ...   Up (healthy)
mastodon_redis_1           docker-entrypoint.sh redis ...   Up (healthy)
mastodon_redis_cache_1     docker-entrypoint.sh redis ...   Up (healthy)
mastodon_sidekiq_1         /sbin/tini -- bundle exec  ...   Up             3000/tcp, 4000/tcp
mastodon_streaming_1       /sbin/tini -- yarn start         Up (healthy)   3000/tcp, 127.0.0.1:4000->4000/tcp
mastodon_web_1             /sbin/tini -- bash -c rm - ...   Up (healthy)   127.0.0.1:3000->3000/tcp, 4000/tcp
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.

3 participants