From 6af54edf3a70c8bf69c380baae80657d459a3d9d Mon Sep 17 00:00:00 2001 From: Akash Mitra Date: Thu, 2 May 2019 19:57:30 +0800 Subject: [PATCH] added new dashboard, cloud-init script generator --- app/CloudProviders/DigitalOceanService.php | 13 ++- resources/views/docs.blade.php | 115 +++++++++++++++++++-- resources/views/home.blade.php | 1 + 3 files changed, 116 insertions(+), 13 deletions(-) diff --git a/app/CloudProviders/DigitalOceanService.php b/app/CloudProviders/DigitalOceanService.php index 50613d2..1fe7680 100644 --- a/app/CloudProviders/DigitalOceanService.php +++ b/app/CloudProviders/DigitalOceanService.php @@ -196,9 +196,7 @@ public function provisionVM(Booty $booty) { $cloudInitCommand = $this->cloudProvisionScript( $booty->app, - json_decode($booty->services, true), - 'akash', - 'pakamala' + json_decode($booty->services, true) ); try { @@ -216,7 +214,12 @@ public function provisionVM(Booty $booty) ); $booty['internal_machine_id'] = $droplet->id; $booty->save(); - Journal::info('CloudService: provision VM request processed.', 0, __METHOD__, $this->order_id); + Journal::info('CloudService: provision VM request processed.', 0, __METHOD__, $this->order_id, [ + 'services' => json_decode($booty->services, true), + 'init_script' => $cloudInitCommand, + 'from' => $booty->origin->internal_snapshot_id, + 'sshkey' => $booty->sshkey + ]); } catch (Exception $e) { Journal::error(get_class($e) . ': ' . $e->getMessage(), $e->getCode(), __METHOD__, $this->order_id, ['booty' => $booty->toArray()]); throw $e; @@ -297,7 +300,7 @@ private function cloudProvisionScript($appName, $services) // add user service if ($this->serviceHas($services, 'laravel-add-user')) { $param = $services['laravel-add-user']; - $init->artisan('user:add ' . $param['name'] . ' ' . $param['email'] . ' ' . $param['password'] . ' admin'); + $init->artisan('user:add "' . $param['name'] . '" ' . $param['email'] . ' ' . $param['password'] . ' admin'); } // PASSPORT service diff --git a/resources/views/docs.blade.php b/resources/views/docs.blade.php index f4a7e9c..ae06c0e 100644 --- a/resources/views/docs.blade.php +++ b/resources/views/docs.blade.php @@ -111,7 +111,7 @@
booty.order_id
- Order Id of the request. If no order_id is supplied, this will be 0 + Order Id of the request. If no order_id is supplied, this will be auto-generated. @@ -125,12 +125,7 @@ Status of the booty - - -
booty.order_id
- - Order Id of the request. If no order_id is supplied, this will be 0 - +
booty.provider
@@ -220,6 +215,110 @@ + + + + + +

2. Create a new snapshot from existing booty

+

Creates a new snapshot and stores it. This snapshot can be used to create other booties in the future

+ + + + + + + + + + + + + + + + + + + + +
Endpoint/api/create/snapshot
Request TypePOST
Parameters + + + + + +
+
booty_id
+
An existing booty ID from the current application.
+
Response + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
status
+
Status of this request, "in-progress" or "failed"
+
message
+
Human friendly message to accompany with the status
+
snapshot.order_id
+
Order Id of the request. If no order_id is supplied, this will be auto generated.
+
snapshot.owner_email
+
Orderer email ID of the request. If no email id is supplied, this will be populated with the email id of the user who owns the auth token
+
snapshot.status
+
Status of the snapshot
+
snapshot.provider
+
Provider of the cloud infrastructure. E.g. "DO" for DigitalOcean
+
snapshot.app
+
Name of the application that is configured inside the snapshot
+
snapshot.updated_at
+
Last update datetime of the snapshot record
+
snapshot.created_at
+
Creation datetime of the snapshot record
+
snapshot.name
+
An auto-generated snapshot name
+