wip: services
feat: able to map port<->domain
This commit is contained in:
parent
c91f426af3
commit
67078fdc71
@ -21,6 +21,7 @@ class StartPostgresql
|
|||||||
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
|
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
|
||||||
|
|
||||||
$this->commands = [
|
$this->commands = [
|
||||||
|
"echo '####### Starting {$database->name}.'",
|
||||||
"mkdir -p $this->configuration_dir",
|
"mkdir -p $this->configuration_dir",
|
||||||
"mkdir -p $this->configuration_dir/docker-entrypoint-initdb.d/"
|
"mkdir -p $this->configuration_dir/docker-entrypoint-initdb.d/"
|
||||||
];
|
];
|
||||||
@ -96,6 +97,7 @@ class StartPostgresql
|
|||||||
$readme = generate_readme_file($this->database->name, now());
|
$readme = generate_readme_file($this->database->name, now());
|
||||||
$this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md";
|
$this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md";
|
||||||
$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";
|
$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";
|
||||||
|
$this->commands[] = "echo '####### {$database->name} started.'";
|
||||||
return remote_process($this->commands, $server);
|
return remote_process($this->commands, $server);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Actions\Proxy;
|
namespace App\Actions\Proxy;
|
||||||
|
|
||||||
use App\Enums\ProxyStatus;
|
|
||||||
use App\Enums\ProxyTypes;
|
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Lorisleiva\Actions\Concerns\AsAction;
|
use Lorisleiva\Actions\Concerns\AsAction;
|
||||||
|
@ -11,7 +11,7 @@ class StartService
|
|||||||
public function handle(Service $service)
|
public function handle(Service $service)
|
||||||
{
|
{
|
||||||
$workdir = service_configuration_dir() . "/{$service->uuid}";
|
$workdir = service_configuration_dir() . "/{$service->uuid}";
|
||||||
$commands[] = "echo 'Starting service {$service->name} on {$service->server->name}.'";
|
$commands[] = "echo '####### Starting service {$service->name} on {$service->server->name}.'";
|
||||||
$commands[] = "mkdir -p $workdir";
|
$commands[] = "mkdir -p $workdir";
|
||||||
$commands[] = "cd $workdir";
|
$commands[] = "cd $workdir";
|
||||||
|
|
||||||
@ -22,11 +22,10 @@ class StartService
|
|||||||
foreach ($envs as $env) {
|
foreach ($envs as $env) {
|
||||||
$commands[] = "echo '{$env->key}={$env->value}' >> .env";
|
$commands[] = "echo '{$env->key}={$env->value}' >> .env";
|
||||||
}
|
}
|
||||||
$commands[] = "echo 'Pulling images and starting containers...'";
|
$commands[] = "echo '####### Pulling images.'";
|
||||||
$commands[] = "docker compose pull";
|
$commands[] = "docker compose pull --quiet";
|
||||||
$commands[] = "docker compose up -d";
|
$commands[] = "echo '####### Starting containers.'";
|
||||||
$commands[] = "echo 'Waiting for containers to start...'";
|
$commands[] = "docker compose up -d >/dev/null 2>&1";
|
||||||
$commands[] = "sleep 5";
|
|
||||||
$commands[] = "docker network connect $service->uuid coolify-proxy 2>/dev/null || true";
|
$commands[] = "docker network connect $service->uuid coolify-proxy 2>/dev/null || true";
|
||||||
$activity = remote_process($commands, $service->server);
|
$activity = remote_process($commands, $service->server);
|
||||||
return $activity;
|
return $activity;
|
||||||
|
@ -20,6 +20,6 @@ class StopService
|
|||||||
instant_remote_process(["docker rm -f {$db->name}-{$service->uuid}"], $service->server);
|
instant_remote_process(["docker rm -f {$db->name}-{$service->uuid}"], $service->server);
|
||||||
$db->update(['status' => 'exited']);
|
$db->update(['status' => 'exited']);
|
||||||
}
|
}
|
||||||
instant_remote_process(["docker network disconnect {$service->uuid} coolify-proxy 2>/dev/null"], $service->server);
|
instant_remote_process(["docker network disconnect {$service->uuid} coolify-proxy 2>/dev/null"], $service->server, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class Form extends Component
|
|||||||
$this->destination->delete();
|
$this->destination->delete();
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,6 @@ class General extends Component
|
|||||||
'application.ports_exposes' => 'required',
|
'application.ports_exposes' => 'required',
|
||||||
'application.ports_mappings' => 'nullable',
|
'application.ports_mappings' => 'nullable',
|
||||||
'application.dockerfile' => 'nullable',
|
'application.dockerfile' => 'nullable',
|
||||||
'application.dockercompose_raw' => 'nullable',
|
|
||||||
'application.dockercompose' => 'nullable',
|
|
||||||
];
|
];
|
||||||
protected $validationAttributes = [
|
protected $validationAttributes = [
|
||||||
'application.name' => 'name',
|
'application.name' => 'name',
|
||||||
@ -72,8 +70,6 @@ class General extends Component
|
|||||||
'application.ports_exposes' => 'Ports exposes',
|
'application.ports_exposes' => 'Ports exposes',
|
||||||
'application.ports_mappings' => 'Ports mappings',
|
'application.ports_mappings' => 'Ports mappings',
|
||||||
'application.dockerfile' => 'Dockerfile',
|
'application.dockerfile' => 'Dockerfile',
|
||||||
'application.dockercompose_raw' => 'Docker Compose (raw)',
|
|
||||||
'application.dockercompose' => 'Docker Compose',
|
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -165,10 +161,6 @@ class General extends Component
|
|||||||
if ($this->application->publish_directory && $this->application->publish_directory !== '/') {
|
if ($this->application->publish_directory && $this->application->publish_directory !== '/') {
|
||||||
$this->application->publish_directory = rtrim($this->application->publish_directory, '/');
|
$this->application->publish_directory = rtrim($this->application->publish_directory, '/');
|
||||||
}
|
}
|
||||||
if (data_get($this->application, 'dockercompose_raw')) {
|
|
||||||
$details = generateServiceFromTemplate( $this->application);
|
|
||||||
$this->application->dockercompose = data_get($details, 'dockercompose');
|
|
||||||
}
|
|
||||||
$this->application->save();
|
$this->application->save();
|
||||||
$this->emit('success', 'Application settings updated!');
|
$this->emit('success', 'Application settings updated!');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
@ -10,6 +10,7 @@ class Application extends Component
|
|||||||
public ServiceApplication $application;
|
public ServiceApplication $application;
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'application.human_name' => 'nullable',
|
'application.human_name' => 'nullable',
|
||||||
|
'application.description' => 'nullable',
|
||||||
'application.fqdn' => 'nullable',
|
'application.fqdn' => 'nullable',
|
||||||
];
|
];
|
||||||
public function render()
|
public function render()
|
||||||
|
@ -11,6 +11,7 @@ class Database extends Component
|
|||||||
public ServiceDatabase $database;
|
public ServiceDatabase $database;
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'database.human_name' => 'nullable',
|
'database.human_name' => 'nullable',
|
||||||
|
'database.description' => 'nullable',
|
||||||
];
|
];
|
||||||
public function render()
|
public function render()
|
||||||
{
|
{
|
||||||
|
@ -2,11 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Project\Service;
|
namespace App\Http\Livewire\Project\Service;
|
||||||
|
|
||||||
use App\Actions\Service\StartService;
|
|
||||||
use App\Actions\Service\StopService;
|
|
||||||
use App\Jobs\ContainerStatusJob;
|
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class Index extends Component
|
class Index extends Component
|
||||||
@ -18,6 +14,8 @@ class Index extends Component
|
|||||||
protected $rules = [
|
protected $rules = [
|
||||||
'service.docker_compose_raw' => 'required',
|
'service.docker_compose_raw' => 'required',
|
||||||
'service.docker_compose' => 'required',
|
'service.docker_compose' => 'required',
|
||||||
|
'service.name' => 'required',
|
||||||
|
'service.description' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function mount()
|
public function mount()
|
||||||
@ -36,5 +34,13 @@ class Index extends Component
|
|||||||
$this->service->refresh();
|
$this->service->refresh();
|
||||||
$this->emit('refreshEnvs');
|
$this->emit('refreshEnvs');
|
||||||
}
|
}
|
||||||
|
public function submit() {
|
||||||
|
try {
|
||||||
|
$this->validate();
|
||||||
|
$this->service->save();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return handleError($e, $this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ class Danger extends Component
|
|||||||
'environment_name' => $this->parameters['environment_name']
|
'environment_name' => $this->parameters['environment_name']
|
||||||
]);
|
]);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ class ByIp extends Component
|
|||||||
$server->settings->save();
|
$server->settings->save();
|
||||||
return redirect()->route('server.show', $server->uuid);
|
return redirect()->route('server.show', $server->uuid);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class Proxy extends Component
|
|||||||
setup_default_redirect_404(redirect_url: $this->server->proxy->redirect_url, server: $this->server);
|
setup_default_redirect_404(redirect_url: $this->server->proxy->redirect_url, server: $this->server);
|
||||||
$this->emit('success', 'Proxy configuration saved.');
|
$this->emit('success', 'Proxy configuration saved.');
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class Proxy extends Component
|
|||||||
try {
|
try {
|
||||||
$this->proxy_settings = CheckConfiguration::run($this->server, true);
|
$this->proxy_settings = CheckConfiguration::run($this->server, true);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ class Proxy extends Component
|
|||||||
try {
|
try {
|
||||||
$this->proxy_settings = CheckConfiguration::run($this->server);
|
$this->proxy_settings = CheckConfiguration::run($this->server);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ class Deploy extends Component
|
|||||||
$activity = StartProxy::run($this->server);
|
$activity = StartProxy::run($this->server);
|
||||||
$this->emit('newMonitorActivity', $activity->id);
|
$this->emit('newMonitorActivity', $activity->id);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class Status extends Component
|
|||||||
$this->emit('proxyStatusUpdated');
|
$this->emit('proxyStatusUpdated');
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
return handleError($e);
|
return handleError($e, $this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public function getProxyStatusWithNoti()
|
public function getProxyStatusWithNoti()
|
||||||
|
@ -96,7 +96,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
if ($this->pull_request_id !== 0) {
|
if ($this->pull_request_id !== 0) {
|
||||||
$this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);
|
$this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);
|
||||||
if ($this->application->fqdn) {
|
if ($this->application->fqdn) {
|
||||||
$preview_fqdn = data_get($this->preview, 'fqdn');
|
$preview_fqdn = getOnlyFqdn(data_get($this->preview, 'fqdn'));
|
||||||
$template = $this->application->preview_url_template;
|
$template = $this->application->preview_url_template;
|
||||||
$url = Url::fromString($this->application->fqdn);
|
$url = Url::fromString($this->application->fqdn);
|
||||||
$host = $url->getHost();
|
$host = $url->getHost();
|
||||||
@ -625,75 +625,6 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
return $environment_variables->all();
|
return $environment_variables->all();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function set_labels_for_applications()
|
|
||||||
{
|
|
||||||
|
|
||||||
$appId = $this->application->id;
|
|
||||||
if ($this->pull_request_id !== 0) {
|
|
||||||
$appId = $appId . '-pr-' . $this->pull_request_id;
|
|
||||||
}
|
|
||||||
$labels = [];
|
|
||||||
$labels[] = 'coolify.managed=true';
|
|
||||||
$labels[] = 'coolify.version=' . config('version');
|
|
||||||
$labels[] = 'coolify.applicationId=' . $appId;
|
|
||||||
$labels[] = 'coolify.type=application';
|
|
||||||
$labels[] = 'coolify.name=' . $this->application->name;
|
|
||||||
if ($this->pull_request_id !== 0) {
|
|
||||||
$labels[] = 'coolify.pullRequestId=' . $this->pull_request_id;
|
|
||||||
}
|
|
||||||
if ($this->application->fqdn) {
|
|
||||||
if ($this->pull_request_id !== 0) {
|
|
||||||
$domains = Str::of(data_get($this->preview, 'fqdn'))->explode(',');
|
|
||||||
} else {
|
|
||||||
$domains = Str::of(data_get($this->application, 'fqdn'))->explode(',');
|
|
||||||
}
|
|
||||||
if ($this->application->destination->server->proxy->type === ProxyTypes::TRAEFIK_V2->value) {
|
|
||||||
$labels[] = 'traefik.enable=true';
|
|
||||||
foreach ($domains as $domain) {
|
|
||||||
$url = Url::fromString($domain);
|
|
||||||
$host = $url->getHost();
|
|
||||||
$path = $url->getPath();
|
|
||||||
$schema = $url->getScheme();
|
|
||||||
$slug = Str::slug($host . $path);
|
|
||||||
|
|
||||||
$http_label = "{$this->container_name}-{$slug}-http";
|
|
||||||
$https_label = "{$this->container_name}-{$slug}-https";
|
|
||||||
|
|
||||||
if ($schema === 'https') {
|
|
||||||
// Set labels for https
|
|
||||||
$labels[] = "traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
|
|
||||||
$labels[] = "traefik.http.routers.{$https_label}.entryPoints=https";
|
|
||||||
$labels[] = "traefik.http.routers.{$https_label}.middlewares=gzip";
|
|
||||||
if ($path !== '/') {
|
|
||||||
$labels[] = "traefik.http.routers.{$https_label}.middlewares={$https_label}-stripprefix";
|
|
||||||
$labels[] = "traefik.http.middlewares.{$https_label}-stripprefix.stripprefix.prefixes={$path}";
|
|
||||||
}
|
|
||||||
|
|
||||||
$labels[] = "traefik.http.routers.{$https_label}.tls=true";
|
|
||||||
$labels[] = "traefik.http.routers.{$https_label}.tls.certresolver=letsencrypt";
|
|
||||||
|
|
||||||
// Set labels for http (redirect to https)
|
|
||||||
$labels[] = "traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
|
|
||||||
$labels[] = "traefik.http.routers.{$http_label}.entryPoints=http";
|
|
||||||
if ($this->application->settings->is_force_https_enabled) {
|
|
||||||
$labels[] = "traefik.http.routers.{$http_label}.middlewares=redirect-to-https";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Set labels for http
|
|
||||||
$labels[] = "traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
|
|
||||||
$labels[] = "traefik.http.routers.{$http_label}.entryPoints=http";
|
|
||||||
$labels[] = "traefik.http.routers.{$http_label}.middlewares=gzip";
|
|
||||||
if ($path !== '/') {
|
|
||||||
$labels[] = "traefik.http.routers.{$http_label}.middlewares={$http_label}-stripprefix";
|
|
||||||
$labels[] = "traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $labels;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function generate_healthcheck_commands()
|
private function generate_healthcheck_commands()
|
||||||
{
|
{
|
||||||
if ($this->application->dockerfile || $this->application->build_pack === 'dockerfile') {
|
if ($this->application->dockerfile || $this->application->build_pack === 'dockerfile') {
|
||||||
|
@ -18,14 +18,14 @@ class Service extends BaseModel
|
|||||||
{
|
{
|
||||||
static::deleted(function ($service) {
|
static::deleted(function ($service) {
|
||||||
$storagesToDelete = collect([]);
|
$storagesToDelete = collect([]);
|
||||||
foreach($service->applications()->get() as $application) {
|
foreach ($service->applications()->get() as $application) {
|
||||||
$storages = $application->persistentStorages()->get();
|
$storages = $application->persistentStorages()->get();
|
||||||
foreach ($storages as $storage) {
|
foreach ($storages as $storage) {
|
||||||
$storagesToDelete->push($storage);
|
$storagesToDelete->push($storage);
|
||||||
}
|
}
|
||||||
$application->persistentStorages()->delete();
|
$application->persistentStorages()->delete();
|
||||||
}
|
}
|
||||||
foreach($service->databases()->get() as $database) {
|
foreach ($service->databases()->get() as $database) {
|
||||||
$storages = $database->persistentStorages()->get();
|
$storages = $database->persistentStorages()->get();
|
||||||
foreach ($storages as $storage) {
|
foreach ($storages as $storage) {
|
||||||
$storagesToDelete->push($storage);
|
$storagesToDelete->push($storage);
|
||||||
@ -81,6 +81,7 @@ class Service extends BaseModel
|
|||||||
}
|
}
|
||||||
public function parse(bool $isNew = false): Collection
|
public function parse(bool $isNew = false): Collection
|
||||||
{
|
{
|
||||||
|
ray('parsing');
|
||||||
// ray()->clearAll();
|
// ray()->clearAll();
|
||||||
if ($this->docker_compose_raw) {
|
if ($this->docker_compose_raw) {
|
||||||
$yaml = Yaml::parse($this->docker_compose_raw);
|
$yaml = Yaml::parse($this->docker_compose_raw);
|
||||||
@ -136,39 +137,43 @@ class Service extends BaseModel
|
|||||||
$savedService = $this->databases()->whereName($serviceName)->first();
|
$savedService = $this->databases()->whereName($serviceName)->first();
|
||||||
} else {
|
} else {
|
||||||
$savedService = $this->applications()->whereName($serviceName)->first();
|
$savedService = $this->applications()->whereName($serviceName)->first();
|
||||||
|
if (data_get($savedService, 'fqdn')) {
|
||||||
|
$defaultUsableFqdn = data_get($savedService, 'fqdn', null);
|
||||||
|
} else {
|
||||||
if (Str::of($serviceVariables)->contains('SERVICE_FQDN') || Str::of($serviceVariables)->contains('SERVICE_URL')) {
|
if (Str::of($serviceVariables)->contains('SERVICE_FQDN') || Str::of($serviceVariables)->contains('SERVICE_URL')) {
|
||||||
$defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$this->server->ip}.sslip.io";
|
$defaultUsableFqdn = "http://$serviceName-{$this->uuid}.{$this->server->ip}.sslip.io";
|
||||||
if (isDev()) {
|
if (isDev()) {
|
||||||
$defaultUsableFqdn = "http://$serviceName-{$this->uuid}.127.0.0.1.sslip.io";
|
$defaultUsableFqdn = "http://$serviceName-{$this->uuid}.127.0.0.1.sslip.io";
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
$defaultUsableFqdn = null;
|
|
||||||
}
|
}
|
||||||
$savedService->fqdn = $defaultUsableFqdn;
|
$savedService->fqdn = $defaultUsableFqdn;
|
||||||
$savedService->save();
|
$savedService->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$fqdn = data_get($savedService, 'fqdn');
|
$fqdns = data_get($savedService, 'fqdn');
|
||||||
|
if ($fqdns) {
|
||||||
|
$fqdns = collect(Str::of($fqdns)->explode(','));
|
||||||
|
}
|
||||||
|
ray($fqdns);
|
||||||
// Collect ports
|
// Collect ports
|
||||||
$servicePorts = collect(data_get($service, 'ports', []));
|
$servicePorts = collect(data_get($service, 'ports', []));
|
||||||
$ports->put($serviceName, $servicePorts);
|
$ports->put($serviceName, $servicePorts);
|
||||||
if ($isNew) {
|
$collectedPorts = collect([]);
|
||||||
$ports = collect([]);
|
|
||||||
if ($servicePorts->count() > 0) {
|
if ($servicePorts->count() > 0) {
|
||||||
foreach ($servicePorts as $sport) {
|
foreach ($servicePorts as $sport) {
|
||||||
if (is_string($sport)) {
|
if (is_string($sport) || is_numeric($sport)) {
|
||||||
$ports->push($sport);
|
$collectedPorts->push($sport);
|
||||||
}
|
}
|
||||||
if (is_array($sport)) {
|
if (is_array($sport)) {
|
||||||
$target = data_get($sport, 'target');
|
$target = data_get($sport, 'target');
|
||||||
$published = data_get($sport, 'published');
|
$published = data_get($sport, 'published');
|
||||||
$ports->push("$target:$published");
|
$collectedPorts->push("$target:$published");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $savedService->ports_exposes = $ports->implode(',');
|
$savedService->ports = $collectedPorts->implode(',');
|
||||||
// $savedService->save();
|
$savedService->save();
|
||||||
}
|
|
||||||
// Collect volumes
|
// Collect volumes
|
||||||
$serviceVolumes = collect(data_get($service, 'volumes', []));
|
$serviceVolumes = collect(data_get($service, 'volumes', []));
|
||||||
if ($serviceVolumes->count() > 0) {
|
if ($serviceVolumes->count() > 0) {
|
||||||
@ -336,7 +341,14 @@ class Service extends BaseModel
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
} else if ($variableName->startsWith('SERVICE_FQDN')) {
|
} else if ($variableName->startsWith('SERVICE_FQDN')) {
|
||||||
if ($fqdn) {
|
if ($fqdns) {
|
||||||
|
$number = Str::of($variableName)->after('SERVICE_FQDN')->afterLast('_')->value();
|
||||||
|
if (is_numeric($number)) {
|
||||||
|
$number = (int) $number - 1;
|
||||||
|
} else {
|
||||||
|
$number = 0;
|
||||||
|
}
|
||||||
|
$fqdn = data_get($fqdns, $number);
|
||||||
$environments = collect(data_get($service, 'environment'));
|
$environments = collect(data_get($service, 'environment'));
|
||||||
$environments = $environments->map(function ($envValue) use ($value, $fqdn) {
|
$environments = $environments->map(function ($envValue) use ($value, $fqdn) {
|
||||||
$envValue = Str::of($envValue)->replace($value, $fqdn);
|
$envValue = Str::of($envValue)->replace($value, $fqdn);
|
||||||
@ -345,8 +357,9 @@ class Service extends BaseModel
|
|||||||
$service['environment'] = $environments->toArray();
|
$service['environment'] = $environments->toArray();
|
||||||
}
|
}
|
||||||
} else if ($variableName->startsWith('SERVICE_URL')) {
|
} else if ($variableName->startsWith('SERVICE_URL')) {
|
||||||
if ($fqdn) {
|
ray('url');
|
||||||
$url = Str::of($fqdn)->after('https://')->before('/');
|
if ($fqdns) {
|
||||||
|
$url = Str::of($fqdns)->after('https://')->before('/');
|
||||||
$environments = collect(data_get($service, 'environment'));
|
$environments = collect(data_get($service, 'environment'));
|
||||||
$environments = $environments->map(function ($envValue) use ($value, $url) {
|
$environments = $environments->map(function ($envValue) use ($value, $url) {
|
||||||
$envValue = Str::of($envValue)->replace($value, $url);
|
$envValue = Str::of($envValue)->replace($value, $url);
|
||||||
@ -362,8 +375,8 @@ class Service extends BaseModel
|
|||||||
$labels = collect([]);
|
$labels = collect([]);
|
||||||
$labels = $labels->merge(defaultLabels($this->id, $container_name, type: 'service'));
|
$labels = $labels->merge(defaultLabels($this->id, $container_name, type: 'service'));
|
||||||
if (!$isDatabase) {
|
if (!$isDatabase) {
|
||||||
if ($fqdn) {
|
if ($fqdns) {
|
||||||
$labels = $labels->merge(fqdnLabelsForTraefik($fqdn, $container_name, true));
|
$labels = $labels->merge(fqdnLabelsForTraefik($fqdns, $container_name, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
data_set($service, 'labels', $labels->toArray());
|
data_set($service, 'labels', $labels->toArray());
|
||||||
|
@ -7,6 +7,7 @@ use Closure;
|
|||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\View\Component;
|
use Illuminate\View\Component;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class Links extends Component
|
class Links extends Component
|
||||||
{
|
{
|
||||||
@ -15,7 +16,23 @@ class Links extends Component
|
|||||||
{
|
{
|
||||||
$this->links = collect([]);
|
$this->links = collect([]);
|
||||||
$service->applications()->get()->map(function ($application) {
|
$service->applications()->get()->map(function ($application) {
|
||||||
$this->links->push($application->fqdn);
|
if ($application->fqdn) {
|
||||||
|
$fqdns = collect(Str::of($application->fqdn)->explode(','));
|
||||||
|
$fqdns->map(function ($fqdn) {
|
||||||
|
$this->links->push(getOnlyFqdn($fqdn));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if ($application->ports) {
|
||||||
|
$portsCollection = collect(Str::of($application->ports)->explode(','));
|
||||||
|
$portsCollection->map(function ($port) {
|
||||||
|
if (Str::of($port)->contains(':')) {
|
||||||
|
$hostPort = Str::of($port)->before(':');
|
||||||
|
} else {
|
||||||
|
$hostPort = $port;
|
||||||
|
}
|
||||||
|
$this->links->push(base_url(withPort:false) . ":{$hostPort}");
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,14 +143,16 @@ function defaultLabels($id, $name, $pull_request_id = 0, string $type = 'applica
|
|||||||
}
|
}
|
||||||
return $labels;
|
return $labels;
|
||||||
}
|
}
|
||||||
function fqdnLabelsForTraefik($domain, $container_name, $is_force_https_enabled)
|
function fqdnLabelsForTraefik(Collection $domains, $container_name, $is_force_https_enabled)
|
||||||
{
|
{
|
||||||
$labels = collect([]);
|
$labels = collect([]);
|
||||||
$labels->push('traefik.enable=true');
|
$labels->push('traefik.enable=true');
|
||||||
|
foreach($domains as $domain) {
|
||||||
$url = Url::fromString($domain);
|
$url = Url::fromString($domain);
|
||||||
$host = $url->getHost();
|
$host = $url->getHost();
|
||||||
$path = $url->getPath();
|
$path = $url->getPath();
|
||||||
$schema = $url->getScheme();
|
$schema = $url->getScheme();
|
||||||
|
$port = $url->getPort();
|
||||||
$slug = Str::slug($host . $path);
|
$slug = Str::slug($host . $path);
|
||||||
|
|
||||||
$http_label = "{$container_name}-{$slug}-http";
|
$http_label = "{$container_name}-{$slug}-http";
|
||||||
@ -161,6 +163,10 @@ function fqdnLabelsForTraefik($domain, $container_name, $is_force_https_enabled)
|
|||||||
$labels->push("traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
|
$labels->push("traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
|
||||||
$labels->push("traefik.http.routers.{$https_label}.entryPoints=https");
|
$labels->push("traefik.http.routers.{$https_label}.entryPoints=https");
|
||||||
$labels->push("traefik.http.routers.{$https_label}.middlewares=gzip");
|
$labels->push("traefik.http.routers.{$https_label}.middlewares=gzip");
|
||||||
|
if ($port) {
|
||||||
|
$labels->push("traefik.http.routers.{$https_label}.service={$https_label}");
|
||||||
|
$labels->push("traefik.http.services.{$https_label}.loadbalancer.server.port=$port");
|
||||||
|
}
|
||||||
if ($path !== '/') {
|
if ($path !== '/') {
|
||||||
$labels->push("traefik.http.routers.{$https_label}.middlewares={$https_label}-stripprefix");
|
$labels->push("traefik.http.routers.{$https_label}.middlewares={$https_label}-stripprefix");
|
||||||
$labels->push("traefik.http.middlewares.{$https_label}-stripprefix.stripprefix.prefixes={$path}");
|
$labels->push("traefik.http.middlewares.{$https_label}-stripprefix.stripprefix.prefixes={$path}");
|
||||||
@ -180,11 +186,17 @@ function fqdnLabelsForTraefik($domain, $container_name, $is_force_https_enabled)
|
|||||||
$labels->push("traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
|
$labels->push("traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)");
|
||||||
$labels->push("traefik.http.routers.{$http_label}.entryPoints=http");
|
$labels->push("traefik.http.routers.{$http_label}.entryPoints=http");
|
||||||
$labels->push("traefik.http.routers.{$http_label}.middlewares=gzip");
|
$labels->push("traefik.http.routers.{$http_label}.middlewares=gzip");
|
||||||
|
if ($port) {
|
||||||
|
$labels->push("traefik.http.routers.{$http_label}.service={$http_label}");
|
||||||
|
$labels->push("traefik.http.services.{$http_label}.loadbalancer.server.port=$port");
|
||||||
|
}
|
||||||
if ($path !== '/') {
|
if ($path !== '/') {
|
||||||
$labels->push("traefik.http.routers.{$http_label}.middlewares={$http_label}-stripprefix");
|
$labels->push("traefik.http.routers.{$http_label}.middlewares={$http_label}-stripprefix");
|
||||||
$labels->push("traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}");
|
$labels->push("traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $labels;
|
return $labels;
|
||||||
}
|
}
|
||||||
function generateLabelsApplication(Application $application, ?ApplicationPreview $preview = null): array
|
function generateLabelsApplication(Application $application, ?ApplicationPreview $preview = null): array
|
||||||
@ -205,47 +217,7 @@ function generateLabelsApplication(Application $application, ?ApplicationPreview
|
|||||||
$domains = Str::of(data_get($application, 'fqdn'))->explode(',');
|
$domains = Str::of(data_get($application, 'fqdn'))->explode(',');
|
||||||
}
|
}
|
||||||
if ($application->destination->server->proxy->type === ProxyTypes::TRAEFIK_V2->value) {
|
if ($application->destination->server->proxy->type === ProxyTypes::TRAEFIK_V2->value) {
|
||||||
foreach ($domains as $domain) {
|
$labels = $labels->merge(fqdnLabelsForTraefik($domains, $container_name, $application->settings->is_force_https_enabled));
|
||||||
$labels = $labels->merge(fqdnLabelsForTraefik($domain, $container_name, $application->settings->is_force_https_enabled));
|
|
||||||
// $url = Url::fromString($domain);
|
|
||||||
// $host = $url->getHost();
|
|
||||||
// $path = $url->getPath();
|
|
||||||
// $schema = $url->getScheme();
|
|
||||||
// $slug = Str::slug($host . $path);
|
|
||||||
|
|
||||||
// $http_label = "{$container_name}-{$slug}-http";
|
|
||||||
// $https_label = "{$container_name}-{$slug}-https";
|
|
||||||
|
|
||||||
// if ($schema === 'https') {
|
|
||||||
// // Set labels for https
|
|
||||||
// $labels[] = "traefik.http.routers.{$https_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
|
|
||||||
// $labels[] = "traefik.http.routers.{$https_label}.entryPoints=https";
|
|
||||||
// $labels[] = "traefik.http.routers.{$https_label}.middlewares=gzip";
|
|
||||||
// if ($path !== '/') {
|
|
||||||
// $labels[] = "traefik.http.routers.{$https_label}.middlewares={$https_label}-stripprefix";
|
|
||||||
// $labels[] = "traefik.http.middlewares.{$https_label}-stripprefix.stripprefix.prefixes={$path}";
|
|
||||||
// }
|
|
||||||
|
|
||||||
// $labels[] = "traefik.http.routers.{$https_label}.tls=true";
|
|
||||||
// $labels[] = "traefik.http.routers.{$https_label}.tls.certresolver=letsencrypt";
|
|
||||||
|
|
||||||
// // Set labels for http (redirect to https)
|
|
||||||
// $labels[] = "traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
|
|
||||||
// $labels[] = "traefik.http.routers.{$http_label}.entryPoints=http";
|
|
||||||
// if ($application->settings->is_force_https_enabled) {
|
|
||||||
// $labels[] = "traefik.http.routers.{$http_label}.middlewares=redirect-to-https";
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// // Set labels for http
|
|
||||||
// $labels[] = "traefik.http.routers.{$http_label}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
|
|
||||||
// $labels[] = "traefik.http.routers.{$http_label}.entryPoints=http";
|
|
||||||
// $labels[] = "traefik.http.routers.{$http_label}.middlewares=gzip";
|
|
||||||
// if ($path !== '/') {
|
|
||||||
// $labels[] = "traefik.http.routers.{$http_label}.middlewares={$http_label}-stripprefix";
|
|
||||||
// $labels[] = "traefik.http.middlewares.{$http_label}-stripprefix.stripprefix.prefixes={$path}";
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $labels->all();
|
return $labels->all();
|
||||||
|
@ -20,6 +20,7 @@ use Nubs\RandomNameGenerator\All;
|
|||||||
use Poliander\Cron\CronExpression;
|
use Poliander\Cron\CronExpression;
|
||||||
use Visus\Cuid2\Cuid2;
|
use Visus\Cuid2\Cuid2;
|
||||||
use phpseclib3\Crypt\RSA;
|
use phpseclib3\Crypt\RSA;
|
||||||
|
use Spatie\Url\Url;
|
||||||
|
|
||||||
function base_configuration_dir(): string
|
function base_configuration_dir(): string
|
||||||
{
|
{
|
||||||
@ -239,7 +240,12 @@ function base_ip(): string
|
|||||||
}
|
}
|
||||||
return "localhost";
|
return "localhost";
|
||||||
}
|
}
|
||||||
|
function getOnlyFqdn(String $fqdn) {
|
||||||
|
$url = Url::fromString($fqdn);
|
||||||
|
$host = $url->getHost();
|
||||||
|
$scheme = $url->getScheme();
|
||||||
|
return "$scheme://$host";
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* If fqdn is set, return it, otherwise return public ip.
|
* If fqdn is set, return it, otherwise return public ip.
|
||||||
*/
|
*/
|
||||||
|
@ -12,6 +12,7 @@ return new class extends Migration
|
|||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('services', function (Blueprint $table) {
|
Schema::table('services', function (Blueprint $table) {
|
||||||
|
$table->longText('description')->nullable();
|
||||||
$table->longText('docker_compose_raw');
|
$table->longText('docker_compose_raw');
|
||||||
$table->longText('docker_compose')->nullable();
|
$table->longText('docker_compose')->nullable();
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ return new class extends Migration
|
|||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('services', function (Blueprint $table) {
|
Schema::table('services', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('description');
|
||||||
$table->dropColumn('docker_compose_raw');
|
$table->dropColumn('docker_compose_raw');
|
||||||
$table->dropColumn('docker_compose');
|
$table->dropColumn('docker_compose');
|
||||||
});
|
});
|
||||||
|
@ -16,6 +16,10 @@ return new class extends Migration
|
|||||||
$table->string('uuid')->unique();
|
$table->string('uuid')->unique();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('human_name')->nullable();
|
$table->string('human_name')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
|
||||||
|
$table->longText('ports')->nullable();
|
||||||
|
$table->longText('exposes')->nullable();
|
||||||
|
|
||||||
$table->string('status')->default('exited');
|
$table->string('status')->default('exited');
|
||||||
|
|
||||||
|
@ -16,8 +16,11 @@ return new class extends Migration
|
|||||||
$table->string('uuid')->unique();
|
$table->string('uuid')->unique();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('human_name')->nullable();
|
$table->string('human_name')->nullable();
|
||||||
|
$table->longText('description')->nullable();
|
||||||
|
|
||||||
$table->string('fqdn')->unique()->nullable();
|
$table->string('fqdn')->unique()->nullable();
|
||||||
|
$table->longText('ports')->nullable();
|
||||||
|
$table->longText('exposes')->nullable();
|
||||||
|
|
||||||
$table->string('status')->default('exited');
|
$table->string('status')->default('exited');
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
@foreach (Str::of(data_get($application, 'fqdn'))->explode(',') as $fqdn)
|
@foreach (Str::of(data_get($application, 'fqdn'))->explode(',') as $fqdn)
|
||||||
<li>
|
<li>
|
||||||
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
|
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
|
||||||
target="_blank" href="{{ $fqdn }}">
|
target="_blank" href="{{ getOnlyFqdn($fqdn) }}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"
|
||||||
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||||
stroke-linejoin="round">
|
stroke-linejoin="round">
|
||||||
@ -28,7 +28,7 @@
|
|||||||
<path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464" />
|
<path d="M11 6l.463 -.536a5 5 0 0 1 7.071 7.072l-.534 .464" />
|
||||||
<path
|
<path
|
||||||
d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463" />
|
d="M13 18l-.397 .534a5.068 5.068 0 0 1 -7.127 0a4.972 4.972 0 0 1 0 -7.071l.524 -.463" />
|
||||||
</svg>{{ $fqdn }}
|
</svg>{{ getOnlyFqdn($fqdn) }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@endforeach
|
@endforeach
|
||||||
@ -38,7 +38,7 @@
|
|||||||
@if (data_get($preview, 'fqdn'))
|
@if (data_get($preview, 'fqdn'))
|
||||||
<li>
|
<li>
|
||||||
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
|
<a class="text-xs text-white rounded-none hover:no-underline hover:bg-coollabs hover:text-white"
|
||||||
target="_blank" href="{{ data_get($preview, 'fqdn') }}">
|
target="_blank" href="{{ getOnlyFqdn(data_get($preview, 'fqdn')) }}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-6 h-6" viewBox="0 0 24 24"
|
||||||
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
|
||||||
stroke-linejoin="round">
|
stroke-linejoin="round">
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<pre class="py-2 pb-4">
|
|
||||||
# You can use these variables in your Docker Compose file and Coolify will generate default values or replace them with the values you set on the UI forms.
|
|
||||||
#
|
|
||||||
# SERVICE_FQDN_*: FQDN - could be changable from the UI. (example: SERVICE_FQDN_GHOST)
|
|
||||||
# SERVICE_URL_*: URL parsed from FQDN - could be changable from the UI. (example: SERVICE_URL_GHOST)
|
|
||||||
# SERVICE_USER_*: Generated user, not encrypted in database (example: SERVICE_USER_MYSQL)
|
|
||||||
# SERVICE_PASSWORD_*: Generated password, encrypted in database (example: SERVICE_PASSWORD_MYSQL)
|
|
||||||
</pre>
|
|
@ -1,8 +1,4 @@
|
|||||||
<div class="navbar-main">
|
<div class="navbar-main">
|
||||||
<a class="{{ request()->routeIs('project.service') ? 'text-white' : '' }}"
|
|
||||||
href="{{ route('project.service', [...$parameters, 'service_name' => null]) }}">
|
|
||||||
<button>Service</button>
|
|
||||||
</a>
|
|
||||||
<x-services.links :service="$service" />
|
<x-services.links :service="$service" />
|
||||||
<div class="flex-1"></div>
|
<div class="flex-1"></div>
|
||||||
@if (serviceStatus($service) === 'running')
|
@if (serviceStatus($service) === 'running')
|
||||||
|
@ -12,6 +12,20 @@
|
|||||||
<x-forms.input id="application.name" label="Name" required />
|
<x-forms.input id="application.name" label="Name" required />
|
||||||
<x-forms.input id="application.description" label="Description" />
|
<x-forms.input id="application.description" label="Description" />
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex items-end gap-2">
|
||||||
|
<x-forms.input placeholder="https://coolify.io" id="application.fqdn" label="Domains"
|
||||||
|
helper="You can specify one domain with path or more with comma. You can specify a port to bind the domain to.<br><br><span class='text-helper'>Example</span><br>- http://app.coolify.io, https://cloud.coolify.io/dashboard<br>- http://app.coolify.io/api/v3<br>- http://app.coolify.io:3000 -> app.coolify.io will point to port 3000 inside the container. " />
|
||||||
|
@if ($wildcard_domain)
|
||||||
|
@if ($global_wildcard_domain)
|
||||||
|
<x-forms.button wire:click="generateGlobalRandomDomain">Set Global Wildcard
|
||||||
|
</x-forms.button>
|
||||||
|
@endif
|
||||||
|
@if ($server_wildcard_domain)
|
||||||
|
<x-forms.button wire:click="generateServerRandomDomain">Set Server Wildcard
|
||||||
|
</x-forms.button>
|
||||||
|
@endif
|
||||||
|
@endif
|
||||||
|
</div>
|
||||||
@if ($application->settings->is_static)
|
@if ($application->settings->is_static)
|
||||||
<x-forms.select id="application.static_image" label="Static Image" required>
|
<x-forms.select id="application.static_image" label="Static Image" required>
|
||||||
<option value="nginx:alpine">nginx:alpine</option>
|
<option value="nginx:alpine">nginx:alpine</option>
|
||||||
@ -46,7 +60,7 @@
|
|||||||
<x-forms.input id="application.ports_exposes" label="Ports Exposes" readonly />
|
<x-forms.input id="application.ports_exposes" label="Ports Exposes" readonly />
|
||||||
@else
|
@else
|
||||||
<x-forms.input placeholder="3000,3001" id="application.ports_exposes" label="Ports Exposes" required
|
<x-forms.input placeholder="3000,3001" id="application.ports_exposes" label="Ports Exposes" required
|
||||||
helper="A comma separated list of ports you would like to expose for the proxy." />
|
helper="A comma separated list of ports your application uses. The first port will be used as default healthcheck endpoint. Be sure to set this correctly." />
|
||||||
@endif
|
@endif
|
||||||
<x-forms.input placeholder="3000:3000" id="application.ports_mappings" label="Ports Mappings"
|
<x-forms.input placeholder="3000:3000" id="application.ports_mappings" label="Ports Mappings"
|
||||||
helper="A comma separated list of ports you would like to map to the host system. Useful when you do not want to use domains.<br><span class='inline-block font-bold text-warning'>Example</span>3000:3000,3002:3002" />
|
helper="A comma separated list of ports you would like to map to the host system. Useful when you do not want to use domains.<br><span class='inline-block font-bold text-warning'>Example</span>3000:3000,3002:3002" />
|
||||||
|
@ -6,8 +6,15 @@
|
|||||||
<h2>Docker Compose</h2>
|
<h2>Docker Compose</h2>
|
||||||
<x-forms.button type="submit">Save</x-forms.button>
|
<x-forms.button type="submit">Save</x-forms.button>
|
||||||
</div>
|
</div>
|
||||||
<x-services.explanation />
|
<x-forms.textarea label="Docker Compose file"
|
||||||
<x-forms.textarea rows="20" id="dockercompose"
|
helper="
|
||||||
|
You can use these variables in your Docker Compose file and Coolify will generate default values or replace them with the values you set on the UI forms.<br>
|
||||||
|
<br>
|
||||||
|
- SERVICE_FQDN_*: FQDN - could be changable from the UI. (example: SERVICE_FQDN_GHOST)<br>
|
||||||
|
- SERVICE_URL_*: URL parsed from FQDN - could be changable from the UI. (example: SERVICE_URL_GHOST)<br>
|
||||||
|
- SERVICE_USER_*: Generated user, not encrypted in database (example: SERVICE_USER_MYSQL)<br>
|
||||||
|
- SERVICE_PASSWORD_*: Generated password, encrypted in database (example: SERVICE_PASSWORD_MYSQL)<br>"
|
||||||
|
rows="20" id="dockercompose"
|
||||||
placeholder='services:
|
placeholder='services:
|
||||||
ghost:
|
ghost:
|
||||||
documentation: https://ghost.org/docs/config
|
documentation: https://ghost.org/docs/config
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
<a target="_blank" href="{{ $application->documentation() }}">Documentation <x-external-link /></a>
|
<a target="_blank" href="{{ $application->documentation() }}">Documentation <x-external-link /></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<x-forms.input label="Name" id="application.human_name" placeholder="Name"></x-forms.input>
|
<x-forms.input label="Name" id="application.human_name" placeholder="Human readable name"></x-forms.input>
|
||||||
@if (isset($application->fqdn))
|
<x-forms.input label="Description" id="application.description"></x-forms.input>
|
||||||
<x-forms.input label="FQDN" required id="application.fqdn"></x-forms.input>
|
<x-forms.input placeholder="https://app.coolify.io" label="Domains" required
|
||||||
@endisset
|
id="application.fqdn"></x-forms.input>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -10,5 +10,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<x-forms.input label="Name" id="database.human_name" placeholder="Name"></x-forms.input>
|
<x-forms.input label="Name" id="database.human_name" placeholder="Name"></x-forms.input>
|
||||||
|
<x-forms.input label="Description" id="database.description"></x-forms.input>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
||||||
<div class="flex h-full pt-6">
|
<div class="flex h-full pt-6">
|
||||||
<div class="flex flex-col gap-4 min-w-fit">
|
<div class="flex flex-col gap-4 min-w-fit">
|
||||||
<a :class="activeTab === 'compose' && 'text-white'"
|
|
||||||
@click.prevent="activeTab = 'compose'; window.location.hash = 'compose'" href="#">Compose File</a>
|
|
||||||
<a :class="activeTab === 'service-stack' && 'text-white'"
|
<a :class="activeTab === 'service-stack' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'service-stack'; window.location.hash = 'service-stack'"
|
@click.prevent="activeTab = 'service-stack'; window.location.hash = 'service-stack'"
|
||||||
href="#">Service Stack</a>
|
href="#">Service Stack</a>
|
||||||
|
<a :class="activeTab === 'compose' && 'text-white'"
|
||||||
|
@click.prevent="activeTab = 'compose'; window.location.hash = 'compose'" href="#">Compose File</a>
|
||||||
<a :class="activeTab === 'environment-variables' && 'text-white'"
|
<a :class="activeTab === 'environment-variables' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'"
|
@click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'"
|
||||||
href="#">Environment
|
href="#">Environment
|
||||||
@ -17,6 +17,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="w-full pl-8">
|
<div class="w-full pl-8">
|
||||||
<div x-cloak x-show="activeTab === 'service-stack'">
|
<div x-cloak x-show="activeTab === 'service-stack'">
|
||||||
|
<form wire:submit.prevent='submit' class="pb-4">
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<h2 class="pb-4">Configuration </h2>
|
||||||
|
<x-forms.button type="submit">Save</x-forms.button>
|
||||||
|
</div>
|
||||||
|
<div class="flex gap-2">
|
||||||
|
<x-forms.input id="service.name" required label="Service Name"
|
||||||
|
placeholder="My super wordpress site" />
|
||||||
|
<x-forms.input id="service.description" label="Description" />
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
<h2 class="pb-4"> Service Stack </h2>
|
<h2 class="pb-4"> Service Stack </h2>
|
||||||
<div class="grid grid-cols-1 gap-2">
|
<div class="grid grid-cols-1 gap-2">
|
||||||
@foreach ($service->applications as $application)
|
@foreach ($service->applications as $application)
|
||||||
@ -27,19 +38,25 @@
|
|||||||
@else
|
@else
|
||||||
{{ Str::headline($application->name) }}
|
{{ Str::headline($application->name) }}
|
||||||
@endif
|
@endif
|
||||||
|
@if ($application->description)
|
||||||
|
<span class="text-xs">{{ $application->description }}</span>
|
||||||
|
@endif
|
||||||
@if ($application->fqdn)
|
@if ($application->fqdn)
|
||||||
<span class="text-xs">{{ $application->fqdn }}</span>
|
<span class="text-xs">{{ $application->fqdn }}</span>
|
||||||
@endif
|
@endif
|
||||||
</a>
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
@foreach ($service->databases as $database)
|
@foreach ($service->databases as $database)
|
||||||
<a class="justify-center box"
|
<a class="flex flex-col justify-center box"
|
||||||
href="{{ route('project.service.show', [...$parameters, 'service_name' => $database->name]) }}">
|
href="{{ route('project.service.show', [...$parameters, 'service_name' => $database->name]) }}">
|
||||||
@if ($database->human_name)
|
@if ($database->human_name)
|
||||||
{{ Str::headline($database->human_name) }}
|
{{ Str::headline($database->human_name) }}
|
||||||
@else
|
@else
|
||||||
{{ Str::headline($database->name) }}
|
{{ Str::headline($database->name) }}
|
||||||
@endif
|
@endif
|
||||||
|
@if ($database->description)
|
||||||
|
<span class="text-xs">{{ $database->description }}</span>
|
||||||
|
@endif
|
||||||
</a>
|
</a>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@ -58,15 +75,21 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<x-services.explanation />
|
|
||||||
|
|
||||||
<div x-cloak x-show="raw">
|
<div x-cloak x-show="raw">
|
||||||
<x-forms.textarea rows="20" id="service.docker_compose_raw">
|
<x-forms.textarea label="Docker Compose file"
|
||||||
|
helper="
|
||||||
|
You can use these variables in your Docker Compose file and Coolify will generate default values or replace them with the values you set on the UI forms.<br>
|
||||||
|
<br>
|
||||||
|
- SERVICE_FQDN_*: FQDN - could be changable from the UI. (example: SERVICE_FQDN_GHOST)<br>
|
||||||
|
- SERVICE_URL_*: URL parsed from FQDN - could be changable from the UI. (example: SERVICE_URL_GHOST)<br>
|
||||||
|
- SERVICE_USER_*: Generated user, not encrypted in database (example: SERVICE_USER_MYSQL)<br>
|
||||||
|
- SERVICE_PASSWORD_*: Generated password, encrypted in database (example: SERVICE_PASSWORD_MYSQL)<br>"
|
||||||
|
rows="20" id="service.docker_compose_raw">
|
||||||
</x-forms.textarea>
|
</x-forms.textarea>
|
||||||
</div>
|
</div>
|
||||||
<div x-cloak x-show="raw === false">
|
<div x-cloak x-show="raw === false">
|
||||||
|
<x-forms.textarea label="Actual Docker Compose file that will be deployed" readonly rows="20" id="service.docker_compose">
|
||||||
<x-forms.textarea readonly rows="20" id="service.docker_compose">
|
|
||||||
</x-forms.textarea>
|
</x-forms.textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,6 +2,10 @@
|
|||||||
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
||||||
<div class="flex h-full pt-6">
|
<div class="flex h-full pt-6">
|
||||||
<div class="flex flex-col gap-4 min-w-fit">
|
<div class="flex flex-col gap-4 min-w-fit">
|
||||||
|
<a class="{{ request()->routeIs('project.service') ? 'text-white' : '' }}"
|
||||||
|
href="{{ route('project.service', [...$parameters, 'service_name' => null]) }}">
|
||||||
|
<button><- Back</button>
|
||||||
|
</a>
|
||||||
<a :class="activeTab === 'general' && 'text-white'"
|
<a :class="activeTab === 'general' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a>
|
@click.prevent="activeTab = 'general'; window.location.hash = 'general'" href="#">General</a>
|
||||||
<a :class="activeTab === 'storages' && 'text-white'"
|
<a :class="activeTab === 'storages' && 'text-white'"
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<h2>Destination</h2>
|
<h2>Server</h2>
|
||||||
<div class="">The destination server / network where your application will be deployed to.</div>
|
<div class="">The destination server where your application will be deployed to.</div>
|
||||||
<div class="py-4 ">
|
<div class="py-4 ">
|
||||||
<p>Server: {{ data_get($destination, 'server.name') }}</p>
|
<a class="box"
|
||||||
<p>Destination Network: {{ data_get($destination, 'server.network') }}</p>
|
href="{{ route('server.show', ['server_uuid' => data_get($destination, 'server.uuid')]) }}">On server <span class="px-1 text-warning">{{ data_get($destination, 'server.name') }}</span>
|
||||||
|
in <span class="px-1 text-warning"> {{ data_get($destination, 'network') }} </span> network.</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
<a :class="activeTab === 'source' && 'text-white'"
|
<a :class="activeTab === 'source' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'source'; window.location.hash = 'source'" href="#">Source</a>
|
@click.prevent="activeTab = 'source'; window.location.hash = 'source'" href="#">Source</a>
|
||||||
@endif
|
@endif
|
||||||
<a :class="activeTab === 'destination' && 'text-white'"
|
<a :class="activeTab === 'server' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'destination'; window.location.hash = 'destination'"
|
@click.prevent="activeTab = 'server'; window.location.hash = 'server'"
|
||||||
href="#">Destination
|
href="#">Server
|
||||||
</a>
|
</a>
|
||||||
<a :class="activeTab === 'storages' && 'text-white'"
|
<a :class="activeTab === 'storages' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
|
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<livewire:project.application.source :application="$application" />
|
<livewire:project.application.source :application="$application" />
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div x-cloak x-show="activeTab === 'destination'">
|
<div x-cloak x-show="activeTab === 'server'">
|
||||||
<livewire:project.shared.destination :destination="$application->destination" />
|
<livewire:project.shared.destination :destination="$application->destination" />
|
||||||
</div>
|
</div>
|
||||||
<div x-cloak x-show="activeTab === 'storages'">
|
<div x-cloak x-show="activeTab === 'storages'">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<livewire:project.database.heading :database="$database" />
|
<livewire:project.database.heading :database="$database" />
|
||||||
<x-modal modalId="startDatabase">
|
<x-modal modalId="startDatabase">
|
||||||
<x-slot:modalBody>
|
<x-slot:modalBody>
|
||||||
<livewire:activity-monitor header="Startup Logs" />
|
<livewire:activity-monitor header="Database Startup Logs" />
|
||||||
</x-slot:modalBody>
|
</x-slot:modalBody>
|
||||||
<x-slot:modalSubmit>
|
<x-slot:modalSubmit>
|
||||||
<x-forms.button onclick="startDatabase.close()" type="submit">
|
<x-forms.button onclick="startDatabase.close()" type="submit">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<livewire:project.database.heading :database="$database" />
|
<livewire:project.database.heading :database="$database" />
|
||||||
<x-modal modalId="startDatabase">
|
<x-modal modalId="startDatabase">
|
||||||
<x-slot:modalBody>
|
<x-slot:modalBody>
|
||||||
<livewire:activity-monitor header="Startup Logs" />
|
<livewire:activity-monitor header="Database Startup Logs" />
|
||||||
</x-slot:modalBody>
|
</x-slot:modalBody>
|
||||||
<x-slot:modalSubmit>
|
<x-slot:modalSubmit>
|
||||||
<x-forms.button onclick="startDatabase.close()" type="submit">
|
<x-forms.button onclick="startDatabase.close()" type="submit">
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<livewire:project.database.heading :database="$database" />
|
<livewire:project.database.heading :database="$database" />
|
||||||
<x-modal modalId="startDatabase">
|
<x-modal modalId="startDatabase">
|
||||||
<x-slot:modalBody>
|
<x-slot:modalBody>
|
||||||
<livewire:activity-monitor header="Startup Logs" />
|
<livewire:activity-monitor header="Database Startup Logs" />
|
||||||
</x-slot:modalBody>
|
</x-slot:modalBody>
|
||||||
<x-slot:modalSubmit>
|
<x-slot:modalSubmit>
|
||||||
<x-forms.button onclick="startDatabase.close()" type="submit">
|
<x-forms.button onclick="startDatabase.close()" type="submit">
|
||||||
@ -19,9 +19,9 @@
|
|||||||
@click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'"
|
@click.prevent="activeTab = 'environment-variables'; window.location.hash = 'environment-variables'"
|
||||||
href="#">Environment
|
href="#">Environment
|
||||||
Variables</a>
|
Variables</a>
|
||||||
<a :class="activeTab === 'destination' && 'text-white'"
|
<a :class="activeTab === 'server' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'destination'; window.location.hash = 'destination'"
|
@click.prevent="activeTab = 'server'; window.location.hash = 'server'"
|
||||||
href="#">Destination
|
href="#">Server
|
||||||
</a>
|
</a>
|
||||||
<a :class="activeTab === 'storages' && 'text-white'"
|
<a :class="activeTab === 'storages' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
|
@click.prevent="activeTab = 'storages'; window.location.hash = 'storages'" href="#">Storages
|
||||||
@ -43,7 +43,7 @@
|
|||||||
<div x-cloak x-show="activeTab === 'environment-variables'">
|
<div x-cloak x-show="activeTab === 'environment-variables'">
|
||||||
<livewire:project.shared.environment-variable.all :resource="$database" />
|
<livewire:project.shared.environment-variable.all :resource="$database" />
|
||||||
</div>
|
</div>
|
||||||
<div x-cloak x-show="activeTab === 'destination'">
|
<div x-cloak x-show="activeTab === 'server'">
|
||||||
<livewire:project.shared.destination :destination="$database->destination" />
|
<livewire:project.shared.destination :destination="$database->destination" />
|
||||||
</div>
|
</div>
|
||||||
<div x-cloak x-show="activeTab === 'storages'">
|
<div x-cloak x-show="activeTab === 'storages'">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user