feat: improve WireGuard client management and framework initialization

- Improve WireGuard client IP calculation logic (find next available IP)
- Add local wireguard-clients directory for storing client configs
- Integrate Redis pool into CacheInitializer
- Improve ContainerBootstrapper with better imports and Redis pool
- Add monitoring role tags for better task organization
- Update WireGuard documentation
- Store generated WireGuard client configs locally
This commit is contained in:
2025-11-02 03:29:23 +01:00
parent f56d53d873
commit e598309c48
12 changed files with 183 additions and 37 deletions

View File

@@ -19,6 +19,7 @@ use App\Framework\DI\Initializer;
use App\Framework\Performance\Contracts\PerformanceCollectorInterface;
use App\Framework\Redis\RedisConfig;
use App\Framework\Redis\RedisConnection;
use App\Framework\Redis\RedisConnectionPool;
use App\Framework\Serializer\Json\JsonSerializer;
use App\Framework\Serializer\Php\PhpSerializer;
@@ -27,10 +28,9 @@ final readonly class CacheInitializer
public function __construct(
private PerformanceCollectorInterface $performanceCollector,
private Container $container,
private ?AsyncService $asyncService = null,
#private CacheMetricsInterface $cacheMetrics,
private string $redisHost = 'redis',
private int $redisPort = 6379,
private RedisConnectionPool $redisConnectionPool,
private ?AsyncService $asyncService = null,
private int $compressionLevel = -1,
private int $minCompressionLength = 1024,
private bool $enableAsync = true
@@ -61,12 +61,8 @@ final readonly class CacheInitializer
throw new \RuntimeException('Redis extension is not loaded. Please install php-redis extension or use alternative cache drivers.');
}
$redisConfig = new RedisConfig(
host: $this->redisHost,
port: $this->redisPort,
database: 1 // Use DB 1 for cache
);
$redisConnection = new RedisConnection($redisConfig, 'cache');
$redisConnection = $this->redisConnectionPool->getCacheConnection();
#$redisConnection = new RedisConnection($redisConfig, 'cache');
$redisCache = new GeneralCache(new RedisCache($redisConnection), $serializer, $compression);
} catch (\Throwable $e) {
// Fallback to file cache if Redis is not available