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

Generate Database without launching the server #4758

Closed
2 tasks done
tedivm opened this issue May 13, 2024 · 4 comments
Closed
2 tasks done

Generate Database without launching the server #4758

tedivm opened this issue May 13, 2024 · 4 comments
Labels

Comments

@tedivm
Copy link

tedivm commented 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:
@tedivm tedivm added the help label May 13, 2024
@CommanderStorm
Copy link
Collaborator

CommanderStorm commented 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

@tedivm
Copy link
Author

tedivm commented 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
Copy link
Author

tedivm commented 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.

@CommanderStorm
Copy link
Collaborator

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

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