mirror of
https://github.com/suitenumerique/meet.git
synced 2026-10-12 07:57:50 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d08a360572 |
@@ -31,6 +31,7 @@ and this project adheres to
|
|||||||
- 🐛(summary) disable default S3 checksums for GCS-compatible storage
|
- 🐛(summary) disable default S3 checksums for GCS-compatible storage
|
||||||
- 🔒️(summary) redact meeting content from Sentry events
|
- 🔒️(summary) redact meeting content from Sentry events
|
||||||
- 🐛(frontend) hide tooltips until they have a computed placement
|
- 🐛(frontend) hide tooltips until they have a computed placement
|
||||||
|
- 🐛(brevo) use django-lasuite for marketing management
|
||||||
|
|
||||||
## [1.33.0] - 2026-09-30
|
## [1.33.0] - 2026-09-30
|
||||||
|
|
||||||
|
|||||||
+8
-9
@@ -104,16 +104,15 @@ k8s_yaml(secret_yaml_generic(
|
|||||||
|
|
||||||
k8s_yaml(local('cd ../src/helm && helmfile -n meet -e ${DEV_ENV:-dev-keycloak} template .'))
|
k8s_yaml(local('cd ../src/helm && helmfile -n meet -e ${DEV_ENV:-dev-keycloak} template .'))
|
||||||
|
|
||||||
k8s_resource('dev-backend-garage-cors', resource_deps=['dev-backend-garage'])
|
k8s_resource('garage-cors', resource_deps=['garage'])
|
||||||
k8s_resource('dev-backend-keycloak', resource_deps=['dev-backend-keycloak-pg'])
|
k8s_resource('meet-backend', resource_deps=['postgresql', 'garage-cors', 'redis', 'livekit-livekit-server'])
|
||||||
k8s_resource('meet-backend', resource_deps=['dev-backend-postgres', 'dev-backend-garage-cors', 'dev-backend-redis', 'dev-backend-keycloak', 'livekit-livekit-server'])
|
k8s_resource('meet-celery-backend', resource_deps=['redis'])
|
||||||
k8s_resource('meet-celery-backend', resource_deps=['dev-backend-redis'])
|
k8s_resource('meet-celery-summarize', resource_deps=['redis'])
|
||||||
k8s_resource('meet-celery-summarize', resource_deps=['dev-backend-redis'])
|
k8s_resource('meet-celery-summary-backend', resource_deps=['redis'])
|
||||||
k8s_resource('meet-celery-summary-backend', resource_deps=['dev-backend-redis'])
|
k8s_resource('meet-celery-transcribe-default', resource_deps=['redis'])
|
||||||
k8s_resource('meet-celery-transcribe-default', resource_deps=['dev-backend-redis'])
|
k8s_resource('livekit-livekit-server', resource_deps=['redis'])
|
||||||
k8s_resource('livekit-livekit-server', resource_deps=['dev-backend-redis'])
|
|
||||||
k8s_resource('livekit-livekit-server-test-connection', resource_deps=['livekit-livekit-server'])
|
k8s_resource('livekit-livekit-server-test-connection', resource_deps=['livekit-livekit-server'])
|
||||||
k8s_resource('livekit-egress', resource_deps=['livekit-livekit-server'])
|
k8s_resource('keycloak', resource_deps=['kc-postgresql'])
|
||||||
# Trigger once on launch
|
# Trigger once on launch
|
||||||
k8s_resource(
|
k8s_resource(
|
||||||
'meet-backend-createsuperuser',
|
'meet-backend-createsuperuser',
|
||||||
|
|||||||
@@ -1,26 +1,19 @@
|
|||||||
"""Authentication Backends for the Meet core app."""
|
"""Authentication Backends for the Meet core app."""
|
||||||
|
|
||||||
import contextlib
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import (
|
from django.core.exceptions import (
|
||||||
ImproperlyConfigured,
|
|
||||||
SuspiciousOperation,
|
SuspiciousOperation,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
)
|
)
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
|
from lasuite.marketing.tasks import create_or_update_contact
|
||||||
from lasuite.oidc_login.backends import (
|
from lasuite.oidc_login.backends import (
|
||||||
OIDCAuthenticationBackend as LaSuiteOIDCAuthenticationBackend,
|
OIDCAuthenticationBackend as LaSuiteOIDCAuthenticationBackend,
|
||||||
)
|
)
|
||||||
from rest_framework.authentication import SessionAuthentication
|
from rest_framework.authentication import SessionAuthentication
|
||||||
|
|
||||||
from core.models import User
|
from core.models import User
|
||||||
from core.services.marketing import (
|
|
||||||
ContactCreationError,
|
|
||||||
ContactData,
|
|
||||||
get_marketing_service,
|
|
||||||
)
|
|
||||||
from core.validators import sub_validator
|
from core.validators import sub_validator
|
||||||
|
|
||||||
|
|
||||||
@@ -67,25 +60,15 @@ class OIDCAuthenticationBackend(LaSuiteOIDCAuthenticationBackend):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def signup_to_marketing_email(email):
|
def signup_to_marketing_email(email):
|
||||||
"""Pragmatic approach to newsletter signup during authentication flow.
|
"""Add the user to the newsletter list on sign-in.
|
||||||
|
|
||||||
Details:
|
Uses the team's standard Brevo integration, dispatching the contact
|
||||||
1. Uses a very short timeout (1s) to prevent blocking the auth process
|
creation/update as an asynchronous task to keep authentication fast.
|
||||||
2. Silently fails if the marketing service is down/slow to prioritize user experience
|
|
||||||
3. Trade-off: May miss some signups but ensures auth flow remains fast
|
|
||||||
|
|
||||||
Note: For a more robust solution, consider using Async task processing (Celery/Django-Q)
|
|
||||||
"""
|
"""
|
||||||
with contextlib.suppress(
|
create_or_update_contact.delay(
|
||||||
ContactCreationError, ImproperlyConfigured, ImportError
|
email=email,
|
||||||
):
|
attributes={"VISIO_SOURCE": ["SIGNIN"]},
|
||||||
marketing_service = get_marketing_service()
|
)
|
||||||
contact_data = ContactData(
|
|
||||||
email=email, attributes={"VISIO_SOURCE": ["SIGNIN"]}
|
|
||||||
)
|
|
||||||
marketing_service.create_contact(
|
|
||||||
contact_data, timeout=settings.BREVO_API_TIMEOUT
|
|
||||||
)
|
|
||||||
|
|
||||||
def get_existing_user(self, sub, email):
|
def get_existing_user(self, sub, email):
|
||||||
"""Fetch existing user by sub or email."""
|
"""Fetch existing user by sub or email."""
|
||||||
|
|||||||
@@ -1,138 +0,0 @@
|
|||||||
"""Marketing service in charge of pushing data for marketing automation."""
|
|
||||||
|
|
||||||
import logging
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from functools import lru_cache
|
|
||||||
from typing import Dict, List, Optional, Protocol
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
from django.utils.module_loading import import_string
|
|
||||||
|
|
||||||
import brevo_python
|
|
||||||
import urllib3
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class ContactCreationError(Exception):
|
|
||||||
"""Raised when the contact creation fails."""
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class ContactData:
|
|
||||||
"""Contact data for marketing service integration."""
|
|
||||||
|
|
||||||
email: str
|
|
||||||
attributes: Optional[Dict[str, str]] = None
|
|
||||||
list_ids: Optional[List[int]] = None
|
|
||||||
update_enabled: bool = True
|
|
||||||
|
|
||||||
|
|
||||||
class MarketingServiceProtocol(Protocol):
|
|
||||||
"""Interface for marketing automation service integrations."""
|
|
||||||
|
|
||||||
def create_contact(
|
|
||||||
self, contact_data: ContactData, timeout: Optional[int] = None
|
|
||||||
) -> dict:
|
|
||||||
"""Create or update a contact.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
contact_data: Contact information and attributes
|
|
||||||
timeout: API request timeout in seconds
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Service response
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
ContactCreationError: If contact creation fails
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class BrevoMarketingService:
|
|
||||||
"""Brevo marketing automation integration.
|
|
||||||
|
|
||||||
Handles:
|
|
||||||
- Contact management and segmentation
|
|
||||||
- Marketing campaigns and automation
|
|
||||||
- Email communications
|
|
||||||
|
|
||||||
Configuration via Django settings:
|
|
||||||
- BREVO_API_KEY: API authentication
|
|
||||||
- BREVO_API_CONTACT_LIST_IDS: Default contact lists
|
|
||||||
- BREVO_API_CONTACT_ATTRIBUTES: Default contact attributes
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
"""Initialize Brevo (ex-sendinblue) marketing service."""
|
|
||||||
|
|
||||||
if not settings.BREVO_API_KEY:
|
|
||||||
raise ImproperlyConfigured("Brevo API key is required")
|
|
||||||
|
|
||||||
configuration = brevo_python.Configuration()
|
|
||||||
configuration.api_key["api-key"] = settings.BREVO_API_KEY
|
|
||||||
|
|
||||||
self._api_client = brevo_python.ApiClient(configuration)
|
|
||||||
|
|
||||||
def create_contact(self, contact_data: ContactData, timeout=None) -> dict:
|
|
||||||
"""Create or update a Brevo contact.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
contact_data: Contact information and attributes
|
|
||||||
timeout: API request timeout in seconds
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
dict: Brevo API response
|
|
||||||
|
|
||||||
Raises:
|
|
||||||
ContactCreationError: If contact creation fails
|
|
||||||
ImproperlyConfigured: If required settings are missing
|
|
||||||
|
|
||||||
Note:
|
|
||||||
Contact attributes must be pre-configured in Brevo.
|
|
||||||
Changes to attributes can impact existing workflows.
|
|
||||||
"""
|
|
||||||
|
|
||||||
if not settings.BREVO_API_CONTACT_LIST_IDS:
|
|
||||||
raise ImproperlyConfigured(
|
|
||||||
"Default Brevo List IDs must be configured in settings."
|
|
||||||
)
|
|
||||||
|
|
||||||
contact_api = brevo_python.ContactsApi(self._api_client)
|
|
||||||
|
|
||||||
attributes = {
|
|
||||||
**settings.BREVO_API_CONTACT_ATTRIBUTES,
|
|
||||||
**(contact_data.attributes or {}),
|
|
||||||
}
|
|
||||||
|
|
||||||
list_ids = (contact_data.list_ids or []) + settings.BREVO_API_CONTACT_LIST_IDS
|
|
||||||
|
|
||||||
contact = brevo_python.CreateContact(
|
|
||||||
email=contact_data.email,
|
|
||||||
attributes=attributes,
|
|
||||||
list_ids=list_ids,
|
|
||||||
update_enabled=contact_data.update_enabled,
|
|
||||||
)
|
|
||||||
|
|
||||||
api_configurations = {}
|
|
||||||
|
|
||||||
if timeout is not None:
|
|
||||||
api_configurations["_request_timeout"] = timeout
|
|
||||||
|
|
||||||
try:
|
|
||||||
response = contact_api.create_contact(contact, **api_configurations)
|
|
||||||
except (
|
|
||||||
brevo_python.rest.ApiException,
|
|
||||||
urllib3.exceptions.ReadTimeoutError,
|
|
||||||
) as err:
|
|
||||||
logger.warning("Failed to create contact in Brevo", exc_info=True)
|
|
||||||
raise ContactCreationError("Failed to create contact in Brevo") from err
|
|
||||||
|
|
||||||
return response
|
|
||||||
|
|
||||||
|
|
||||||
@lru_cache(maxsize=1)
|
|
||||||
def get_marketing_service() -> MarketingServiceProtocol:
|
|
||||||
"""Return cached instance of configured marketing service."""
|
|
||||||
marketing_service_cls = import_string(settings.MARKETING_SERVICE_CLASS)
|
|
||||||
return marketing_service_cls()
|
|
||||||
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation
|
from django.core.exceptions import SuspiciousOperation
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
from lasuite.marketing.tasks import create_or_update_contact
|
||||||
|
|
||||||
from core import models
|
from core import models
|
||||||
from core.authentication.backends import OIDCAuthenticationBackend
|
from core.authentication.backends import OIDCAuthenticationBackend
|
||||||
from core.factories import UserFactory
|
from core.factories import UserFactory
|
||||||
from core.services import marketing
|
|
||||||
|
|
||||||
pytestmark = pytest.mark.django_db
|
pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
@@ -606,8 +606,8 @@ def test_marketing_signup_existing_user(
|
|||||||
mock_signup.assert_not_called()
|
mock_signup.assert_not_called()
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("core.authentication.backends.get_marketing_service")
|
@mock.patch.object(create_or_update_contact, "delay")
|
||||||
def test_signup_to_marketing_email_success(mock_marketing):
|
def test_signup_to_marketing_email_success(mock_create_or_update_contact):
|
||||||
"""Test successful marketing signup."""
|
"""Test successful marketing signup."""
|
||||||
|
|
||||||
email = "test@example.com"
|
email = "test@example.com"
|
||||||
@@ -616,46 +616,6 @@ def test_signup_to_marketing_email_success(mock_marketing):
|
|||||||
OIDCAuthenticationBackend.signup_to_marketing_email(email)
|
OIDCAuthenticationBackend.signup_to_marketing_email(email)
|
||||||
|
|
||||||
# Verify service interaction
|
# Verify service interaction
|
||||||
mock_service = mock_marketing.return_value
|
mock_create_or_update_contact.assert_called_once_with(
|
||||||
mock_service.create_contact.assert_called_once()
|
email=email, attributes={"VISIO_SOURCE": ["SIGNIN"]}
|
||||||
|
)
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"error",
|
|
||||||
[
|
|
||||||
ImportError,
|
|
||||||
ImproperlyConfigured,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@mock.patch("core.authentication.backends.get_marketing_service")
|
|
||||||
def test_marketing_signup_handles_service_initialization_errors(
|
|
||||||
mock_marketing, error, settings
|
|
||||||
):
|
|
||||||
"""Tests errors that occur when trying to get/initialize the marketing service."""
|
|
||||||
settings.SIGNUP_NEW_USER_TO_MARKETING_EMAIL = True
|
|
||||||
|
|
||||||
mock_marketing.side_effect = error
|
|
||||||
|
|
||||||
# Should not raise any exception
|
|
||||||
OIDCAuthenticationBackend.signup_to_marketing_email("test@example.com")
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"error",
|
|
||||||
[
|
|
||||||
marketing.ContactCreationError,
|
|
||||||
ImproperlyConfigured,
|
|
||||||
ImportError,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
@mock.patch("core.authentication.backends.get_marketing_service")
|
|
||||||
def test_marketing_signup_handles_contact_creation_errors(
|
|
||||||
mock_marketing, error, settings
|
|
||||||
):
|
|
||||||
"""Tests errors that occur during the contact creation process."""
|
|
||||||
|
|
||||||
settings.SIGNUP_NEW_USER_TO_MARKETING_EMAIL = True
|
|
||||||
mock_marketing.return_value.create_contact.side_effect = error
|
|
||||||
|
|
||||||
# Should not raise any exception
|
|
||||||
OIDCAuthenticationBackend.signup_to_marketing_email("test@example.com")
|
|
||||||
|
|||||||
@@ -1,212 +0,0 @@
|
|||||||
"""
|
|
||||||
Test marketing services.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# pylint: disable=W0621,W0613
|
|
||||||
|
|
||||||
from unittest import mock
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
|
||||||
|
|
||||||
import brevo_python
|
|
||||||
import pytest
|
|
||||||
import urllib3
|
|
||||||
|
|
||||||
from core.services.marketing import (
|
|
||||||
BrevoMarketingService,
|
|
||||||
ContactCreationError,
|
|
||||||
ContactData,
|
|
||||||
get_marketing_service,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_init_missing_api_key(settings):
|
|
||||||
"""Test initialization with missing API key."""
|
|
||||||
settings.BREVO_API_KEY = None
|
|
||||||
with pytest.raises(ImproperlyConfigured, match="Brevo API key is required"):
|
|
||||||
BrevoMarketingService()
|
|
||||||
|
|
||||||
|
|
||||||
def test_create_contact_missing_list_ids(settings):
|
|
||||||
"""Test contact creation with missing list IDs."""
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = None
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
with pytest.raises(
|
|
||||||
ImproperlyConfigured, match="Default Brevo List IDs must be configured"
|
|
||||||
):
|
|
||||||
brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_success(mock_contact_api):
|
|
||||||
"""Test successful contact creation."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
mock_api.create_contact.return_value = {"id": "test-id"}
|
|
||||||
response = brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
assert response == {"id": "test-id"}
|
|
||||||
|
|
||||||
mock_api.create_contact.assert_called_once()
|
|
||||||
contact_arg = mock_api.create_contact.call_args[0][0]
|
|
||||||
assert contact_arg.email == "test@example.com"
|
|
||||||
assert contact_arg.attributes == {
|
|
||||||
**settings.BREVO_API_CONTACT_ATTRIBUTES,
|
|
||||||
**valid_contact_data.attributes,
|
|
||||||
}
|
|
||||||
assert set(contact_arg.list_ids) == {1, 2, 3, 4}
|
|
||||||
assert contact_arg.update_enabled is True
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_with_timeout(mock_contact_api):
|
|
||||||
"""Test contact creation with timeout."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
brevo_service.create_contact(valid_contact_data, timeout=30)
|
|
||||||
|
|
||||||
mock_api.create_contact.assert_called_once()
|
|
||||||
assert mock_api.create_contact.call_args[1]["_request_timeout"] == 30
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_api_error(mock_contact_api):
|
|
||||||
"""Test contact creation API error handling."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
mock_api.create_contact.side_effect = brevo_python.rest.ApiException()
|
|
||||||
|
|
||||||
with pytest.raises(ContactCreationError, match="Failed to create contact in Brevo"):
|
|
||||||
brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("brevo_python.ContactsApi")
|
|
||||||
def test_create_contact_timeout_error(mock_contact_api):
|
|
||||||
"""Test contact creation timeout error handling."""
|
|
||||||
|
|
||||||
mock_api = mock_contact_api.return_value
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.BREVO_API_CONTACT_LIST_IDS = [1, 2, 3, 4]
|
|
||||||
settings.BREVO_API_CONTACT_ATTRIBUTES = {"source": "test"}
|
|
||||||
|
|
||||||
valid_contact_data = ContactData(
|
|
||||||
email="test@example.com",
|
|
||||||
attributes={"first_name": "Test"},
|
|
||||||
list_ids=[1, 2],
|
|
||||||
update_enabled=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
brevo_service = BrevoMarketingService()
|
|
||||||
|
|
||||||
mock_api.create_contact.side_effect = urllib3.exceptions.ReadTimeoutError(
|
|
||||||
pool=mock.Mock(),
|
|
||||||
url="https://api.brevo.com/v3/endpoint",
|
|
||||||
message="HTTPSConnectionPool(host='api.brevo.com', port=443): Read timed out.",
|
|
||||||
)
|
|
||||||
|
|
||||||
with pytest.raises(ContactCreationError, match="Failed to create contact in Brevo"):
|
|
||||||
brevo_service.create_contact(valid_contact_data)
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def clear_marketing_cache():
|
|
||||||
"""Clear marketing service cache between tests."""
|
|
||||||
get_marketing_service.cache_clear()
|
|
||||||
yield
|
|
||||||
get_marketing_service.cache_clear()
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_marketing_service_caching(clear_marketing_cache):
|
|
||||||
"""Test marketing service caching behavior."""
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.MARKETING_SERVICE_CLASS = "core.services.marketing.BrevoMarketingService"
|
|
||||||
|
|
||||||
service1 = get_marketing_service()
|
|
||||||
service2 = get_marketing_service()
|
|
||||||
|
|
||||||
assert service1 is service2
|
|
||||||
assert isinstance(service1, BrevoMarketingService)
|
|
||||||
|
|
||||||
|
|
||||||
def test_get_marketing_service_invalid_class(clear_marketing_cache):
|
|
||||||
"""Test handling of invalid service class."""
|
|
||||||
settings.MARKETING_SERVICE_CLASS = "invalid.service.path"
|
|
||||||
|
|
||||||
with pytest.raises(ImportError):
|
|
||||||
get_marketing_service()
|
|
||||||
|
|
||||||
|
|
||||||
@mock.patch("core.services.marketing.import_string")
|
|
||||||
def test_service_instantiation_called_once(mock_import_string, clear_marketing_cache):
|
|
||||||
"""Test service class is instantiated only once."""
|
|
||||||
|
|
||||||
settings.BREVO_API_KEY = "test-api-key"
|
|
||||||
settings.MARKETING_SERVICE_CLASS = "core.services.marketing.BrevoMarketingService"
|
|
||||||
get_marketing_service.cache_clear()
|
|
||||||
|
|
||||||
mock_service_cls = mock.Mock()
|
|
||||||
mock_service_instance = mock.Mock()
|
|
||||||
mock_service_cls.return_value = mock_service_instance
|
|
||||||
mock_import_string.return_value = mock_service_cls
|
|
||||||
|
|
||||||
service1 = get_marketing_service()
|
|
||||||
service2 = get_marketing_service()
|
|
||||||
|
|
||||||
mock_import_string.assert_called_once_with(settings.MARKETING_SERVICE_CLASS)
|
|
||||||
mock_service_cls.assert_called_once()
|
|
||||||
assert service1 is service2
|
|
||||||
assert service1 is mock_service_instance
|
|
||||||
@@ -938,24 +938,18 @@ class Base(Configuration):
|
|||||||
environ_name="SIGNUP_NEW_USER_TO_MARKETING_EMAIL",
|
environ_name="SIGNUP_NEW_USER_TO_MARKETING_EMAIL",
|
||||||
environ_prefix=None,
|
environ_prefix=None,
|
||||||
)
|
)
|
||||||
MARKETING_SERVICE_CLASS = values.Value(
|
LASUITE_MARKETING = {
|
||||||
"core.services.marketing.BrevoMarketingService",
|
"BACKEND": values.Value(
|
||||||
environ_name="MARKETING_SERVICE_CLASS",
|
"lasuite.marketing.backends.dummy.DummyBackend",
|
||||||
environ_prefix=None,
|
environ_name="LASUITE_MARKETING_BACKEND",
|
||||||
)
|
environ_prefix=None,
|
||||||
BREVO_API_KEY = SecretFileValue(
|
),
|
||||||
None, environ_name="BREVO_API_KEY", environ_prefix=None
|
"PARAMETERS": values.DictValue(
|
||||||
)
|
default={},
|
||||||
BREVO_API_CONTACT_LIST_IDS = values.ListValue(
|
environ_name="LASUITE_MARKETING_PARAMETERS",
|
||||||
[],
|
environ_prefix=None,
|
||||||
environ_name="BREVO_API_CONTACT_LIST_IDS",
|
),
|
||||||
environ_prefix=None,
|
}
|
||||||
converter=int,
|
|
||||||
)
|
|
||||||
BREVO_API_CONTACT_ATTRIBUTES = values.DictValue({"VISIO_USER": True})
|
|
||||||
BREVO_API_TIMEOUT = values.PositiveIntegerValue(
|
|
||||||
1, environ_name="BREVO_API_TIMEOUT", environ_prefix=None
|
|
||||||
)
|
|
||||||
|
|
||||||
# Lobby configurations
|
# Lobby configurations
|
||||||
PRESENCE_KEY_PREFIX = values.Value(
|
PRESENCE_KEY_PREFIX = values.Value(
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ _summaryEnvVars: &summaryEnvVars
|
|||||||
APP_NAME: summary-microservice
|
APP_NAME: summary-microservice
|
||||||
APP_API_TOKEN: password
|
APP_API_TOKEN: password
|
||||||
AWS_STORAGE_BUCKET_NAME: meet-media-storage
|
AWS_STORAGE_BUCKET_NAME: meet-media-storage
|
||||||
AWS_S3_ENDPOINT_URL: http://dev-backend-garage.meet.svc.cluster.local:9000/
|
AWS_S3_ENDPOINT_URL: http://garage.meet.svc.cluster.local:9000/
|
||||||
AWS_S3_ACCESS_KEY_ID: meet-access-key
|
AWS_S3_ACCESS_KEY_ID: meet-access-key
|
||||||
AWS_S3_SECRET_ACCESS_KEY: meet-secret-access-key
|
AWS_S3_SECRET_ACCESS_KEY: meet-secret-access-key
|
||||||
AWS_S3_SECURE_ACCESS: False
|
AWS_S3_SECURE_ACCESS: False
|
||||||
@@ -69,9 +69,9 @@ _summaryEnvVars: &summaryEnvVars
|
|||||||
LLM_MODEL: Qwen/Qwen3-Coder-30B-A3B-Instruct
|
LLM_MODEL: Qwen/Qwen3-Coder-30B-A3B-Instruct
|
||||||
WEBHOOK_API_TOKEN: password
|
WEBHOOK_API_TOKEN: password
|
||||||
WEBHOOK_URL: https://www.mock-impress.com/webhook/
|
WEBHOOK_URL: https://www.mock-impress.com/webhook/
|
||||||
CELERY_BROKER_URL: redis://user:pass@dev-backend-redis:6379/1
|
CELERY_BROKER_URL: redis://default:pass@redis-master:6379/1
|
||||||
CELERY_RESULT_BACKEND: redis://user:pass@dev-backend-redis:6379/1
|
CELERY_RESULT_BACKEND: redis://default:pass@redis-master:6379/1
|
||||||
TASK_TRACKER_REDIS_URL: redis://user:pass@dev-backend-redis:6379/1
|
TASK_TRACKER_REDIS_URL: redis://default:pass@redis-master:6379/1
|
||||||
IS_RESOLVE_SPEAKER_IDENTITIES_ENABLED: true
|
IS_RESOLVE_SPEAKER_IDENTITIES_ENABLED: true
|
||||||
RESOLVE_SPEAKER_IDENTITIES_DEFAULT_OVERLAP: 0.5
|
RESOLVE_SPEAKER_IDENTITIES_DEFAULT_OVERLAP: 0.5
|
||||||
RESOLVE_SPEAKER_ENABLE_SPLIT_ON_WORDS: true
|
RESOLVE_SPEAKER_ENABLE_SPLIT_ON_WORDS: true
|
||||||
@@ -127,21 +127,12 @@ backend:
|
|||||||
LOGIN_REDIRECT_URL_FAILURE: https://meet.127.0.0.1.nip.io
|
LOGIN_REDIRECT_URL_FAILURE: https://meet.127.0.0.1.nip.io
|
||||||
LOGOUT_REDIRECT_URL: https://meet.127.0.0.1.nip.io
|
LOGOUT_REDIRECT_URL: https://meet.127.0.0.1.nip.io
|
||||||
# Databases
|
# Databases
|
||||||
DB_HOST: dev-backend-postgres
|
DB_HOST: postgres
|
||||||
DB_NAME:
|
DB_NAME: meet
|
||||||
secretKeyRef:
|
DB_USER: dinum
|
||||||
name: dev-backend-postgres
|
DB_PASSWORD: pass
|
||||||
key: database
|
|
||||||
DB_USER:
|
|
||||||
secretKeyRef:
|
|
||||||
name: dev-backend-postgres
|
|
||||||
key: username
|
|
||||||
DB_PASSWORD:
|
|
||||||
secretKeyRef:
|
|
||||||
name: dev-backend-postgres
|
|
||||||
key: password
|
|
||||||
DB_PORT: 5432
|
DB_PORT: 5432
|
||||||
REDIS_URL: redis://user:pass@dev-backend-redis:6379/1
|
REDIS_URL: redis://default:pass@redis-master:6379/1
|
||||||
# Static files
|
# Static files
|
||||||
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
|
STORAGES_STATICFILES_BACKEND: django.contrib.staticfiles.storage.StaticFilesStorage
|
||||||
# Permissions
|
# Permissions
|
||||||
@@ -172,7 +163,7 @@ backend:
|
|||||||
FRONTEND_TRANSCRIPTION_DESTINATION: "https://docs.numerique.gouv.fr"
|
FRONTEND_TRANSCRIPTION_DESTINATION: "https://docs.numerique.gouv.fr"
|
||||||
FRONTEND_IS_SILENT_LOGIN_ENABLED: False
|
FRONTEND_IS_SILENT_LOGIN_ENABLED: False
|
||||||
# S3 Storage
|
# S3 Storage
|
||||||
AWS_S3_ENDPOINT_URL: http://dev-backend-garage.meet.svc.cluster.local:9000
|
AWS_S3_ENDPOINT_URL: http://garage.meet.svc.cluster.local:9000
|
||||||
AWS_S3_ACCESS_KEY_ID: meet-access-key
|
AWS_S3_ACCESS_KEY_ID: meet-access-key
|
||||||
AWS_S3_SECRET_ACCESS_KEY: meet-secret-access-key
|
AWS_S3_SECRET_ACCESS_KEY: meet-secret-access-key
|
||||||
AWS_STORAGE_BUCKET_NAME: meet-media-storage
|
AWS_STORAGE_BUCKET_NAME: meet-media-storage
|
||||||
@@ -195,7 +186,7 @@ backend:
|
|||||||
MEDIA_BASE_URL: https://meet.127.0.0.1.nip.io
|
MEDIA_BASE_URL: https://meet.127.0.0.1.nip.io
|
||||||
FILE_UPLOAD_ENABLED: True
|
FILE_UPLOAD_ENABLED: True
|
||||||
CELERY_ENABLED: True
|
CELERY_ENABLED: True
|
||||||
CELERY_BROKER_URL: redis://user:pass@dev-backend-redis:6379/1
|
CELERY_BROKER_URL: redis://default:pass@redis-master:6379/1
|
||||||
# Recording & Transcription
|
# Recording & Transcription
|
||||||
RECORDING_ENABLE: True
|
RECORDING_ENABLE: True
|
||||||
SUMMARY_SERVICE_ENDPOINT: http://meet-summary:80/api/v2/async-jobs/transcribe/
|
SUMMARY_SERVICE_ENDPOINT: http://meet-summary:80/api/v2/async-jobs/transcribe/
|
||||||
@@ -275,11 +266,11 @@ ingressMedia:
|
|||||||
annotations:
|
annotations:
|
||||||
nginx.ingress.kubernetes.io/auth-url: https://meet.127.0.0.1.nip.io/api/v1.0/recordings/media-auth/
|
nginx.ingress.kubernetes.io/auth-url: https://meet.127.0.0.1.nip.io/api/v1.0/recordings/media-auth/
|
||||||
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Amz-Date, X-Amz-Content-SHA256"
|
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Amz-Date, X-Amz-Content-SHA256"
|
||||||
nginx.ingress.kubernetes.io/upstream-vhost: dev-backend-garage.meet.svc.cluster.local:9000
|
nginx.ingress.kubernetes.io/upstream-vhost: garage.meet.svc.cluster.local:9000
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /meet-media-storage/$1
|
nginx.ingress.kubernetes.io/rewrite-target: /meet-media-storage/$1
|
||||||
|
|
||||||
serviceMedia:
|
serviceMedia:
|
||||||
host: dev-backend-garage.meet.svc.cluster.local
|
host: garage.meet.svc.cluster.local
|
||||||
port: 9000
|
port: 9000
|
||||||
|
|
||||||
# ---- Extra ingress/service for background file uploads ------------
|
# ---- Extra ingress/service for background file uploads ------------
|
||||||
@@ -291,11 +282,11 @@ ingressMediaFiles:
|
|||||||
annotations:
|
annotations:
|
||||||
nginx.ingress.kubernetes.io/auth-url: https://meet.127.0.0.1.nip.io/api/v1.0/files/media-auth/
|
nginx.ingress.kubernetes.io/auth-url: https://meet.127.0.0.1.nip.io/api/v1.0/files/media-auth/
|
||||||
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Amz-Date, X-Amz-Content-SHA256"
|
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Amz-Date, X-Amz-Content-SHA256"
|
||||||
nginx.ingress.kubernetes.io/upstream-vhost: dev-backend-garage.meet.svc.cluster.local:9000
|
nginx.ingress.kubernetes.io/upstream-vhost: garage.meet.svc.cluster.local:9000
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: /meet-media-storage/files/$1
|
nginx.ingress.kubernetes.io/rewrite-target: /meet-media-storage/files/$1
|
||||||
|
|
||||||
serviceMediaFiles:
|
serviceMediaFiles:
|
||||||
host: dev-backend-garage.meet.svc.cluster.local
|
host: garage.meet.svc.cluster.local
|
||||||
port: 9000
|
port: 9000
|
||||||
|
|
||||||
# ---- STT Orchestration Microservice Components --------------------
|
# ---- STT Orchestration Microservice Components --------------------
|
||||||
@@ -373,7 +364,7 @@ agentMetadata:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
ENABLE_SILERO_VAD: "false"
|
ENABLE_SILERO_VAD: "false"
|
||||||
AWS_S3_ENDPOINT_URL: dev-backend-garage.meet.svc.cluster.local:9000
|
AWS_S3_ENDPOINT_URL: garage.meet.svc.cluster.local:9000
|
||||||
AWS_S3_ACCESS_KEY_ID: meet-access-key
|
AWS_S3_ACCESS_KEY_ID: meet-access-key
|
||||||
AWS_S3_SECRET_ACCESS_KEY: meet-secret-access-key
|
AWS_S3_SECRET_ACCESS_KEY: meet-secret-access-key
|
||||||
AWS_S3_SECURE_ACCESS: False
|
AWS_S3_SECURE_ACCESS: False
|
||||||
|
|||||||
@@ -13,15 +13,14 @@ egress:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
redis:
|
redis:
|
||||||
address: dev-backend-redis:6379
|
address: redis-master:6379
|
||||||
username: user
|
|
||||||
password: pass
|
password: pass
|
||||||
s3:
|
s3:
|
||||||
access_key: meet-access-key
|
access_key: meet-access-key
|
||||||
secret: meet-secret-access-key
|
secret: meet-secret-access-key
|
||||||
region: local
|
region: local
|
||||||
bucket: meet-media-storage
|
bucket: meet-media-storage
|
||||||
endpoint: http://dev-backend-garage:9000
|
endpoint: http://garage:9000
|
||||||
force_path_style: true
|
force_path_style: true
|
||||||
|
|
||||||
loadBalancer:
|
loadBalancer:
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ livekit:
|
|||||||
port_range_end: 60000
|
port_range_end: 60000
|
||||||
tcp_port: 7881
|
tcp_port: 7881
|
||||||
redis:
|
redis:
|
||||||
address: dev-backend-redis:6379
|
address: redis-master:6379
|
||||||
username: user
|
|
||||||
password: pass
|
password: pass
|
||||||
keys:
|
keys:
|
||||||
turn:
|
turn:
|
||||||
|
|||||||
@@ -16,15 +16,14 @@ egress:
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
redis:
|
redis:
|
||||||
address: dev-backend-redis:6379
|
address: redis-master:6379
|
||||||
username: user
|
|
||||||
password: pass
|
password: pass
|
||||||
s3:
|
s3:
|
||||||
access_key: meet-access-key
|
access_key: meet-access-key
|
||||||
secret: meet-secret-access-key
|
secret: meet-secret-access-key
|
||||||
region: local
|
region: local
|
||||||
bucket: meet-media-storage
|
bucket: meet-media-storage
|
||||||
endpoint: http://dev-backend-garage:9000
|
endpoint: http://garage:9000
|
||||||
force_path_style: true
|
force_path_style: true
|
||||||
|
|
||||||
loadBalancer:
|
loadBalancer:
|
||||||
|
|||||||
@@ -14,8 +14,7 @@ livekit:
|
|||||||
port_range_end: 60000
|
port_range_end: 60000
|
||||||
tcp_port: 7881
|
tcp_port: 7881
|
||||||
redis:
|
redis:
|
||||||
address: dev-backend-redis:6379
|
address: redis-master:6379
|
||||||
username: user
|
|
||||||
password: pass
|
password: pass
|
||||||
keys:
|
keys:
|
||||||
turn:
|
turn:
|
||||||
|
|||||||
@@ -0,0 +1,172 @@
|
|||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: garage
|
||||||
|
annotations:
|
||||||
|
nginx.ingress.kubernetes.io/proxy-body-size: 10m
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: "garage.127.0.0.1.nip.io"
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: garage
|
||||||
|
port:
|
||||||
|
number: 9000
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- garage.127.0.0.1.nip.io
|
||||||
|
secretName: meet-tls
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: garage
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: client
|
||||||
|
port: 9000
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: 9000
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: garage
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: garage-config
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
data:
|
||||||
|
garage.toml: |
|
||||||
|
metadata_dir = "/var/lib/garage/meta"
|
||||||
|
data_dir = "/var/lib/garage/data"
|
||||||
|
db_engine = "lmdb"
|
||||||
|
|
||||||
|
replication_factor = 1
|
||||||
|
|
||||||
|
rpc_bind_addr = "127.0.0.1:3901"
|
||||||
|
rpc_public_addr = "127.0.0.1:3901"
|
||||||
|
|
||||||
|
[s3_api]
|
||||||
|
api_bind_addr = "[::]:9000"
|
||||||
|
# Clients must sign their requests for this region (AWS_S3_REGION_NAME)
|
||||||
|
s3_region = "local"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Secret
|
||||||
|
metadata:
|
||||||
|
name: garage-dev
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
type: Opaque
|
||||||
|
data:
|
||||||
|
GARAGE_RPC_SECRET: {{ printf "%s/garage-rpc-secret" .Release.Namespace | sha256sum | b64enc }}
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: garage
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: garage
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: garage
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: garage
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: garage
|
||||||
|
command:
|
||||||
|
- /garage
|
||||||
|
- server
|
||||||
|
- --single-node
|
||||||
|
- --default-bucket
|
||||||
|
env:
|
||||||
|
- name: GARAGE_RPC_SECRET
|
||||||
|
valueFrom:
|
||||||
|
secretKeyRef:
|
||||||
|
name: garage-dev
|
||||||
|
key: GARAGE_RPC_SECRET
|
||||||
|
- name: GARAGE_DEFAULT_ACCESS_KEY
|
||||||
|
value: meet-access-key
|
||||||
|
- name: GARAGE_DEFAULT_SECRET_KEY
|
||||||
|
value: meet-secret-access-key
|
||||||
|
- name: GARAGE_DEFAULT_BUCKET
|
||||||
|
value: meet-media-storage
|
||||||
|
image: "dxflrs/garage:v2.4.1"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- containerPort: 9000
|
||||||
|
name: client
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /garage
|
||||||
|
- health
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/garage.toml
|
||||||
|
name: config
|
||||||
|
subPath: garage.toml
|
||||||
|
- mountPath: /var/lib/garage
|
||||||
|
name: data
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
configMap:
|
||||||
|
name: garage-config
|
||||||
|
- name: data
|
||||||
|
emptyDir:
|
||||||
|
---
|
||||||
|
# Garage denies cross-origin requests by default: allow the frontend to upload
|
||||||
|
# files straight to the bucket
|
||||||
|
apiVersion: batch/v1
|
||||||
|
kind: Job
|
||||||
|
metadata:
|
||||||
|
name: garage-cors
|
||||||
|
spec:
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: aws-cli
|
||||||
|
image: amazon/aws-cli:2.37.1
|
||||||
|
env:
|
||||||
|
- name: AWS_ACCESS_KEY_ID
|
||||||
|
value: meet-access-key
|
||||||
|
- name: AWS_SECRET_ACCESS_KEY
|
||||||
|
value: meet-secret-access-key
|
||||||
|
- name: AWS_DEFAULT_REGION
|
||||||
|
value: local
|
||||||
|
- name: AWS_ENDPOINT_URL
|
||||||
|
value: http://garage:9000
|
||||||
|
- name: BUCKET
|
||||||
|
value: meet-media-storage
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
deadline=$(($(date +%s) + 300))
|
||||||
|
until aws s3api head-bucket --bucket="$BUCKET" --cli-connect-timeout=5; do
|
||||||
|
if [ "$(date +%s)" -ge "$deadline" ]; then
|
||||||
|
echo "Bucket $BUCKET still unavailable on $AWS_ENDPOINT_URL" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Waiting for bucket $BUCKET on $AWS_ENDPOINT_URL"
|
||||||
|
sleep 5
|
||||||
|
done
|
||||||
|
exec aws s3api put-bucket-cors --bucket="$BUCKET" \
|
||||||
|
--cors-configuration='{"CORSRules": [{"AllowedOrigins": ["https://meet.127.0.0.1.nip.io"], "AllowedMethods": ["GET", "HEAD", "PUT"], "AllowedHeaders": ["*"], "ExposeHeaders": ["ETag"]}]}'
|
||||||
|
restartPolicy: Never
|
||||||
|
backoffLimit: 3
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: kc-postgres
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
port: 5432
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: tcp-postgresql
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: kc-postgresql
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: kc-postgresql
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: kc-postgresql
|
||||||
|
serviceName: "kc-postgres"
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: kc-postgresql
|
||||||
|
spec:
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
containers:
|
||||||
|
- name: pg
|
||||||
|
image: postgres:16-alpine
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
name: tcp-postgresql
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
value: pass
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: dinum
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: keycloak
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /var/lib/postgresql
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
spec:
|
||||||
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
|
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
---
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: keycloak
|
||||||
|
spec:
|
||||||
|
rules:
|
||||||
|
- host: "keycloak.127.0.0.1.nip.io"
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
|
name: keycloak
|
||||||
|
port:
|
||||||
|
number: 8080
|
||||||
|
tls:
|
||||||
|
- hosts:
|
||||||
|
- keycloak.127.0.0.1.nip.io
|
||||||
|
secretName: meet-tls
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: keycloak
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: tcp-keycloak
|
||||||
|
port: 8080
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: tcp-keycloak
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: keycloak
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: realm
|
||||||
|
data:
|
||||||
|
meet.json: |
|
||||||
|
{{ .Values.realm | indent 4 }}
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: keycloak
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: keycloak
|
||||||
|
serviceName: "keycloak"
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: keycloak
|
||||||
|
spec:
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
containers:
|
||||||
|
- name: keycloak
|
||||||
|
image: quay.io/keycloak/keycloak:20.0.1
|
||||||
|
args:
|
||||||
|
- start-dev
|
||||||
|
- --features=preview
|
||||||
|
- --import-realm
|
||||||
|
- --proxy=edge
|
||||||
|
- --hostname=keycloak.127.0.0.1.nip.io
|
||||||
|
- --hostname-strict=false
|
||||||
|
- --hostname-strict-https=false
|
||||||
|
ports:
|
||||||
|
- containerPort: 8080
|
||||||
|
name: tcp-keycloak
|
||||||
|
env:
|
||||||
|
- name: KEYCLOAK_ADMIN
|
||||||
|
value: admin
|
||||||
|
- name: KEYCLOAK_ADMIN_PASSWORD
|
||||||
|
value: admin
|
||||||
|
- name: PROXY_ADDRESS_FORWARDING
|
||||||
|
value: 'true'
|
||||||
|
- name: KC_DB_URL_HOST
|
||||||
|
value: kc_postgresql
|
||||||
|
- name: KC_DB_URL_DATABASE
|
||||||
|
value: keycloak
|
||||||
|
- name: KC_DB_PASSWORD
|
||||||
|
value: pass
|
||||||
|
- name: KC_DB_USERNAME
|
||||||
|
value: dinum
|
||||||
|
- name: KC_DB_SCHEMA
|
||||||
|
value: public
|
||||||
|
volumeMounts:
|
||||||
|
- name: realm
|
||||||
|
mountPath: "/opt/keycloak/data/import"
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: realm
|
||||||
|
configMap:
|
||||||
|
name: realm
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: postgres
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: tcp-postgresql
|
||||||
|
port: 5432
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: tcp-postgresql
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: StatefulSet
|
||||||
|
metadata:
|
||||||
|
name: postgresql
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
serviceName: "postgres"
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: postgresql
|
||||||
|
spec:
|
||||||
|
terminationGracePeriodSeconds: 10
|
||||||
|
containers:
|
||||||
|
- name: pg
|
||||||
|
image: postgres:16-alpine
|
||||||
|
readinessProbe:
|
||||||
|
exec:
|
||||||
|
command: [ "pg_isready", "-U", "dinum", "-d", "meet", "-h", "127.0.0.1" ]
|
||||||
|
initialDelaySeconds: 5
|
||||||
|
periodSeconds: 5
|
||||||
|
livenessProbe:
|
||||||
|
exec:
|
||||||
|
command: [ "pg_isready", "-U", "dinum", "-d", "meet", "-h", "127.0.0.1" ]
|
||||||
|
initialDelaySeconds: 15
|
||||||
|
periodSeconds: 10
|
||||||
|
ports:
|
||||||
|
- containerPort: 5432
|
||||||
|
name: tcp-postgresql
|
||||||
|
env:
|
||||||
|
- name: POSTGRES_PASSWORD
|
||||||
|
value: pass
|
||||||
|
- name: POSTGRES_USER
|
||||||
|
value: dinum
|
||||||
|
- name: POSTGRES_DB
|
||||||
|
value: meet
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /var/lib/postgresql/data
|
||||||
|
volumeClaimTemplates:
|
||||||
|
- metadata:
|
||||||
|
name: data
|
||||||
|
spec:
|
||||||
|
accessModes: [ "ReadWriteOnce" ]
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 1Gi
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: redis-master
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- name: tcp-redis
|
||||||
|
port: 6379
|
||||||
|
protocol: TCP
|
||||||
|
targetPort: tcp-redis
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: redis
|
||||||
|
type: ClusterIP
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: redis
|
||||||
|
data:
|
||||||
|
redis.conf: |
|
||||||
|
bind 0.0.0.0
|
||||||
|
port 6379
|
||||||
|
user default on >pass ~* &* +@all
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: redis
|
||||||
|
namespace: {{ .Release.Namespace | quote }}
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: redis
|
||||||
|
spec:
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: redis
|
||||||
|
replicas: 1
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/instance: extra
|
||||||
|
app.kubernetes.io/name: redis
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: redis
|
||||||
|
args:
|
||||||
|
- redis-server
|
||||||
|
- /usr/local/etc/redis/redis.conf
|
||||||
|
image: "redis:8.2-alpine"
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- containerPort: 6379
|
||||||
|
name: tcp-redis
|
||||||
|
volumeMounts:
|
||||||
|
- name: redis
|
||||||
|
mountPath: "/usr/local/etc/redis"
|
||||||
|
readOnly: true
|
||||||
|
volumes:
|
||||||
|
- name: redis
|
||||||
|
configMap:
|
||||||
|
name: redis
|
||||||
@@ -13,9 +13,6 @@ repositories:
|
|||||||
- name: livekit
|
- name: livekit
|
||||||
url: https://helm.livekit.io
|
url: https://helm.livekit.io
|
||||||
|
|
||||||
- name: dev-backends
|
|
||||||
url: https://suitenumerique.github.io/helm-dev-backend
|
|
||||||
|
|
||||||
releases:
|
releases:
|
||||||
- name: extra
|
- name: extra
|
||||||
installed: {{ regexMatch "^dev.*" .Environment.Name }}
|
installed: {{ regexMatch "^dev.*" .Environment.Name }}
|
||||||
@@ -30,59 +27,8 @@ releases:
|
|||||||
- enablePermanentRedirect: {{ .Values | get "enablePermanentRedirect" "False"}}
|
- enablePermanentRedirect: {{ .Values | get "enablePermanentRedirect" "False"}}
|
||||||
- oldDomain: {{ .Values | get "oldDomain" "demo.com" }}
|
- oldDomain: {{ .Values | get "oldDomain" "demo.com" }}
|
||||||
- newDomain: {{ .Values | get "newDomain" "demo.com" }}
|
- newDomain: {{ .Values | get "newDomain" "demo.com" }}
|
||||||
|
- realm: |
|
||||||
- name: dev-backend
|
{{ readFile "../../docker/auth/realm.json" | replace "http://localhost:3200" "https://meet.127.0.0.1.nip.io" | indent 8 }}
|
||||||
installed: {{ regexMatch "^dev.*" .Environment.Name }}
|
|
||||||
namespace: {{ .Namespace }}
|
|
||||||
chart: dev-backends/dev-backend
|
|
||||||
version: 0.0.14
|
|
||||||
values:
|
|
||||||
- postgres:
|
|
||||||
enabled: true
|
|
||||||
username: dinum
|
|
||||||
password: pass
|
|
||||||
database: meet
|
|
||||||
size: 1Gi
|
|
||||||
- redis:
|
|
||||||
enabled: true
|
|
||||||
username: user
|
|
||||||
password: pass
|
|
||||||
- garage:
|
|
||||||
enabled: true
|
|
||||||
accessKey: meet-access-key
|
|
||||||
secretKey: meet-secret-access-key
|
|
||||||
bucket: meet-media-storage
|
|
||||||
region: local
|
|
||||||
persistence: false
|
|
||||||
ingress:
|
|
||||||
enabled: true
|
|
||||||
hostname: garage.127.0.0.1.nip.io
|
|
||||||
annotations:
|
|
||||||
nginx.ingress.kubernetes.io/proxy-body-size: 10m
|
|
||||||
tls:
|
|
||||||
enabled: true
|
|
||||||
secretName: meet-tls
|
|
||||||
cors:
|
|
||||||
allowedOrigins:
|
|
||||||
- https://meet.127.0.0.1.nip.io
|
|
||||||
- keycloak:
|
|
||||||
enabled: true
|
|
||||||
hostname: keycloak.127.0.0.1.nip.io
|
|
||||||
username: admin
|
|
||||||
password: admin
|
|
||||||
tls:
|
|
||||||
enabled: true
|
|
||||||
secretName: meet-tls
|
|
||||||
db:
|
|
||||||
username: dinum
|
|
||||||
password: pass
|
|
||||||
database: keycloak
|
|
||||||
size: 1Gi
|
|
||||||
realm:
|
|
||||||
name: meet
|
|
||||||
username: meet
|
|
||||||
password: meet
|
|
||||||
email: meet@example.com
|
|
||||||
|
|
||||||
|
|
||||||
- name: meet
|
- name: meet
|
||||||
|
|||||||
Reference in New Issue
Block a user