43 lines
1.3 KiB
PHP
43 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Provisioning\Steps\Customer;
|
|
|
|
use App\Models\ProvisioningRun;
|
|
use App\Provisioning\StepResult;
|
|
use App\Services\Proxmox\ProxmoxClient;
|
|
use App\Support\ProvisioningSettings;
|
|
|
|
class ConfigureNextcloud extends CustomerStep
|
|
{
|
|
public function __construct(private ProxmoxClient $pve) {}
|
|
|
|
public function key(): string
|
|
{
|
|
return 'configure_nextcloud';
|
|
}
|
|
|
|
public function maxDuration(): int
|
|
{
|
|
return 300;
|
|
}
|
|
|
|
public function execute(ProvisioningRun $run): StepResult
|
|
{
|
|
$instance = $this->instance($run);
|
|
$pve = $this->pve->forHost($instance->host);
|
|
|
|
$fqdn = $instance->subdomain.'.'.ProvisioningSettings::dnsZone();
|
|
$occ = 'cd /opt/nextcloud && docker compose exec -T app php occ ';
|
|
|
|
// Idempotent occ calls (setting the same values is a no-op).
|
|
$this->guest($pve, $run, $occ.'config:system:set trusted_domains 1 --value='.escapeshellarg($fqdn));
|
|
if (filled($instance->custom_domain)) {
|
|
$this->guest($pve, $run, $occ.'config:system:set trusted_domains 2 --value='.escapeshellarg($instance->custom_domain));
|
|
}
|
|
$this->guest($pve, $run, $occ.'background:cron');
|
|
$this->guest($pve, $run, $occ.'config:system:set default_phone_region --value=DE');
|
|
|
|
return StepResult::advance();
|
|
}
|
|
}
|