This commit is contained in:
Andras Bacsai 2023-05-09 09:54:43 +02:00
parent ec3fe284b6
commit bba8b25b48
14 changed files with 87 additions and 59 deletions

View File

@ -6,6 +6,7 @@
USERID=
GROUPID=
PROJECT_PATH_ON_HOST=/Users/your-username-here/code/coollabsio/coolify
SERVEO_URL=<for receiving webhooks locally https://serveo.net/>
############################################################################################################
APP_NAME=Coolify

View File

@ -57,6 +57,7 @@ public function instantSave()
$this->application->settings->is_dual_cert = $this->is_dual_cert;
$this->application->settings->save();
$this->application->refresh();
$this->emit('saved', 'Application settings updated!');
}
public function mount()
{

View File

@ -67,6 +67,7 @@ public function instantSave()
$this->port = 3000;
$this->publish_directory = null;
}
$this->emit('saved', 'Application settings updated!');
}
public function submit()

View File

@ -33,6 +33,7 @@ public function instantSave()
$this->settings->is_registration_enabled = $this->is_registration_enabled;
$this->settings->is_https_forced = $this->is_https_forced;
$this->settings->save();
$this->emit('saved', 'Settings updated!');
}
public function submit()
{

View File

@ -44,6 +44,7 @@ public function instantSave()
try {
$this->github_app->is_system_wide = $this->is_system_wide;
$this->github_app->save();
$this->emit('saved', 'GitHub settings updated!');
} catch (\Exception $e) {
return generalErrorHandlerLivewire($e, $this);
}

View File

@ -22,6 +22,6 @@ static public function public()
}
static public function private()
{
return GithubApp::where('team_id', session('currentTeam')->id)->where('is_public', false)->whereNotNull('app_id')->whereNotNull('installation_id')->get();
return GithubApp::where('team_id', session('currentTeam')->id)->where('is_public', false)->get();
}
}

View File

@ -1,3 +1,3 @@
<?php
$config = include 'config/coolify.php';
echo $config['version'];
$version = include 'config/version.php';
echo $version;

View File

@ -1,5 +1,5 @@
<?php
return [
'version' => '4.0.0-nightly.2',
'dev_webhook' => env('SERVEO_URL'),
];

3
config/version.php Normal file
View File

@ -0,0 +1,3 @@
<?php
return '4.0.0-nightly.2';

View File

@ -2,10 +2,20 @@
<a target="_blank" href="{{ $gitLocation }}">
<x-inputs.button>Open on Git ↗️</x-inputs.button>
</a>
<a href="{{ route('project.application.configuration', Route::current()->parameters()) }}">
<a
href="{{ route('project.application.configuration', [
'project_uuid' => Route::current()->parameters()['project_uuid'],
'application_uuid' => Route::current()->parameters()['application_uuid'],
'environment_name' => Route::current()->parameters()['environment_name'],
]) }}">
<x-inputs.button>Configuration</x-inputs.button>
</a>
<a href="{{ route('project.application.deployments', Route::current()->parameters()) }}">
<a
href="{{ route('project.application.deployments', [
'project_uuid' => Route::current()->parameters()['project_uuid'],
'application_uuid' => Route::current()->parameters()['application_uuid'],
'environment_name' => Route::current()->parameters()['environment_name'],
]) }}">
<x-inputs.button>Deployments</x-inputs.button>
</a>
<livewire:project.application.deploy :applicationId="$applicationId" />

View File

@ -79,6 +79,10 @@ function checkHealth() {
Livewire.on('error', (message) => {
console.log(message);
})
Livewire.on('saved', (message) => {
if (message) console.log(message);
else console.log('saved');
})
</script>
@endauth

View File

@ -1,5 +1,5 @@
<nav class="flex gap-2 ">
<div>v{{ config('coolify.version') }}</div>
<div>v{{ config('version') }}</div>
@auth
<a href="/">Home</a>
<a href="/command-center">Command Center</a>

View File

@ -44,10 +44,11 @@
</x-inputs.button>
</form>
<div class="flex flex-col pt-4">
<x-inputs.input instantSave type="checkbox" id="is_static" label="Static website?" />
<x-inputs.input instantSave type="checkbox" id="is_git_submodules_allowed" label="Git Submodules Allowed?" />
<x-inputs.input instantSave type="checkbox" id="is_git_lfs_allowed" label="Git LFS Allowed?" />
<x-inputs.input instantSave type="checkbox" id="is_debug" label="Debug" />
<x-inputs.input noDirty instantSave type="checkbox" id="is_static" label="Static website?" />
<x-inputs.input noDirty instantSave type="checkbox" id="is_git_submodules_allowed"
label="Git Submodules Allowed?" />
<x-inputs.input noDirty instantSave type="checkbox" id="is_git_lfs_allowed" label="Git LFS Allowed?" />
<x-inputs.input noDirty instantSave type="checkbox" id="is_debug" label="Debug" />
<x-inputs.input disabled instantSave type="checkbox" id="is_auto_deploy" label="Auto Deploy?" />
<x-inputs.input disabled instantSave type="checkbox" id="is_dual_cert" label="Dual Certs?" />
<x-inputs.input disabled instantSave type="checkbox" id="is_previews" label="Previews?" />

View File

@ -1,6 +1,7 @@
<x-layout>
<h1>GitHub App</h1>
<livewire:source.github.change :github_app="$github_app" />
@if (!$github_app->app_id)
<form x-data>
<x-inputs.button x-on:click.prevent="createGithubApp">Create GitHub Application</x-inputs.button>
</form>
@ -11,23 +12,26 @@ function createGithubApp() {
uuid,
html_url
} = @json($github_app);
const host = @js($host);
let baseUrl = @js($host);
const name = @js($name);
let url = 'settings/apps/new';
if (organization) {
organization = `'organizations/${organization}/settings/apps/new`;
const isDev = @js(config('app.env')) === 'local';
const devWebhook = @js(config('coolify.dev_webhook'));
if (isDev && devWebhook) {
baseUrl = devWebhook;
}
const webhookBaseUrl = `${baseUrl}/webhooks`;
const path = organization ? `organizations/${organization}/settings/apps/new` : 'settings/apps/new';
const data = {
name,
url: host,
url: baseUrl,
hook_attributes: {
url: `${host}/webhooks/github/events`
url: `${webhookBaseUrl}/github/events`
},
redirect_url: `${host}/webhooks/github`,
callback_urls: [`${host}/login/github/app`],
redirect_url: `${webhookBaseUrl}/github`,
callback_urls: [`${baseUrl}/login/github/app`],
public: false,
request_oauth_on_install: false,
setup_url: `${host}/webhooks/github/install?source=${uuid}`,
setup_url: `${webhookBaseUrl}/github/install?source=${uuid}`,
setup_on_update: true,
default_permissions: {
contents: 'read',
@ -39,15 +43,16 @@ function createGithubApp() {
};
const form = document.createElement('form');
form.setAttribute('method', 'post');
form.setAttribute('action', `${html_url}/${url}?state=${uuid}`);
form.setAttribute('action', `${html_url}/${path}?state=${uuid}`);
const input = document.createElement('input');
input.setAttribute('id', 'manifest');
input.setAttribute('name', 'manifest');
input.setAttribute('type', 'hidden');
input.setAttribute('value', data);
input.setAttribute('value', JSON.stringify(data));
form.appendChild(input);
document.getElementsByTagName('body')[0].appendChild(form);
form.submit();
}
</script>
@endif
</x-layout>