fix: Gitea Traefik routing and connection pool optimization
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
- Remove middleware reference from Gitea Traefik labels (caused routing issues) - Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s) - Add explicit service reference in Traefik labels - Fix intermittent 504 timeouts by improving PostgreSQL connection handling Fixes Gitea unreachability via git.michaelschiemer.de
This commit is contained in:
139
src/Domain/Cms/DI/CmsServiceInitializer.php
Normal file
139
src/Domain/Cms/DI/CmsServiceInitializer.php
Normal file
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Domain\Cms\DI;
|
||||
|
||||
use App\Domain\Cms\Repositories\ContentRepository;
|
||||
use App\Domain\Cms\Repositories\ContentTypeRepository;
|
||||
use App\Domain\Cms\Repositories\DatabaseContentRepository;
|
||||
use App\Domain\Cms\Repositories\DatabaseContentTypeRepository;
|
||||
use App\Domain\Cms\Rendering\BlockRendererRegistry;
|
||||
use App\Domain\Cms\Rendering\DefaultBlockRenderer;
|
||||
use App\Domain\Cms\Rendering\HeroBlockRenderer;
|
||||
use App\Domain\Cms\Rendering\ImageBlockRenderer;
|
||||
use App\Domain\Cms\Rendering\TextBlockRenderer;
|
||||
use App\Domain\Cms\Repositories\ContentTranslationRepository;
|
||||
use App\Domain\Cms\Repositories\DatabaseContentTranslationRepository;
|
||||
use App\Domain\Cms\Services\BlockTypeRegistry;
|
||||
use App\Domain\Cms\Services\BlockValidator;
|
||||
use App\Domain\Cms\Services\ContentLocalizationService;
|
||||
use App\Domain\Cms\Services\ContentRenderer;
|
||||
use App\Domain\Cms\Services\ContentService;
|
||||
use App\Domain\Cms\Services\ContentTypeService;
|
||||
use App\Domain\Cms\Services\SlugGenerator;
|
||||
use App\Framework\Database\ConnectionInterface;
|
||||
use App\Framework\DateTime\Clock;
|
||||
use App\Framework\DI\Container;
|
||||
use App\Framework\DI\Initializer;
|
||||
use App\Framework\View\ComponentRenderer;
|
||||
|
||||
/**
|
||||
* CMS Domain Service Registration
|
||||
*
|
||||
* Registers all CMS domain services in the DI container.
|
||||
*/
|
||||
final readonly class CmsServiceInitializer
|
||||
{
|
||||
#[Initializer]
|
||||
public function __invoke(Container $container): void
|
||||
{
|
||||
// Repository Bindings
|
||||
$container->singleton(
|
||||
ContentRepository::class,
|
||||
fn (Container $c) => new DatabaseContentRepository(
|
||||
$c->get(ConnectionInterface::class)
|
||||
)
|
||||
);
|
||||
|
||||
$container->singleton(
|
||||
ContentTypeRepository::class,
|
||||
fn (Container $c) => new DatabaseContentTypeRepository(
|
||||
$c->get(ConnectionInterface::class)
|
||||
)
|
||||
);
|
||||
|
||||
// Block Type Registry
|
||||
$container->singleton(
|
||||
BlockTypeRegistry::class,
|
||||
fn () => new BlockTypeRegistry()
|
||||
);
|
||||
|
||||
// Services
|
||||
$container->singleton(
|
||||
BlockValidator::class,
|
||||
fn (Container $c) => new BlockValidator(
|
||||
$c->get(BlockTypeRegistry::class)
|
||||
)
|
||||
);
|
||||
|
||||
$container->singleton(
|
||||
SlugGenerator::class,
|
||||
fn (Container $c) => new SlugGenerator(
|
||||
$c->get(ContentRepository::class)
|
||||
)
|
||||
);
|
||||
|
||||
$container->singleton(
|
||||
ContentService::class,
|
||||
fn (Container $c) => new ContentService(
|
||||
$c->get(ContentRepository::class),
|
||||
$c->get(BlockValidator::class),
|
||||
$c->get(SlugGenerator::class),
|
||||
$c->get(Clock::class)
|
||||
)
|
||||
);
|
||||
|
||||
$container->singleton(
|
||||
ContentTypeService::class,
|
||||
fn (Container $c) => new ContentTypeService(
|
||||
$c->get(ContentTypeRepository::class),
|
||||
$c->get(Clock::class)
|
||||
)
|
||||
);
|
||||
|
||||
// Content Translation Repository
|
||||
$container->singleton(
|
||||
ContentTranslationRepository::class,
|
||||
fn (Container $c) => new DatabaseContentTranslationRepository(
|
||||
$c->get(ConnectionInterface::class)
|
||||
)
|
||||
);
|
||||
|
||||
// Content Localization Service
|
||||
$container->singleton(
|
||||
ContentLocalizationService::class,
|
||||
fn (Container $c) => new ContentLocalizationService(
|
||||
$c->get(ContentTranslationRepository::class),
|
||||
$c->get(Clock::class)
|
||||
)
|
||||
);
|
||||
|
||||
// Block Renderer Registry
|
||||
$container->singleton(
|
||||
BlockRendererRegistry::class,
|
||||
function (Container $c) {
|
||||
$registry = new BlockRendererRegistry();
|
||||
|
||||
// Register default renderers
|
||||
$registry->registerForType('hero', new HeroBlockRenderer());
|
||||
$registry->registerForType('text', new TextBlockRenderer());
|
||||
$registry->registerForType('image', new ImageBlockRenderer());
|
||||
|
||||
return $registry;
|
||||
}
|
||||
);
|
||||
|
||||
// Content Renderer
|
||||
$container->singleton(
|
||||
ContentRenderer::class,
|
||||
fn (Container $c) => new ContentRenderer(
|
||||
$c->get(BlockRendererRegistry::class),
|
||||
$c->get(ComponentRenderer::class),
|
||||
$c->get(ContentLocalizationService::class),
|
||||
new DefaultBlockRenderer()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user