Generate Database without launching the server #3336

Closed
opened 2026-02-28 03:26:03 -05:00 by deekerman · 4 comments
Owner

Originally created by @tedivm on GitHub (May 13, 2024).

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

  • I checked and didn't find similar issue

🛡️ Security Policy

📝 Describe your problem

Is there a way to generate the database/migrations without launching the server? I'm hoping to follow this flow:

  1. Generate Database
  2. Due custom stuff to database
  3. Launch server

I'm not as used to javascript as I am other languages like python so I'm running into some difficulty figuring out how to just create the database. Any help would be appreciated!

📝 Error Message(s) or Log

No response

🐻 Uptime-Kuma Version

1.23.13

💻 Operating System and Arch

Docker

🌐 Browser

Firefox

🖥️ Deployment Environment

  • Runtime:
  • Database:
  • Filesystem used to store the database on:
  • number of monitors:
Originally created by @tedivm on GitHub (May 13, 2024). ### ⚠️ Please verify that this question has NOT been raised before. - [X] I checked and didn't find similar issue ### 🛡️ Security Policy - [X] I agree to have read this project [Security Policy](https://github.com/louislam/uptime-kuma/security/policy) ### 📝 Describe your problem Is there a way to generate the database/migrations without launching the server? I'm hoping to follow this flow: 1. Generate Database 2. Due custom stuff to database 3. Launch server I'm not as used to javascript as I am other languages like python so I'm running into some difficulty figuring out how to just create the database. Any help would be appreciated! ### 📝 Error Message(s) or Log _No response_ ### 🐻 Uptime-Kuma Version 1.23.13 ### 💻 Operating System and Arch Docker ### 🌐 Browser Firefox ### 🖥️ Deployment Environment - Runtime: - Database: - Filesystem used to store the database on: - number of monitors:
deekerman 2026-02-28 03:26:03 -05:00
  • closed this issue
  • added the
    help
    label
Author
Owner

@CommanderStorm commented on GitHub (May 13, 2024):

I think this is an XY-Problem.

=> What are you trying to do in the first place? You forgot the WHY.

Reaching into the database is the most brittle way to configure us that I can think of.
You are inherently making yourself tied to a minor version and cannot expect us to respect semver for internal behaviour (such as db layout).

Tip

In case you are looking for an API, please have a look at BigBoot/AutoKuma (cli or docker automation) or uptime-kuma-api
An official REST-API is coming, but is a few releases off still. See #118 for further details

@CommanderStorm commented on GitHub (May 13, 2024): I think this is an [XY-Problem](https://en.wikipedia.org/wiki/XY_problem). => What are you trying to do in the first place? You forgot the WHY. Reaching into the database is the most brittle way to configure us that I can think of. You are inherently making yourself tied to a minor version and cannot expect us to respect semver for internal behaviour (such as db layout). > [!TIP] > In case you are looking for an API, please have a look at [`BigBoot/AutoKuma`](https://github.com/BigBoot/AutoKuma) (cli or docker automation) or [`uptime-kuma-api`](https://pypi.org/project/uptime-kuma-api/) > An official REST-API is coming, but is a few releases off still. See #118 for further details
Author
Owner

@tedivm commented on GitHub (May 13, 2024):

The why is simple: I want to be able to bootstrap a bunch of images at once without having to manually configure them. I'm okay with tying myself to a minor version for the initial launch.

@tedivm commented on GitHub (May 13, 2024): The why is simple: I want to be able to bootstrap a bunch of images at once without having to manually configure them. I'm okay with tying myself to a minor version for the initial launch.
Author
Owner

@tedivm commented on GitHub (May 13, 2024):

Here's a simple use case. I would like to set the username and password for the inital admin user programmatically. The "npm run reset-password" script only works if the database is already configured.

  1. Create Database
  2. Set password using built in script
  3. Continue launching server

This use case requires no direct database changes or access, and simply uses the scripts provided to ensure the first admin users are created before opening connections up to anyone.

@tedivm commented on GitHub (May 13, 2024): Here's a simple use case. I would like to set the username and password for the inital admin user programmatically. The "npm run reset-password" script only works if the database is already configured. 1. Create Database 2. Set password using built in script 3. Continue launching server This use case requires no direct database changes or access, and simply uses the scripts provided to ensure the first admin users are created before opening connections up to anyone.
Author
Owner

@CommanderStorm commented on GitHub (May 13, 2024):

you can generate the intial databas via

export DOCKER_ID=`docker run --rm -d -v ./uptime-kuma:/app/data louislam/uptime-kuma:1 | tail -1`
sleep 60 # higher than nessesary, can be tuned 
docker stop $DOCKER_ID
@CommanderStorm commented on GitHub (May 13, 2024): you can generate the intial databas via ```bash export DOCKER_ID=`docker run --rm -d -v ./uptime-kuma:/app/data louislam/uptime-kuma:1 | tail -1` sleep 60 # higher than nessesary, can be tuned docker stop $DOCKER_ID ```
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/uptime-kuma#3336
No description provided.