mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-04 15:32:35 +00:00
WIP notifications and other refactors (#88)
* WIP notifications and other refactors - refactor notification channels - send notifications on events related to the servers and sites - delete server log files on server deletion - add telegram notification channel - add new icons - cache configs and icons on installation and updates - new navbar for dark mode and settings * discord channel * build assets * pint
This commit is contained in:
@ -4,10 +4,14 @@
|
||||
|
||||
use App\Enums\OperatingSystem;
|
||||
use App\Exceptions\CouldNotConnectToProvider;
|
||||
use App\Facades\Notifier;
|
||||
use App\Notifications\FailedToDeleteServerFromProvider;
|
||||
use Aws\Ec2\Ec2Client;
|
||||
use Aws\EC2InstanceConnect\EC2InstanceConnectClient;
|
||||
use Exception;
|
||||
use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Throwable;
|
||||
|
||||
class AWS extends AbstractProvider
|
||||
{
|
||||
@ -125,9 +129,8 @@ public function delete(): void
|
||||
$this->ec2Client->terminateInstances([
|
||||
'InstanceIds' => [$this->server->provider_data['instance_id']],
|
||||
]);
|
||||
} catch (Exception) {
|
||||
/** @todo notify */
|
||||
// $this->server->team->notify(new FailedToDeleteServerFromProvider($this->server));
|
||||
} catch (Throwable) {
|
||||
Notifier::send($this->server, new FailedToDeleteServerFromProvider($this->server));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -164,7 +167,7 @@ private function createKeyPair(): void
|
||||
$result = $this->ec2Client->createKeyPair([
|
||||
'KeyName' => $keyName,
|
||||
]);
|
||||
/** @var \Illuminate\Filesystem\FilesystemAdapter $storageDisk */
|
||||
/** @var FilesystemAdapter $storageDisk */
|
||||
$storageDisk = Storage::disk(config('core.key_pairs_disk'));
|
||||
$storageDisk->put((string) $this->server->id, $result['KeyMaterial']);
|
||||
generate_public_key(
|
||||
|
Reference in New Issue
Block a user