- Mount /home/deploy/michaelschiemer/current:/var/www/html:ro in php and queue-worker services
- This allows deployment via rsync without requiring Docker image rebuild
- Storage volume still mounted as writable overlay for runtime data
- Change default DB_DRIVER to 'pgsql' for PostgreSQL
Deployment Architecture:
- rsync deploys code to /home/deploy/michaelschiemer/releases/{timestamp}
- Atomic symlink switch to /home/deploy/michaelschiemer/current
- PHP containers mount current/ for immediate code updates
- No rebuild needed - code changes are live after symlink switch
Benefits:
- Faster deployments (no Docker rebuild)
- Code changes reflected immediately
- Zero-downtime releases
- Easy rollback via symlink change
32 lines
870 B
PHP
32 lines
870 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Framework\Database\Platform;
|
|
|
|
use App\Framework\Config\Environment;
|
|
use App\Framework\DI\Initializer;
|
|
|
|
/**
|
|
* Initializes the database platform based on environment configuration
|
|
*/
|
|
final readonly class DatabasePlatformInitializer
|
|
{
|
|
public function __construct(
|
|
private Environment $environment
|
|
) {}
|
|
|
|
#[Initializer]
|
|
public function __invoke(): DatabasePlatform
|
|
{
|
|
$driver = $this->environment->get('DB_DRIVER', 'pgsql');
|
|
|
|
return match($driver) {
|
|
'mysql', 'mysqli' => new MySQLPlatform(),
|
|
'pgsql', 'postgres', 'postgresql' => new PostgreSQLPlatform(),
|
|
'sqlite' => throw new \RuntimeException('SQLite platform not yet implemented'),
|
|
default => throw new \RuntimeException("Unsupported database driver: {$driver}")
|
|
};
|
|
}
|
|
}
|