Add settings to allow detaching integrations server (#3203)
To run a detached integrations server: 1. Set env var `DETACHED_INTEGRATIONS_SERVER=True` 2. Run engine with the `integrations_urls.py` root url conf (e.g. `ROOT_URLCONF=engine.integrations_urls python manage.py runserver 0.0.0.0:8081`)
This commit is contained in:
parent
a1a318c819
commit
11259de8e0
3 changed files with 20 additions and 5 deletions
9
engine/engine/integrations_urls.py
Normal file
9
engine/engine/integrations_urls.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from django.urls import URLPattern, URLResolver, include, path
|
||||
|
||||
from .urls import paths_to_work_even_when_maintenance_mode_is_active
|
||||
|
||||
urlpatterns: list[URLPattern | URLResolver] = paths_to_work_even_when_maintenance_mode_is_active
|
||||
|
||||
urlpatterns += [
|
||||
path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")),
|
||||
]
|
||||
|
|
@ -15,20 +15,24 @@ Including another URLconf
|
|||
"""
|
||||
from django.conf import settings
|
||||
from django.conf.urls.static import static
|
||||
from django.urls import include, path
|
||||
from django.urls import URLPattern, URLResolver, include, path
|
||||
|
||||
from .views import HealthCheckView, MaintenanceModeStatusView, ReadinessCheckView, StartupProbeView
|
||||
|
||||
paths_to_work_even_when_maintenance_mode_is_active = [
|
||||
paths_to_work_even_when_maintenance_mode_is_active: list[URLPattern | URLResolver] = [
|
||||
path("", HealthCheckView.as_view()),
|
||||
path("health/", HealthCheckView.as_view()),
|
||||
path("ready/", ReadinessCheckView.as_view()),
|
||||
path("startupprobe/", StartupProbeView.as_view()),
|
||||
path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")),
|
||||
path("api/internal/v1/maintenance-mode-status", MaintenanceModeStatusView.as_view()),
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
if not settings.DETACHED_INTEGRATIONS_SERVER:
|
||||
paths_to_work_even_when_maintenance_mode_is_active += [
|
||||
path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")),
|
||||
]
|
||||
|
||||
urlpatterns: list[URLPattern | URLResolver] = [
|
||||
*paths_to_work_even_when_maintenance_mode_is_active,
|
||||
path("api/gi/v1/", include("apps.api_for_grafana_incident.urls", namespace="api-gi")),
|
||||
path("api/internal/v1/", include("apps.api.urls", namespace="api-internal")),
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ LOGGING = {
|
|||
},
|
||||
}
|
||||
|
||||
ROOT_URLCONF = "engine.urls"
|
||||
ROOT_URLCONF = os.environ.get("ROOT_URLCONF", "engine.urls")
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
|
|
@ -831,3 +831,5 @@ ZVONOK_POSTBACK_CAMPAIGN_ID = os.getenv("ZVONOK_POSTBACK_CAMPAIGN_ID", "campaign
|
|||
ZVONOK_POSTBACK_STATUS = os.getenv("ZVONOK_POSTBACK_STATUS", "status")
|
||||
ZVONOK_POSTBACK_USER_CHOICE = os.getenv("ZVONOK_POSTBACK_USER_CHOICE", None)
|
||||
ZVONOK_POSTBACK_USER_CHOICE_ACK = os.getenv("ZVONOK_POSTBACK_USER_CHOICE_ACK", None)
|
||||
|
||||
DETACHED_INTEGRATIONS_SERVER = getenv_boolean("DETACHED_INTEGRATIONS_SERVER", default=False)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue