louislam / uptime-kuma

A fancy self-hosted monitoring tool
https://uptime.kuma.pet
MIT License
60.61k stars 5.41k forks source link

Help with mariadb config #4489

Closed yolabingo closed 9 months ago

yolabingo commented 9 months ago

⚠️ Please verify that this question has NOT been raised before.

🛡️ Security Policy

📝 Describe your problem

I would like to use external mariadb instead of sqlite. I think this is supported but cannot find working examples. Any guidance would be appreciated.

I tried setting UPTIME_KUMA_DB_* environment variables in docker-compose.yml to connect to a mariadb server:

services:
  uptime-kuma:
    image: louislam/uptime-kuma:1.23.11-debian
    container_name: uptime-kuma
    ports:
      - 3001:3001
    depends_on:
      - db
    environment:
      UPTIME_KUMA_DB_TYPE: mariadb
      UPTIME_KUMA_DB_HOSTNAME: db
      UPTIME_KUMA_DB_PORT: 3306
      UPTIME_KUMA_DB_USERNAME: kumauser
      UPTIME_KUMA_DB_PASSWORD: kumapass
      UPTIME_KUMA_DB_NAME: kumadb
      UPTIME_KUMA_IN_CONTAINER: "true"

  db:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: admin
      MYSQL_DATABASE: kumadb
      MYSQL_USER: kumauser
      MYSQL_PASSWORD: kumapass
    ports:
      - "3306:3306"

based on https://github.com/louislam/uptime-kuma/blob/master/server/setup-database.js#L71-L81

But uptime-kuma still seems to use sqlite

[DB] INFO: Data Dir: ./data/
[DB] INFO: SQLite Version: 3.41.1

This env var UPTIME_KUMA_ENABLE_EMBEDDED_MARIADB (2.0.0) Set 1 to enable is mentioned in the docs https://github.com/louislam/uptime-kuma/wiki/Environment-Variables

but it is not clear to me how to use it. I would prefer to use external mariadb but at this point I'm looking for guidance on if/how I can use mariadb in any way.

Thanks in advance!

📝 Error Message(s) or Log

no errors

uptime-kuma  | 2024-02-13T22:48:08Z [SERVER] INFO: Version: 1.23.11
uptime-kuma  | 2024-02-13T22:48:08Z [DB] INFO: Data Dir: ./data/
uptime-kuma  | 2024-02-13T22:48:08Z [SERVER] INFO: Connecting to the Database
uptime-kuma  | 2024-02-13T22:48:08Z [DB] INFO: SQLite config:
uptime-kuma  | [ { journal_mode: 'wal' } ]
uptime-kuma  | [ { cache_size: -12000 } ]
uptime-kuma  | 2024-02-13T22:48:08Z [DB] INFO: SQLite Version: 3.41.1
uptime-kuma  | 2024-02-13T22:48:08Z [SERVER] INFO: Connected
uptime-kuma  | 2024-02-13T22:48:08Z [DB] INFO: Your database version: 10

🐻 Uptime-Kuma Version

1.23.11

💻 Operating System and Arch

louislam/uptime-kuma:1.23.11-debian Docker container

🌐 Browser

all

🖥️ Deployment Environment

chakflying commented 9 months ago

Running on mariadb is not supported for 1.X versions. 2.0 is not released yet as it is still being worked on (#4171).

CommanderStorm commented 9 months ago

This is a bit misleadingly documented indeed. With (2.0.0) we mean that said feature is only available AFTER said version. I don't know if/how this needs changing, since this is in the For Development only section.

We are currently in the process of finalising said release and publishing 2.0.0-beta.0 See https://github.com/louislam/uptime-kuma/pull/4171 for the bugs that still require addressing before this can happen.