[GH-ISSUE #612] Persist DB using docker hub image #447

Closed
opened 2026-02-25 23:42:29 +03:00 by kerem · 4 comments
Owner

Originally created by @DierlysCSRodrigues on GitHub (Feb 25, 2022).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/612

Hi

First, congratulations for the work!

A question ..

I'm trying to use the docker hub image, to upload the tool in a production environment.

However, as described, this image instantiates a disposable SQLite database.

Is there any way to use this image and persist the DB using postgres or MySQL?

https://hub.docker.com/r/healthchecks/healthchecks

Originally created by @DierlysCSRodrigues on GitHub (Feb 25, 2022). Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/612 Hi First, congratulations for the work! A question .. I'm trying to use the docker hub image, to upload the tool in a production environment. However, as described, this image instantiates a disposable SQLite database. Is there any way to use this image and persist the DB using postgres or MySQL? https://hub.docker.com/r/healthchecks/healthchecks
kerem closed this issue 2026-02-25 23:42:29 +03:00
Author
Owner

@cuu508 commented on GitHub (Feb 25, 2022):

Yes, you can configure it to use a PostgreSQL or MySQL database using environment variables. See the variables that start with "DB_" here: https://healthchecks.io/docs/self_hosted_configuration/

<!-- gh-comment-id:1051135624 --> @cuu508 commented on GitHub (Feb 25, 2022): Yes, you can configure it to use a PostgreSQL or MySQL database using environment variables. See the variables that start with "DB_" here: https://healthchecks.io/docs/self_hosted_configuration/
Author
Owner

@P4sca1 commented on GitHub (Mar 3, 2022):

When using MySQL, this will fail, because mysqlclient is missing in requirements.txt.

<!-- gh-comment-id:1057525609 --> @P4sca1 commented on GitHub (Mar 3, 2022): When using MySQL, this will fail, because mysqlclient is missing in `requirements.txt`.
Author
Owner

@DierlysCSRodrigues commented on GitHub (Mar 9, 2022):

When using MySQL, this will fail, because mysqlclient is missing in requirements.txt.

Very well observed @P4sca1. I was able to perform the persistence using PostgreSQL. I'll leave the example of my compose:

services:
  db-hc:
    image: postgres:12
    environment:
      - POSTGRES_DB=hc
      - DB_USER=postgres
      - POSTGRES_PASSWORD=my_password
    volumes:
      - /docker/volumes/db-hc-data/data:/var/lib/postgresql/data
    networks:
      - hc-net
    ports:
      - 5432:5432

  app-hc:
    image: healthchecks/healthchecks
    deploy:
      resources:
        limits:
          cpus: '0.50'
          memory: 1024M
    environment:
      # CONFIG DB
      - DB=postgres
      - DB_CONN_MAX_AGE=0
      - DB_HOST=db-hc
      - DB_NAME=hc
      - DB_PASSWORD=my_password
      - DB_PORT=5432
      - DB_SSLMODE=prefer
      - DB_TARGET_SESSION_ATTRS=read-write
      - DB_USER=postgres

      # CONFIG WEB
      - DEBUG=False
      - SITE_NAME=my_site_name
      - SITE_ROOT=http://localhost:8000

      # CONFIG E-MAIL
      - DEFAULT_FROM_EMAIL=my.email@my.domain.com
      - EMAIL_HOST=my_smtp_server
      - EMAIL_HOST_PASSWORD=my_password
      - EMAIL_HOST_USER=my.email@my.domain.com
      - EMAIL_PORT=587
      - EMAIL_USE_TLS=True
      - EMAIL_USE_VERIFICATION=True
      - SECRET_KEY=my_secret_key 
    ports:
      - 8000:8000
    networks:
      - hc-net
    depends_on:
      - db-hc

networks:
  hc-net:
    driver: overlay

volumes:
  db-hc-data:

<!-- gh-comment-id:1062896039 --> @DierlysCSRodrigues commented on GitHub (Mar 9, 2022): > When using MySQL, this will fail, because mysqlclient is missing in `requirements.txt`. Very well observed @P4sca1. I was able to perform the persistence using PostgreSQL. I'll leave the example of my compose: # ``` services: db-hc: image: postgres:12 environment: - POSTGRES_DB=hc - DB_USER=postgres - POSTGRES_PASSWORD=my_password volumes: - /docker/volumes/db-hc-data/data:/var/lib/postgresql/data networks: - hc-net ports: - 5432:5432 app-hc: image: healthchecks/healthchecks deploy: resources: limits: cpus: '0.50' memory: 1024M environment: # CONFIG DB - DB=postgres - DB_CONN_MAX_AGE=0 - DB_HOST=db-hc - DB_NAME=hc - DB_PASSWORD=my_password - DB_PORT=5432 - DB_SSLMODE=prefer - DB_TARGET_SESSION_ATTRS=read-write - DB_USER=postgres # CONFIG WEB - DEBUG=False - SITE_NAME=my_site_name - SITE_ROOT=http://localhost:8000 # CONFIG E-MAIL - DEFAULT_FROM_EMAIL=my.email@my.domain.com - EMAIL_HOST=my_smtp_server - EMAIL_HOST_PASSWORD=my_password - EMAIL_HOST_USER=my.email@my.domain.com - EMAIL_PORT=587 - EMAIL_USE_TLS=True - EMAIL_USE_VERIFICATION=True - SECRET_KEY=my_secret_key ports: - 8000:8000 networks: - hc-net depends_on: - db-hc networks: hc-net: driver: overlay volumes: db-hc-data: ```
Author
Owner

@cuu508 commented on GitHub (Mar 18, 2022):

I released a new version of Healthchecks (v2.0.1) and published new Docker images. The images now have mysqlclient preinstalled.

<!-- gh-comment-id:1072431231 --> @cuu508 commented on GitHub (Mar 18, 2022): I released a new version of Healthchecks (v2.0.1) and published new Docker images. The images now have mysqlclient preinstalled.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/healthchecks#447
No description provided.