feat: standalone mongodb

This commit is contained in:
Andras Bacsai
2023-10-19 13:32:03 +02:00
parent e342c4fd65
commit c53d88902c
28 changed files with 611 additions and 25 deletions

View File

@@ -2,6 +2,7 @@
use App\Models\Server;
use App\Models\StandaloneDocker;
use App\Models\StandaloneMongodb;
use App\Models\StandalonePostgresql;
use App\Models\StandaloneRedis;
use Visus\Cuid2\Cuid2;
@@ -43,6 +44,21 @@ function create_standalone_redis($environment_id, $destination_uuid): Standalone
]);
}
function create_standalone_mongodb($environment_id, $destination_uuid): StandaloneMongodb
{
$destination = StandaloneDocker::where('uuid', $destination_uuid)->first();
if (!$destination) {
throw new Exception('Destination not found');
}
return StandaloneMongodb::create([
'name' => generate_database_name('mongodb'),
'mongo_initdb_root_password' => \Illuminate\Support\Str::password(symbols: false),
'environment_id' => $environment_id,
'destination_id' => $destination->id,
'destination_type' => $destination->getMorphClass(),
]);
}
/**
* Delete file locally on the filesystem.
* @param string $filename