mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-25 09:00:27 +00:00
update
This commit is contained in:
parent
e20fe3419b
commit
234ac290b6
5 changed files with 54 additions and 2 deletions
|
@ -12,6 +12,7 @@ enum ServerApplicationType: string implements HasLabel, HasDescriptions, HasIcon
|
|||
case APACHE_NODEJS = 'apache_nodejs';
|
||||
case APACHE_PYTHON = 'apache_python';
|
||||
case APACHE_RUBY = 'apache_ruby';
|
||||
case APACHE_DOCKER = 'apache_docker';
|
||||
|
||||
public function getLabel(): ?string
|
||||
{
|
||||
|
@ -20,6 +21,7 @@ enum ServerApplicationType: string implements HasLabel, HasDescriptions, HasIcon
|
|||
self::APACHE_NODEJS => 'Apache + Node.js (Passenger)',
|
||||
self::APACHE_PYTHON => 'Apache + Python (Passenger)',
|
||||
self::APACHE_RUBY => 'Apache + Ruby (Passenger)',
|
||||
self::APACHE_DOCKER => 'Docker',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -30,6 +32,7 @@ enum ServerApplicationType: string implements HasLabel, HasDescriptions, HasIcon
|
|||
self::APACHE_NODEJS => 'Install applications like Ghost, KeystoneJS, and more.',
|
||||
self::APACHE_PYTHON => 'Install applications like Django, Flask, and more.',
|
||||
self::APACHE_RUBY => 'Install applications like Ruby on Rails, Sinatra, and more.',
|
||||
self::APACHE_DOCKER => 'Run your own Docker containers.',
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -40,6 +43,7 @@ enum ServerApplicationType: string implements HasLabel, HasDescriptions, HasIcon
|
|||
self::APACHE_NODEJS => 'phyre-nodejs',
|
||||
self::APACHE_PYTHON => 'phyre-python',
|
||||
self::APACHE_RUBY => 'phyre-ruby',
|
||||
self::APACHE_DOCKER => 'docker-logo',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ use Filament\Resources\Resource;
|
|||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use JaOcero\RadioDeck\Forms\Components\RadioDeck;
|
||||
use Modules\Docker\App\Models\DockerContainer;
|
||||
|
||||
class DomainResource extends Resource
|
||||
{
|
||||
|
@ -33,8 +34,17 @@ class DomainResource extends Resource
|
|||
{
|
||||
$hostingSubscriptions = [];
|
||||
$getHostingSubscriptions = \App\Models\HostingSubscription::all();
|
||||
foreach ($getHostingSubscriptions as $hostingSubscription) {
|
||||
$hostingSubscriptions[$hostingSubscription->id] = $hostingSubscription->domain . ' - '.$hostingSubscription->customer->name;
|
||||
if (!$getHostingSubscriptions) {
|
||||
foreach ($getHostingSubscriptions as $hostingSubscription) {
|
||||
$hostingSubscriptions[$hostingSubscription->id] = $hostingSubscription->domain . ' - ' . $hostingSubscription->customer->name;
|
||||
}
|
||||
}
|
||||
$dockerContainers = [];
|
||||
$getDockerContainers = DockerContainer::all();
|
||||
if ($getDockerContainers) {
|
||||
foreach ($getDockerContainers as $dockerContainer) {
|
||||
$dockerContainers[$dockerContainer->id] = $dockerContainer->name;
|
||||
}
|
||||
}
|
||||
|
||||
return $form
|
||||
|
@ -125,6 +135,16 @@ class DomainResource extends Resource
|
|||
->options(SupportedApplicationTypes::getRubyVersions())
|
||||
->columns(6)
|
||||
->required(),
|
||||
|
||||
Select::make('server_application_settings.docker_container_id')
|
||||
->hidden(function (Get $get) {
|
||||
return $get('server_application_type') !== 'apache_docker';
|
||||
})
|
||||
->label('Docker Contaier')
|
||||
->options($dockerContainers)
|
||||
->columns(5)
|
||||
->required(),
|
||||
|
||||
]),
|
||||
Tabs\Tab::make('Git')
|
||||
->schema([
|
||||
|
|
|
@ -8,6 +8,7 @@ use App\Events\ModelDomainDeleting;
|
|||
use App\ShellApi;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Modules\Docker\App\Models\DockerContainer;
|
||||
|
||||
class Domain extends Model
|
||||
{
|
||||
|
@ -273,8 +274,21 @@ class Domain extends Model
|
|||
}
|
||||
|
||||
}
|
||||
if ($this->server_application_type == 'apache_docker') {
|
||||
if (isset($this->server_application_settings['docker_container_id'])) {
|
||||
$findDockerContainer = DockerContainer::where('id', $this->server_application_settings['docker_container_id'])
|
||||
->first();
|
||||
if ($findDockerContainer) {
|
||||
$apacheVirtualHostBuilder->setProxyPass('http://127.0.0.1:'.$findDockerContainer->external_port);
|
||||
$apacheVirtualHostBuilder->setAppType('docker');
|
||||
$apacheVirtualHostBuilder->setAppVersion($appVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$apacheBaseConfig = $apacheVirtualHostBuilder->buildConfig();
|
||||
|
||||
dd($apacheBaseConfig);
|
||||
if (!empty($apacheBaseConfig)) {
|
||||
file_put_contents('/etc/apache2/sites-available/'.$this->domain.'.conf', $apacheBaseConfig);
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@ class ApacheVirtualHostBuilder
|
|||
|
||||
public $serverAdmin = null;
|
||||
|
||||
public $proxyPass = null;
|
||||
|
||||
public function setPort($port)
|
||||
{
|
||||
$this->port = $port;
|
||||
|
@ -124,6 +126,11 @@ class ApacheVirtualHostBuilder
|
|||
$this->serverAdmin = $email;
|
||||
}
|
||||
|
||||
public function setProxyPass($proxyPass)
|
||||
{
|
||||
$this->proxyPass = $proxyPass;
|
||||
}
|
||||
|
||||
public function buildConfig()
|
||||
{
|
||||
$settings = [
|
||||
|
@ -145,6 +152,7 @@ class ApacheVirtualHostBuilder
|
|||
'passengerAppRoot' => $this->passengerAppRoot,
|
||||
'passengerAppType' => $this->passengerAppType,
|
||||
'passengerStartupFile' => $this->passengerStartupFile,
|
||||
'proxyPass' => $this->proxyPass,
|
||||
];
|
||||
|
||||
$apacheVirtualHostConfigs = app()->virtualHostManager->getConfigs($this->additionalServices);
|
||||
|
|
|
@ -37,6 +37,12 @@
|
|||
|
||||
@endif
|
||||
|
||||
@if (!empty($proxyPass))
|
||||
|
||||
ProxyPass / {{$proxyPass}}
|
||||
|
||||
@endif
|
||||
|
||||
<Directory {{$domainPublic}}>
|
||||
|
||||
Options Indexes FollowSymLinks MultiViews @if($appType == 'php') Includes ExecCGI @endif
|
||||
|
|
Loading…
Reference in a new issue