Compare commits

..

3 Commits
1.7.0 ... 1.8.0

6 changed files with 128 additions and 64 deletions

View File

@ -44,7 +44,12 @@ public function run(Site $site): Deployment
$log->save();
$deployment->log_id = $log->id;
$deployment->save();
$site->server->os()->runScript($site->path, $site->deploymentScript->content, $log);
$site->server->os()->runScript(
path: $site->path,
script: $site->deploymentScript->content,
serverLog: $log,
variables: $site->environmentVariables($deployment)
);
$deployment->status = DeploymentStatus::FINISHED;
$deployment->save();
})->catch(function () use ($deployment) {

View File

@ -283,4 +283,17 @@ public function hasSSL(): bool
{
return $this->ssls->isNotEmpty();
}
public function environmentVariables(?Deployment $deployment = null): array
{
return [
'SITE_PATH' => $this->path,
'DOMAIN' => $this->domain,
'BRANCH' => $this->branch ?? '',
'REPOSITORY' => $this->repository ?? '',
'COMMIT_ID' => $deployment?->commit_id ?? '',
'PHP_VERSION' => $this->php_version,
'PHP_PATH' => '/usr/bin/php'.$this->php_version,
];
}
}

View File

@ -140,19 +140,23 @@ public function tail(string $path, int $lines): string
);
}
public function runScript(string $path, string $script, ?ServerLog $serverLog, ?string $user = null): ServerLog
public function runScript(string $path, string $script, ?ServerLog $serverLog, ?string $user = null, ?array $variables = []): ServerLog
{
$ssh = $this->server->ssh($user);
if ($serverLog) {
$ssh->setLog($serverLog);
}
$ssh->exec(
$this->getScript('run-script.sh', [
'path' => $path,
'script' => $script,
]),
'run-script'
);
$command = '';
foreach ($variables as $key => $variable) {
$command .= "$key=$variable".PHP_EOL;
}
$command .= $this->getScript('run-script.sh', [
'path' => $path,
'script' => $script,
]);
$ssh->exec($command, 'run-script');
info($command);
return $ssh->log;
}

View File

@ -24,4 +24,4 @@ if ! wp --path=__path__ core install --url='http://__domain__' --title="__title_
echo 'VITO_SSH_ERROR' && exit 1
fi
print "Wordpress installed!"
echo "Wordpress installed!"

View File

