Generate Database without launching the server
tedivm opened this issue Β· comments
β οΈ Please verify that this question has NOT been raised before.
- I checked and didn't find similar issue
π‘οΈ Security Policy
- I agree to have read this project 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:
- Generate Database
- Due custom stuff to database
- 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:
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
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.
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.
- Create Database
- Set password using built in script
- 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.
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