mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-22 04:01:27 +00:00
fix: rename prometheus to monitoring
This commit is contained in:
parent
fc5c85e81a
commit
d0aec6cd06
|
@ -15,12 +15,12 @@ from selfprivacy_api.migrations.check_for_system_rebuild_jobs import (
|
||||||
CheckForSystemRebuildJobs,
|
CheckForSystemRebuildJobs,
|
||||||
)
|
)
|
||||||
from selfprivacy_api.migrations.add_roundcube import AddRoundcube
|
from selfprivacy_api.migrations.add_roundcube import AddRoundcube
|
||||||
from selfprivacy_api.migrations.add_prometheus import AddPrometheus
|
from selfprivacy_api.migrations.add_monitoring import AddMonitoring
|
||||||
|
|
||||||
migrations = [
|
migrations = [
|
||||||
WriteTokenToRedis(),
|
WriteTokenToRedis(),
|
||||||
CheckForSystemRebuildJobs(),
|
CheckForSystemRebuildJobs(),
|
||||||
AddPrometheus(),
|
AddMonitoring(),
|
||||||
AddRoundcube(),
|
AddRoundcube(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -4,33 +4,33 @@ from selfprivacy_api.services.flake_service_manager import FlakeServiceManager
|
||||||
from selfprivacy_api.utils import ReadUserData, WriteUserData
|
from selfprivacy_api.utils import ReadUserData, WriteUserData
|
||||||
|
|
||||||
|
|
||||||
class AddPrometheus(Migration):
|
class AddMonitoring(Migration):
|
||||||
"""Adds the Prometheus if it is not present."""
|
"""Adds monitoring service if it is not present."""
|
||||||
|
|
||||||
def get_migration_name(self) -> str:
|
def get_migration_name(self) -> str:
|
||||||
return "add_prometheus"
|
return "add_monitoring"
|
||||||
|
|
||||||
def get_migration_description(self) -> str:
|
def get_migration_description(self) -> str:
|
||||||
return "Adds the Prometheus if it is not present."
|
return "Adds the Monitoring if it is not present."
|
||||||
|
|
||||||
def is_migration_needed(self) -> bool:
|
def is_migration_needed(self) -> bool:
|
||||||
with FlakeServiceManager() as manager:
|
with FlakeServiceManager() as manager:
|
||||||
if "prometheus" not in manager.services:
|
if "monitoring" not in manager.services:
|
||||||
return True
|
return True
|
||||||
with ReadUserData() as data:
|
with ReadUserData() as data:
|
||||||
if "prometheus" not in data["modules"]:
|
if "monitoring" not in data["modules"]:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def migrate(self) -> None:
|
def migrate(self) -> None:
|
||||||
with FlakeServiceManager() as manager:
|
with FlakeServiceManager() as manager:
|
||||||
if "prometheus" not in manager.services:
|
if "monitoring" not in manager.services:
|
||||||
manager.services[
|
manager.services[
|
||||||
"prometheus"
|
"monitoring"
|
||||||
] = "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/prometheus"
|
] = "git+https://git.selfprivacy.org/SelfPrivacy/selfprivacy-nixos-config.git?ref=flakes&dir=sp-modules/monitoring"
|
||||||
with WriteUserData() as data:
|
with WriteUserData() as data:
|
||||||
if "prometheus" not in data["modules"]:
|
if "monitoring" not in data["modules"]:
|
||||||
data["modules"]["prometheus"] = {
|
data["modules"]["monitoring"] = {
|
||||||
"enable": False,
|
"enable": False,
|
||||||
"subdomain": "prometheus",
|
"subdomain": "monitoring",
|
||||||
}
|
}
|
Loading…
Reference in a new issue