@ -796,26 +796,64 @@
],
'hetzner' => [
'plans' => [
/* Shared vCPUs x86 */
[
'title' => 'CX11 - 1 Cores - 2 Memory - 20 Disk',
'title' => 'CX11 - 1 Cores (Intel) - 2 Memory - 20 Disk (eu only)',
'value' => 'cx11',
],
[
'title' => 'CX21 - 2 Cores - 4 Memory - 40 Disk',
'title' => 'CX22 - 2 Cores (Intel) - 4 Memory - 40 Disk (eu only)',
'value' => 'cx22',
],
[
'title' => 'CPX11 - 2 Cores (AMD) - 2 Memory - 40 Disk (eu only)',
'value' => 'cpx11',
],
[
'title' => 'CX21 - 2 Cores (Intel) - 4 Memory - 40 Disk (eu only)',
'value' => 'cx21',
],
[
'title' => 'CX31 - 2 Cores - 8 Memory - 80 Disk',
'title' => 'CX32 - 4 Cores (Intel) - 8 Memory - 80 Disk (eu only)',
'value' => 'cx32',
],
[
'title' => 'CPX21 - 3 Cores (AMD) - 4 Memory - 80 Disk',
'value' => 'cpx21',
],
[
'title' => 'CX31 - 2 Cores (Intel) - 8 Memory - 80 Disk (eu only)',
'value' => 'cx31',
],
[
'title' => 'CX41 - 4 Cores - 16 Memory - 160 Disk',
'title' => 'CPX31 - 4 Cores (AMD) - 8 Memory - 160 Disk',
'value' => 'cpx31',
],
[
'title' => 'CX42 - 8 Cores (Intel) - 16 Memory - 160 Disk (eu only)',
'value' => 'cx42',
],
[
'title' => 'CX41 - 4 Cores (Intel) - 16 Memory - 160 Disk (eu only)',
'value' => 'cx41',
],
[
'title' => 'CX51 - 8 Cores - 32 Memory - 240 Disk',
'title' => 'CPX41 - 8 Cores (AMD) - 16 Memory - 240 Disk',
'value' => 'cpx41',
],
[
'title' => 'CX52 - 16 Cores (Intel) - 32 Memory - 320 Disk (eu only)',
'value' => 'cx52',
],
[
'title' => 'CX51 - 8 Cores (Intel) - 32 Memory - 240 Disk (eu only)',
'value' => 'cx51',
],
[
'title' => 'CPX51 - 16 Cores (AMD) - 32 Memory - 360 Disk',
'value' => 'cpx51',
],
[
'title' => 'CCX11 Dedicated CPU - 2 Cores - 8 Memory - 80 Disk',
'value' => 'ccx11',
@ -836,66 +874,50 @@
'title' => 'CCX51 Dedicated CPU - 32 Cores - 128 Memory - 600 Disk',
'value' => 'ccx51',
],
/* Shared vCPUs Arm64 */
[
'title' => 'CPX 11 - 2 Cores - 2 Memory - 40 Disk',
'value' => 'cpx11',
],
[
'title' => 'CPX 21 - 3 Cores - 4 Memory - 80 Disk',
'value' => 'cpx21',
],
[
'title' => 'CPX 31 - 4 Cores - 8 Memory - 160 Disk',
'value' => 'cpx31',
],
[
'title' => 'CPX 41 - 8 Cores - 16 Memory - 240 Disk',
'value' => 'cpx41',
],
[
'title' => 'CPX 51 - 16 Cores - 32 Memory - 360 Disk',
'value' => 'cpx51',
],
[
'title' => 'CCX12 Dedicated CPU - 2 Cores - 8 Memory - 80 Disk',
'value' => 'ccx12',
],
[
'title' => 'CCX22 Dedicated CPU - 4 Cores - 16 Memory - 160 Disk',
'value' => 'ccx22',
],
[
'title' => 'CCX32 Dedicated CPU - 8 Cores - 32 Memory - 240 Disk',
'value' => 'ccx32',
],
[
'title' => 'CCX42 Dedicated CPU - 16 Cores - 64 Memory - 360 Disk',
'value' => 'ccx42',
],
[
'title' => 'CCX52 Dedicated CPU - 32 Cores - 128 Memory - 600 Disk',
'value' => 'ccx52',
],
[
'title' => 'CCX62 Dedicated CPU - 48 Cores - 192 Memory - 960 Disk',
'value' => 'ccx62',
],
[
'title' => 'CAX11 - 2 Cores - 4 Memory - 40 Disk',
'title' => 'CAX11 - 2 Cores (ARM64) - 4 Memory - 40 Disk',
'value' => 'cax11',
],
[
'title' => 'CAX21 - 4 Cores - 8 Memory - 80 Disk',
'title' => 'CAX21 - 4 Cores (ARM64) - 8 Memory - 80 Disk',
'value' => 'cax21',
],
[
'title' => 'CAX31 - 8 Cores - 16 Memory - 160 Disk',
'title' => 'CAX31 - 8 Cores (ARM64) - 16 Memory - 160 Disk',
'value' => 'cax31',
],
[
'title' => 'CAX41 - 16 Cores - 32 Memory - 320 Disk',
'title' => 'CAX41 - 16 Cores (ARM64) - 32 Memory - 320 Disk',
'value' => 'cax41',
],
/* Dedicated vCPUs */
[
'title' => 'CCX13 Dedicated CPU - 2 Cores (AMD) - 8 Memory - 80 Disk',
'value' => 'ccx13',
],
[
'title' => 'CCX23 Dedicated CPU - 4 Cores (AMD) - 16 Memory - 160 Disk',
'value' => 'ccx23',
],
[
'title' => 'CCX33 Dedicated CPU - 8 Cores (AMD) - 32 Memory - 240 Disk',
'value' => 'ccx33',
],
[
'title' => 'CCX43 Dedicated CPU - 16 Cores (AMD) - 64 Memory - 360 Disk',
'value' => 'ccx43',
],
[
'title' => 'CCX53 Dedicated CPU - 32 Cores (AMD) - 128 Memory - 600 Disk',
'value' => 'ccx53',
],
[
'title' => 'CCX63 Dedicated CPU - 48 Cores (AMD) - 192 Memory - 960 Disk',
'value' => 'ccx63',
],
],
'regions' => [
[
@ -920,7 +942,6 @@
],
],
'images' => [
'ubuntu_18' => 'ubuntu-18.04',
'ubuntu_20' => 'ubuntu-20.04',
'ubuntu_22' => 'ubuntu-22.04',
'ubuntu_24' => 'ubuntu-24.04',

View File

@ -24,6 +24,27 @@ class="p-6"
@enderror
</div>
<div class="mt-6">
<div class="flex items-center">
<x-input-label class="mr-1" :value="__('Available Variables')" />
(
<a
href="https://vitodeploy.com/sites/application.html#deployment-script"
target="_blank"
class="text-primary-500"
>
{{ __("How to use?") }}
</a>
)
</div>
<div class="mt-1 rounded-lg bg-gray-100 p-4 dark:bg-gray-700">
@foreach ($site->environmentVariables() as $key => $variable)
{{ $key }}={{ $variable }}
<br />
@endforeach
</div>
</div>
<div class="mt-6 flex items-center justify-end">
<x-secondary-button type="button" x-on:click="$dispatch('close')">
{{ __("Cancel") }}