mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-19 09:51:37 +00:00
add blank php site (#94)
* add blank php site * fix frontend * fix source control check
This commit is contained in:
parent
0ec6a9dea2
commit
8665435bc4
@ -8,6 +8,8 @@ final class SiteType extends Enum
|
|||||||
{
|
{
|
||||||
const PHP = 'php';
|
const PHP = 'php';
|
||||||
|
|
||||||
|
const PHP_BLANK = 'php-blank';
|
||||||
|
|
||||||
const LARAVEL = 'laravel';
|
const LARAVEL = 'laravel';
|
||||||
|
|
||||||
const WORDPRESS = 'wordpress';
|
const WORDPRESS = 'wordpress';
|
||||||
|
19
app/Http/Livewire/Application/PhpBlankApp.php
Normal file
19
app/Http/Livewire/Application/PhpBlankApp.php
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Livewire\Application;
|
||||||
|
|
||||||
|
use App\Models\Site;
|
||||||
|
use App\Traits\RefreshComponentOnBroadcast;
|
||||||
|
use Livewire\Component;
|
||||||
|
|
||||||
|
class PhpBlankApp extends Component
|
||||||
|
{
|
||||||
|
use RefreshComponentOnBroadcast;
|
||||||
|
|
||||||
|
public Site $site;
|
||||||
|
|
||||||
|
public function render()
|
||||||
|
{
|
||||||
|
return view('livewire.application.php-blank-app');
|
||||||
|
}
|
||||||
|
}
|
67
app/SiteTypes/PHPBlank.php
Executable file
67
app/SiteTypes/PHPBlank.php
Executable file
@ -0,0 +1,67 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\SiteTypes;
|
||||||
|
|
||||||
|
use App\Enums\SiteFeature;
|
||||||
|
use App\Jobs\Site\CreateVHost;
|
||||||
|
use Illuminate\Support\Facades\Bus;
|
||||||
|
use Illuminate\Validation\Rule;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class PHPBlank extends PHPSite
|
||||||
|
{
|
||||||
|
public function supportedFeatures(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
SiteFeature::DEPLOYMENT,
|
||||||
|
SiteFeature::ENV,
|
||||||
|
SiteFeature::SSL,
|
||||||
|
SiteFeature::QUEUES,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createValidationRules(array $input): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'php_version' => [
|
||||||
|
'required',
|
||||||
|
Rule::in($this->site->server->installedPHPVersions()),
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function createFields(array $input): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'web_directory' => $input['web_directory'] ?? '',
|
||||||
|
'php_version' => $input['php_version'] ?? '',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function data(array $input): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function install(): void
|
||||||
|
{
|
||||||
|
$chain = [
|
||||||
|
new CreateVHost($this->site),
|
||||||
|
$this->progress(65),
|
||||||
|
function () {
|
||||||
|
$this->site->php()?->restart();
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
$chain[] = function () {
|
||||||
|
$this->site->installationFinished();
|
||||||
|
};
|
||||||
|
|
||||||
|
Bus::chain($chain)
|
||||||
|
->catch(function (Throwable $e) {
|
||||||
|
$this->site->installationFailed($e);
|
||||||
|
})
|
||||||
|
->onConnection('ssh-long')
|
||||||
|
->dispatch();
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,7 @@
|
|||||||
use App\ServiceHandlers\ProcessManager\Supervisor;
|
use App\ServiceHandlers\ProcessManager\Supervisor;
|
||||||
use App\ServiceHandlers\Webserver\Nginx;
|
use App\ServiceHandlers\Webserver\Nginx;
|
||||||
use App\SiteTypes\Laravel;
|
use App\SiteTypes\Laravel;
|
||||||
|
use App\SiteTypes\PHPBlank;
|
||||||
use App\SiteTypes\PHPSite;
|
use App\SiteTypes\PHPSite;
|
||||||
use App\SiteTypes\Wordpress;
|
use App\SiteTypes\Wordpress;
|
||||||
use App\SourceControlProviders\Bitbucket;
|
use App\SourceControlProviders\Bitbucket;
|
||||||
@ -263,11 +264,13 @@
|
|||||||
*/
|
*/
|
||||||
'site_types' => [
|
'site_types' => [
|
||||||
\App\Enums\SiteType::PHP,
|
\App\Enums\SiteType::PHP,
|
||||||
|
\App\Enums\SiteType::PHP_BLANK,
|
||||||
\App\Enums\SiteType::LARAVEL,
|
\App\Enums\SiteType::LARAVEL,
|
||||||
\App\Enums\SiteType::WORDPRESS,
|
\App\Enums\SiteType::WORDPRESS,
|
||||||
],
|
],
|
||||||
'site_types_class' => [
|
'site_types_class' => [
|
||||||
\App\Enums\SiteType::PHP => PHPSite::class,
|
\App\Enums\SiteType::PHP => PHPSite::class,
|
||||||
|
\App\Enums\SiteType::PHP_BLANK => PHPBlank::class,
|
||||||
\App\Enums\SiteType::LARAVEL => Laravel::class,
|
\App\Enums\SiteType::LARAVEL => Laravel::class,
|
||||||
\App\Enums\SiteType::WORDPRESS => Wordpress::class,
|
\App\Enums\SiteType::WORDPRESS => Wordpress::class,
|
||||||
],
|
],
|
||||||
|
File diff suppressed because one or more lines are too long
1
public/build/assets/app-ae945733.css
Normal file
1
public/build/assets/app-ae945733.css
Normal file
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"resources/css/app.css": {
|
"resources/css/app.css": {
|
||||||
"file": "assets/app-8b808e33.css",
|
"file": "assets/app-ae945733.css",
|
||||||
"isEntry": true,
|
"isEntry": true,
|
||||||
"src": "resources/css/app.css"
|
"src": "resources/css/app.css"
|
||||||
},
|
},
|
||||||
|
37
public/static/images/php-blank.svg
Normal file
37
public/static/images/php-blank.svg
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<svg width="256px" height="135px" viewBox="0 0 256 135" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" preserveAspectRatio="xMidYMid">
|
||||||
|
<defs>
|
||||||
|
<radialGradient id="radialGradient-1" cx="0.8366" cy="-125.811" r="363.0565" gradientTransform="matrix(0.463 0 0 0.463 76.4644 81.9182)" gradientUnits="userSpaceOnUse">
|
||||||
|
<stop offset="0" style="stop-color:#FFFFFF"/>
|
||||||
|
<stop offset="0.5" style="stop-color:#4C6B97"/>
|
||||||
|
<stop offset="1" style="stop-color:#231F20"/>
|
||||||
|
</radialGradient>
|
||||||
|
</defs>
|
||||||
|
<g>
|
||||||
|
<ellipse fill="url(#radialGradient-1)" cx="128" cy="67.3" rx="128" ry="67.3"/>
|
||||||
|
<ellipse fill="#6181B6" cx="128" cy="67.3" rx="123" ry="62.3"/>
|
||||||
|
<g>
|
||||||
|
<path fill="#FFFFFF" d="M152.9,87.5c0,0,6.1-31.4,6.1-31.4c1.4-7.1,0.2-12.4-3.4-15.7c-3.5-3.2-9.5-4.8-18.3-4.8h-10.6l3-15.6
|
||||||
|
c0.1-0.6,0-1.2-0.4-1.7c-0.4-0.5-0.9-0.7-1.5-0.7h-14.6c-1,0-1.8,0.7-2,1.6l-6.5,33.3c-0.6-3.8-2-7-4.4-9.6
|
||||||
|
c-4.3-4.9-11-7.4-20.1-7.4H52.1c-1,0-1.8,0.7-2,1.6L37,104.7c-0.1,0.6,0,1.2,0.4,1.7c0.4,0.5,0.9,0.7,1.5,0.7h14.7
|
||||||
|
c1,0,1.8-0.7,2-1.6l3.2-16.3h10.9c5.7,0,10.6-0.6,14.3-1.8c3.9-1.3,7.4-3.4,10.5-6.3c2.5-2.3,4.6-4.9,6.2-7.7l-2.6,13.5
|
||||||
|
c-0.1,0.6,0,1.2,0.4,1.7s0.9,0.7,1.5,0.7h14.6c1,0,1.8-0.7,2-1.6l7.2-37h10c4.3,0,5.5,0.8,5.9,1.2c0.3,0.3,0.9,1.5,0.2,5.2
|
||||||
|
l-5.8,29.9c-0.1,0.6,0,1.2,0.4,1.7c0.4,0.5,0.9,0.7,1.5,0.7H151C151.9,89.1,152.7,88.4,152.9,87.5z M85.3,61.5
|
||||||
|
c-0.9,4.7-2.6,8.1-5.1,10c-2.5,1.9-6.6,2.9-12,2.9h-6.5l4.7-24.2h8.4c6.2,0,8.7,1.3,9.7,2.4C85.8,54.2,86.1,57.3,85.3,61.5z"/>
|
||||||
|
<path fill="#FFFFFF" d="M215.3,42.9c-4.3-4.9-11-7.4-20.1-7.4h-28.3c-1,0-1.8,0.7-2,1.6l-13.1,67.5c-0.1,0.6,0,1.2,0.4,1.7
|
||||||
|
c0.4,0.5,0.9,0.7,1.5,0.7h14.7c1,0,1.8-0.7,2-1.6l3.2-16.3h10.9c5.7,0,10.6-0.6,14.3-1.8c3.9-1.3,7.4-3.4,10.5-6.3
|
||||||
|
c2.6-2.4,4.8-5.1,6.4-8c1.6-2.9,2.8-6.1,3.5-9.6C220.9,54.7,219.6,47.9,215.3,42.9z M200,61.5c-0.9,4.7-2.6,8.1-5.1,10
|
||||||
|
c-2.5,1.9-6.6,2.9-12,2.9h-6.5l4.7-24.2h8.4c6.2,0,8.7,1.3,9.7,2.4C200.6,54.2,200.9,57.3,200,61.5z"/>
|
||||||
|
</g>
|
||||||
|
<g>
|
||||||
|
<path fill="#000004" d="M74.8,48.2c5.6,0,9.3,1,11.2,3.1c1.9,2.1,2.3,5.6,1.3,10.6c-1,5.2-3,9-5.9,11.2c-2.9,2.2-7.3,3.3-13.2,3.3
|
||||||
|
h-8.9l5.5-28.2H74.8z M39,105h14.7l3.5-17.9h12.6c5.6,0,10.1-0.6,13.7-1.8c3.6-1.2,6.8-3.1,9.8-5.9c2.5-2.3,4.5-4.8,6-7.5
|
||||||
|
c1.5-2.7,2.6-5.7,3.2-9c1.6-8,0.4-14.2-3.5-18.7c-3.9-4.5-10.1-6.7-18.6-6.7H52.1L39,105z"/>
|
||||||
|
<path fill="#000004" d="M113.3,19.6h14.6l-3.5,17.9h13c8.2,0,13.8,1.4,16.9,4.3c3.1,2.9,4,7.5,2.8,13.9L151,87.1h-14.8l5.8-29.9
|
||||||
|
c0.7-3.4,0.4-5.7-0.7-6.9c-1.1-1.2-3.6-1.9-7.3-1.9h-11.7l-7.5,38.7h-14.6L113.3,19.6z"/>
|
||||||
|
<path fill="#000004" d="M189.5,48.2c5.6,0,9.3,1,11.2,3.1c1.9,2.1,2.3,5.6,1.3,10.6c-1,5.2-3,9-5.9,11.2c-2.9,2.2-7.3,3.3-13.2,3.3
|
||||||
|
h-8.9l5.5-28.2H189.5z M153.7,105h14.7l3.5-17.9h12.6c5.6,0,10.1-0.6,13.7-1.8c3.6-1.2,6.8-3.1,9.8-5.9c2.5-2.3,4.5-4.8,6-7.5
|
||||||
|
c1.5-2.7,2.6-5.7,3.2-9c1.6-8,0.4-14.2-3.5-18.7c-3.9-4.5-10.1-6.7-18.6-6.7h-28.3L153.7,105z"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.9 KiB |
@ -1,36 +1 @@
|
|||||||
<div>
|
@include('livewire.application.php-app')
|
||||||
<x-card-header>
|
|
||||||
<x-slot name="title">{{ __("Application") }}</x-slot>
|
|
||||||
<x-slot name="description">{{ __("Here you can manage your application") }}</x-slot>
|
|
||||||
<x-slot name="aside">
|
|
||||||
<div class="flex items-center">
|
|
||||||
<div class="mr-2">
|
|
||||||
<livewire:application.deploy :site="$site" />
|
|
||||||
</div>
|
|
||||||
<div class="mr-2">
|
|
||||||
<livewire:application.auto-deployment :site="$site" />
|
|
||||||
</div>
|
|
||||||
<x-dropdown>
|
|
||||||
<x-slot name="trigger">
|
|
||||||
<x-secondary-button>
|
|
||||||
{{ __('Manage') }}
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-5 h-5 ml-1">
|
|
||||||
<path stroke-linecap="round" stroke-linejoin="round" d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" />
|
|
||||||
</svg>
|
|
||||||
</x-secondary-button>
|
|
||||||
</x-slot>
|
|
||||||
<x-slot name="content">
|
|
||||||
<x-dropdown-link class="cursor-pointer" x-on:click="$dispatch('open-modal', 'change-branch')">{{ __("Branch") }}</x-dropdown-link>
|
|
||||||
<x-dropdown-link class="cursor-pointer" x-on:click="$dispatch('open-modal', 'deployment-script')">{{ __("Deployment Script") }}</x-dropdown-link>
|
|
||||||
<x-dropdown-link class="cursor-pointer" x-on:click="$dispatch('open-modal', 'update-env')">{{ __(".env") }}</x-dropdown-link>
|
|
||||||
</x-slot>
|
|
||||||
</x-dropdown>
|
|
||||||
<livewire:application.change-branch :site="$site" />
|
|
||||||
<livewire:application.deployment-script :site="$site" />
|
|
||||||
<livewire:application.env :site="$site" />
|
|
||||||
</div>
|
|
||||||
</x-slot>
|
|
||||||
</x-card-header>
|
|
||||||
|
|
||||||
<livewire:application.deployments-list :site="$site" />
|
|
||||||
</div>
|
|
||||||
|
@ -1,3 +1,62 @@
|
|||||||
<div>
|
<div>
|
||||||
|
<x-card-header>
|
||||||
|
<x-slot name="title">{{ __('Application') }}</x-slot>
|
||||||
|
<x-slot name="description">{{ __('Here you can manage your application') }}</x-slot>
|
||||||
|
<x-slot name="aside">
|
||||||
|
<div class="flex items-center">
|
||||||
|
<div class="mr-2">
|
||||||
|
<livewire:application.deploy :site="$site" />
|
||||||
|
</div>
|
||||||
|
@if ($site->source_control_id)
|
||||||
|
<div class="mr-2">
|
||||||
|
<livewire:application.auto-deployment :site="$site" />
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
|
<x-dropdown>
|
||||||
|
<x-slot name="trigger">
|
||||||
|
<x-secondary-button>
|
||||||
|
{{ __('Manage') }}
|
||||||
|
<svg
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
stroke-width="1.5"
|
||||||
|
stroke="currentColor"
|
||||||
|
class="ml-1 h-5 w-5"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
d="M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</x-secondary-button>
|
||||||
|
</x-slot>
|
||||||
|
<x-slot name="content">
|
||||||
|
@if ($site->source_control_id)
|
||||||
|
<x-dropdown-link
|
||||||
|
class="cursor-pointer"
|
||||||
|
x-on:click="$dispatch('open-modal', 'change-branch')"
|
||||||
|
>{{ __('Branch') }}</x-dropdown-link>
|
||||||
|
@endif
|
||||||
|
<x-dropdown-link
|
||||||
|
class="cursor-pointer"
|
||||||
|
x-on:click="$dispatch('open-modal', 'deployment-script')"
|
||||||
|
>{{ __('Deployment Script') }}</x-dropdown-link>
|
||||||
|
<x-dropdown-link
|
||||||
|
class="cursor-pointer"
|
||||||
|
x-on:click="$dispatch('open-modal', 'update-env')"
|
||||||
|
>{{ __('.env') }}</x-dropdown-link>
|
||||||
|
</x-slot>
|
||||||
|
</x-dropdown>
|
||||||
|
@if ($site->source_control_id)
|
||||||
|
<livewire:application.change-branch :site="$site" />
|
||||||
|
@endif
|
||||||
|
<livewire:application.deployment-script :site="$site" />
|
||||||
|
<livewire:application.env :site="$site" />
|
||||||
|
</div>
|
||||||
|
</x-slot>
|
||||||
|
</x-card-header>
|
||||||
|
|
||||||
|
<livewire:application.deployments-list :site="$site" />
|
||||||
</div>
|
</div>
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
@include('livewire.application.php-app')
|
@ -0,0 +1,3 @@
|
|||||||
|
@include('livewire.sites.partials.create.fields.php-version')
|
||||||
|
|
||||||
|
@include('livewire.sites.partials.create.fields.web-directory')
|
@ -10,16 +10,6 @@
|
|||||||
<livewire:server-logs.logs-list :server="$site->server" :site="$site" :count="10" />
|
<livewire:server-logs.logs-list :server="$site->server" :site="$site" :count="10" />
|
||||||
@endif
|
@endif
|
||||||
@if($site->status === \App\Enums\SiteStatus::READY)
|
@if($site->status === \App\Enums\SiteStatus::READY)
|
||||||
@if($site->type == \App\Enums\SiteType::LARAVEL)
|
@livewire('application.' . $site->type . '-app', ['site' => $site])
|
||||||
<livewire:application.laravel-app :site="$site" />
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if($site->type == \App\Enums\SiteType::PHP)
|
|
||||||
<livewire:application.php-app :site="$site" />
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if($site->type == \App\Enums\SiteType::WORDPRESS)
|
|
||||||
<livewire:application.wordpress-app :site="$site" />
|
|
||||||
@endif
|
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,15 +1,11 @@
|
|||||||
<x-site-layout :site="$site">
|
@if($site->type == \App\Enums\SiteType::LARAVEL)
|
||||||
<x-slot name="pageTitle">{{ __("Application") }}</x-slot>
|
<livewire:application.laravel-app :site="$site" />
|
||||||
|
@endif
|
||||||
|
|
||||||
@if($site->type == \App\Enums\SiteType::LARAVEL)
|
@if($site->type == \App\Enums\SiteType::PHP)
|
||||||
<livewire:application.laravel-app :site="$site" />
|
<livewire:application.php-app :site="$site" />
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($site->type == \App\Enums\SiteType::PHP)
|
@if($site->type == \App\Enums\SiteType::WORDPRESS)
|
||||||
<livewire:application.php-app :site="$site" />
|
<livewire:application.wordpress-app :site="$site" />
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if($site->type == \App\Enums\SiteType::WORDPRESS)
|
|
||||||
<livewire:application.wordpress-app :site="$site" />
|
|
||||||
@endif
|
|
||||||
</x-site-layout>
|
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
<x-site-layout :site="$site">
|
<x-site-layout :site="$site">
|
||||||
<x-slot name="pageTitle">{{ __("Settings") }}</x-slot>
|
<x-slot name="pageTitle">{{ __('Settings') }}</x-slot>
|
||||||
|
|
||||||
<livewire:sites.change-php-version :site="$site"/>
|
<livewire:sites.change-php-version :site="$site" />
|
||||||
|
|
||||||
<livewire:sites.update-source-control-provider :site="$site"/>
|
@if ($site->source_control_id)
|
||||||
|
<livewire:sites.update-source-control-provider :site="$site" />
|
||||||
|
@endif
|
||||||
|
|
||||||
<livewire:sites.update-v-host :site="$site"/>
|
<livewire:sites.update-v-host :site="$site" />
|
||||||
|
|
||||||
<x-card>
|
<x-card>
|
||||||
<x-slot name="title">{{ __("Delete Site") }}</x-slot>
|
<x-slot name="title">{{ __('Delete Site') }}</x-slot>
|
||||||
<x-slot name="description">{{ __("Permanently delete the site from server") }}</x-slot>
|
<x-slot name="description">{{ __('Permanently delete the site from server') }}</x-slot>
|
||||||
<p>{{ __("Once your site is deleted, all of its files will be deleted from the server.") }}</p>
|
<p>{{ __('Once your site is deleted, all of its files will be deleted from the server.') }}</p>
|
||||||
<div class="mt-5">
|
<div class="mt-5">
|
||||||
<livewire:sites.delete-site :site="$site"/>
|
<livewire:sites.delete-site :site="$site" />
|
||||||
</div>
|
</div>
|
||||||
</x-card>
|
</x-card>
|
||||||
</x-site-layout>
|
</x-site-layout>
|
||||||
|
@ -172,6 +172,15 @@ public static function create_data(): array
|
|||||||
'inputs.database_password' => 'password',
|
'inputs.database_password' => 'password',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
[
|
||||||
|
'inputs.type' => SiteType::PHP_BLANK,
|
||||||
|
'inputs.domain' => 'example.com',
|
||||||
|
'inputs.alias' => 'www.example.com',
|
||||||
|
'inputs.php_version' => '8.2',
|
||||||
|
'inputs.web_directory' => 'public',
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user