Skip to content

Commit

Permalink
added new dashboard, cloud-init script generator
Browse files Browse the repository at this point in the history
  • Loading branch information
akash-mitra committed May 2, 2019
1 parent 56dff4c commit 6af54ed
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 13 deletions.
13 changes: 8 additions & 5 deletions app/CloudProviders/DigitalOceanService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down
115 changes: 107 additions & 8 deletions resources/views/docs.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<td>
<pre>booty.order_id</pre>
</td>
<td>Order Id of the request. If no order_id is supplied, this will be 0</td>
<td>Order Id of the request. If no order_id is supplied, this will be auto-generated.</td>
</tr>
<tr>
<td>
Expand All @@ -125,12 +125,7 @@
</td>
<td>Status of the booty</td>
</tr>
<tr>
<td>
<pre>booty.order_id</pre>
</td>
<td>Order Id of the request. If no order_id is supplied, this will be 0</td>
</tr>

<tr>
<td>
<pre>booty.provider</pre>
Expand Down Expand Up @@ -220,6 +215,110 @@
</tr>

</table>





<h4>2. Create a new snapshot from existing booty</h4>
<p>Creates a new snapshot and stores it. This snapshot can be used to create other booties in the future</p>
<table class="table">

<tr>
<td><strong>Endpoint</strong></td>
<td><code>/api/create/snapshot</code></td>
</tr>
<tr>
<td><strong>Request Type</strong></td>
<td><code>POST</code></td>
</tr>
<tr>
<td><strong>Parameters</strong></td>
<td>
<table class="table-sm table-borderless">
<tr>
<td>
<pre>booty_id</pre>
</td>
<td>An existing booty ID from the current application.</td>
</tr>
</table>
</td>
</tr>

<tr>
<td><strong>Response</strong></td>
<td>
<table class="table-sm table-borderless">
<tr>
<td>
<pre>status</pre>
</td>
<td>Status of this request, "in-progress" or "failed"</td>
</tr>
<tr>
<td>
<pre>message</pre>
</td>
<td>Human friendly message to accompany with the status</td>
</tr>
<tr>
<td>
<pre>snapshot.order_id</pre>
</td>
<td>Order Id of the request. If no order_id is supplied, this will be auto generated.</td>
</tr>
<tr>
<td>
<pre>snapshot.owner_email</pre>
</td>
<td>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</td>
</tr>
<tr>
<td>
<pre>snapshot.status</pre>
</td>
<td>Status of the snapshot</td>
</tr>

<tr>
<td>
<pre>snapshot.provider</pre>
</td>
<td>Provider of the cloud infrastructure. E.g. "DO" for DigitalOcean</td>
</tr>


<tr>
<td>
<pre>snapshot.app</pre>
</td>
<td>Name of the application that is configured inside the snapshot</td>
</tr>

<tr>
<td>
<pre>snapshot.updated_at</pre>
</td>
<td>Last update datetime of the snapshot record</td>
</tr>
<tr>
<td>
<pre>snapshot.created_at</pre>
</td>
<td> Creation datetime of the snapshot record</td>
</tr>
<tr>
<td>
<pre>snapshot.name</pre>
</td>
<td>An auto-generated snapshot name</td>
</tr>
</table>
</td>
</tr>

</table>
<!-- <h4>Curl Request Example</h4>
<pre>curl --request POST \
--url https://bootyman.app/api/create/booty \
Expand Down Expand Up @@ -258,4 +357,4 @@
</div>
</div>
</div>
@endsection
@endsection
1 change: 1 addition & 0 deletions resources/views/home.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<style>
pre {
padding: 5px;
white-space: pre-wrap;
}
.string {
Expand Down

0 comments on commit 6af54ed

Please sign in to comment.