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

Docker compose update erased the database #5549

Open
2 tasks done
brunoamaral opened this issue Jan 18, 2025 · 3 comments
Open
2 tasks done

Docker compose update erased the database #5549

brunoamaral opened this issue Jan 18, 2025 · 3 comments
Labels

Comments

@brunoamaral
Copy link

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

  • I checked and didn't find similar issue

🛡️ Security Policy

📝 Describe your problem

Maybe this was a miss step on my part.

docker-compose.yaml

services:
  uptime-kuma:
    image: louislam/uptime-kuma:1
    container_name: uptime-kuma
    volumes:
      - ./data:/app/data
    ports:
      - "3002:3001"
    restart: always

Then when updating with docker compose pull, docker compose up -d the container was recreated and the database left blank.

📝 Error Message(s) or Log

No response

🐻 Uptime-Kuma Version

1.23.16

💻 Operating System and Arch

Ubuntu 22.04.5

🌐 Browser

Any

🖥️ Deployment Environment

  • Runtime: Docker version 27.4.0, build bde2b89
  • Database: sqlite
  • Filesystem used to store the database on: ext4
  • number of monitors: 5 - 7.
@homelab-alpha
Copy link
Contributor

@brunoamaral, To ensure data is stored persistently in Docker, you need to map a folder in the docker-compose.yml file. Replace /your/storage/location with a path that fits your system structure.

Example Configuration:

volumes:
  - /your/storage/location/uptime-kuma:/app/data

This setup ensures that data within the container is preserved across restarts and upgrades.

@brunoamaral
Copy link
Author

@homelab-alpha that is already a part of my docker-compose.yaml:

    volumes:
      - ./data:/app/data

And still the data didn't persist for some reason.

@homelab-alpha
Copy link
Contributor

homelab-alpha commented Jan 18, 2025

@brunoamaral, There is a difference between:

volumes:
  - ./data:/app/data

and:

volumes:
  - /your/storage/location/uptime-kuma:/app/data

With your approach (./data:/app/data), the compose file needs to be located in the same folder structure as the specified directory (./data). This makes it dependent on the location of the compose file.

With my suggestion (/your/storage/location/uptime-kuma:/app/data), this dependency is eliminated, and the chance of making a mistake is significantly smaller. You can explicitly define the storage location independently of the compose file.

EDIT:

By default, Uptime Kuma uses kuma.db as the database name.

Below are the commands to search for the kuma.db file across different operating systems:

Ubuntu / Debian / RHEL / Fedora (Linux)

find / -name kuma.db

Windows (PowerShell)

Get-ChildItem -Recurse -Filter kuma.db -Path C:\

macOS

sudo find / -name kuma.db

On Linux and macOS, the find command is used to search starting from the root (/). On Windows, the Get-ChildItem command in PowerShell is the appropriate option.

As long as the database hasn’t been permanently deleted, you can locate the Uptime Kuma Database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants