Merge pull request #2880 from coollabsio/next

v4.0.0-beta.317
This commit is contained in:
Andras Bacsai 2024-07-19 14:57:29 +02:00 committed by GitHub
commit d6d194d414
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 102 additions and 128 deletions

View File

@ -620,7 +620,7 @@ public function create_dockercompose_application(Request $request)
private function create_application(Request $request, $type) private function create_application(Request $request, $type)
{ {
$allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths']; $allowedFields = ['project_uuid', 'environment_name', 'server_uuid', 'destination_uuid', 'type', 'name', 'description', 'is_static', 'domains', 'git_repository', 'git_branch', 'git_commit_sha', 'private_key_uuid', 'docker_registry_image_name', 'docker_registry_image_tag', 'build_pack', 'install_command', 'build_command', 'start_command', 'ports_exposes', 'ports_mappings', 'base_directory', 'publish_directory', 'health_check_enabled', 'health_check_path', 'health_check_port', 'health_check_host', 'health_check_method', 'health_check_return_code', 'health_check_scheme', 'health_check_response_text', 'health_check_interval', 'health_check_timeout', 'health_check_retries', 'health_check_start_period', 'limits_memory', 'limits_memory_swap', 'limits_memory_swappiness', 'limits_memory_reservation', 'limits_cpus', 'limits_cpuset', 'limits_cpu_shares', 'custom_labels', 'custom_docker_run_options', 'post_deployment_command', 'post_deployment_command_container', 'pre_deployment_command', 'pre_deployment_command_container', 'manual_webhook_secret_github', 'manual_webhook_secret_gitlab', 'manual_webhook_secret_bitbucket', 'manual_webhook_secret_gitea', 'redirect', 'github_app_uuid', 'instant_deploy', 'dockerfile', 'docker_compose_location', 'docker_compose_raw', 'docker_compose_custom_start_command', 'docker_compose_custom_build_command', 'docker_compose_domains', 'watch_paths'];
$teamId = getTeamIdFromToken(); $teamId = getTeamIdFromToken();
if (is_null($teamId)) { if (is_null($teamId)) {
return invalidTokenResponse(); return invalidTokenResponse();

View File

@ -299,13 +299,13 @@ public function handle(): void
} else { } else {
$this->write_deployment_configurations(); $this->write_deployment_configurations();
} }
// $this->execute_remote_command( $this->execute_remote_command(
// [ [
// "docker rm -f {$this->deployment_uuid} >/dev/null 2>&1", "docker rm -f {$this->deployment_uuid} >/dev/null 2>&1",
// 'hidden' => true, 'hidden' => true,
// 'ignore_errors' => true, 'ignore_errors' => true,
// ] ]
// ); );
// $this->execute_remote_command( // $this->execute_remote_command(
// [ // [

View File

@ -132,7 +132,7 @@ function generate_default_proxy_configuration(Server $server)
'services' => [ 'services' => [
'traefik' => [ 'traefik' => [
'container_name' => 'coolify-proxy', 'container_name' => 'coolify-proxy',
'image' => 'traefik:v2.10', 'image' => 'traefik:v2.11',
'restart' => RESTART_MODE, 'restart' => RESTART_MODE,
'extra_hosts' => [ 'extra_hosts' => [
'host.docker.internal:host-gateway', 'host.docker.internal:host-gateway',

View File

@ -7,7 +7,7 @@
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.316', 'release' => '4.0.0-beta.317',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.316'; return '4.0.0-beta.317';

View File

@ -149,124 +149,99 @@ class="underline" href="https://coolify.io/docs/knowledge-base/docker/registry"
Specific Docs</a> Specific Docs</a>
</div> </div>
@endif @endif
@endif @endif
<div x-data="{ <div class="flex flex-col gap-2 pt-6 pb-10">
activeAccordion: '', @if ($application->build_pack === 'dockercompose')
setActiveAccordion(id) { <div class="flex flex-col gap-2" x-init="$wire.dispatch('loadCompose', true)">
this.activeAccordion = (this.activeAccordion == id) ? '' : id <div class="flex gap-2">
} <x-forms.input x-bind:disabled="initLoadingCompose" placeholder="/"
}" id="application.base_directory" label="Base Directory"
class="relative w-full mx-auto mt-4 overflow-hidden text-sm font-normal"> helper="Directory to use as root. Useful for monorepos." />
<div x-data="{ id: $id('accordion') }" class="cursor-pointer"> <x-forms.input x-bind:disabled="initLoadingCompose"
<button @click="setActiveAccordion(id)" placeholder="/docker-compose.yaml" id="application.docker_compose_location"
class="flex items-center justify-between w-full p-1 text-left select-none hover:dark:text-white hover:bg-white/5" label="Docker Compose Location"
type="button"> helper="It is calculated together with the Base Directory:<br><span class='dark:text-warning'>{{ Str::start($application->base_directory . $application->docker_compose_location, '/') }}</span>" />
<h4>Advanced</h4> </div>
<svg class="w-4 h-4 duration-200 ease-out" <div class="w-96">
:class="{ 'rotate-180': activeAccordion == id }" viewBox="0 0 24 24" <x-forms.checkbox instantSave
xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" id="application.settings.is_preserve_repository_enabled"
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> label="Preserve Repository During Deployment"
<polyline points="6 9 12 15 18 9"></polyline> helper="Git repository (based on the base directory settings) will be copied to the deployment directory." />
</svg> </div>
</button> <div class="pt-4">The following commands are for advanced use cases.
<div x-show="activeAccordion==id" x-collapse x-cloak class="px-2"> Only
<div class="flex flex-col gap-2 pt-6 pb-10"> modify them if you
@if ($application->build_pack === 'dockercompose') know what are
<div class="flex flex-col gap-2" x-init="$wire.dispatch('loadCompose', true)"> you doing.</div>
<div class="flex gap-2"> <div class="flex gap-2">
<x-forms.input x-bind:disabled="initLoadingCompose" placeholder="/" <x-forms.input placeholder="docker compose build"
id="application.base_directory" label="Base Directory" x-bind:disabled="initLoadingCompose"
helper="Directory to use as root. Useful for monorepos." /> id="application.docker_compose_custom_build_command"
<x-forms.input x-bind:disabled="initLoadingCompose" helper="If you use this, you need to specify paths relatively and should use the same compose file in the custom command, otherwise the automatically configured labels / etc won't work.<br><br>So in your case, use: <span class='dark:text-warning'>docker compose -f .{{ Str::start($application->base_directory . $application->docker_compose_location, '/') }} build</span>"
placeholder="/docker-compose.yaml" label="Custom Build Command" />
id="application.docker_compose_location" <x-forms.input placeholder="docker compose up -d"
label="Docker Compose Location" x-bind:disabled="initLoadingCompose"
helper="It is calculated together with the Base Directory:<br><span class='dark:text-warning'>{{ Str::start($application->base_directory . $application->docker_compose_location, '/') }}</span>" /> id="application.docker_compose_custom_start_command"
</div> helper="If you use this, you need to specify paths relatively and should use the same compose file in the custom command, otherwise the automatically configured labels / etc won't work.<br><br>So in your case, use: <span class='dark:text-warning'>docker compose -f .{{ Str::start($application->base_directory . $application->docker_compose_location, '/') }} up -d</span>"
<div class="w-96"> label="Custom Start Command" />
<x-forms.checkbox instantSave
id="application.settings.is_preserve_repository_enabled"
label="Preserve Repository During Deployment"
helper="Git repository (based on the base directory settings) will be copied to the deployment directory." />
</div>
<div class="pt-4">The following commands are for advanced use cases. Only
modify them if you
know what are
you doing.</div>
<div class="flex gap-2">
<x-forms.input placeholder="docker compose build"
x-bind:disabled="initLoadingCompose"
id="application.docker_compose_custom_build_command"
helper="If you use this, you need to specify paths relatively and should use the same compose file in the custom command, otherwise the automatically configured labels / etc won't work.<br><br>So in your case, use: <span class='dark:text-warning'>docker compose -f .{{ Str::start($application->base_directory . $application->docker_compose_location, '/') }} build</span>"
label="Custom Build Command" />
<x-forms.input placeholder="docker compose up -d"
x-bind:disabled="initLoadingCompose"
id="application.docker_compose_custom_start_command"
helper="If you use this, you need to specify paths relatively and should use the same compose file in the custom command, otherwise the automatically configured labels / etc won't work.<br><br>So in your case, use: <span class='dark:text-warning'>docker compose -f .{{ Str::start($application->base_directory . $application->docker_compose_location, '/') }} up -d</span>"
label="Custom Start Command" />
</div>
</div>
@else
<div class="flex flex-col gap-2 xl:flex-row">
<x-forms.input placeholder="/" id="application.base_directory"
label="Base Directory"
helper="Directory to use as root. Useful for monorepos." />
@if ($application->build_pack === 'dockerfile' && !$application->dockerfile)
<x-forms.input placeholder="/Dockerfile"
id="application.dockerfile_location" label="Dockerfile Location"
helper="It is calculated together with the Base Directory:<br><span class='dark:text-warning'>{{ Str::start($application->base_directory . $application->dockerfile_location, '/') }}</span>" />
@endif
@if ($application->build_pack === 'dockerfile')
<x-forms.input id="application.dockerfile_target_build"
label="Docker Build Stage Target"
helper="Useful if you have multi-staged dockerfile." />
@endif
@if ($application->could_set_build_commands())
@if ($application->settings->is_static)
<x-forms.input placeholder="/dist"
id="application.publish_directory" label="Publish Directory"
required />
@else
<x-forms.input placeholder="/" id="application.publish_directory"
label="Publish Directory" />
@endif
@endif
</div>
@if ($this->application->is_github_based() && !$this->application->is_public_repository())
<div class="pb-4">
<x-forms.textarea
helper="Gitignore-style rules to filter Git based webhook deployments."
placeholder="src/pages/**" id="application.watch_paths"
label="Watch Paths" />
</div>
@endif
<x-forms.input
helper="You can add custom docker run options that will be used when your container is started.<br>Note: Not all options are supported, as they could mess up Coolify's automation and could cause bad experience for users.<br><br>Check the <a class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/custom-commands'>docs.</a>"
placeholder="--cap-add SYS_ADMIN --device=/dev/fuse --security-opt apparmor:unconfined --ulimit nofile=1024:1024 --tmpfs /run:rw,noexec,nosuid,size=65536k"
id="application.custom_docker_run_options"
label="Custom Docker Options" />
@if ($application->build_pack !== 'dockercompose')
<div class="pt-2 w-96">
<x-forms.checkbox
helper="Use a build server to build your application. You can configure your build server in the Server settings. This is experimental. For more info, check the <a href='https://coolify.io/docs/knowledge-base/server/build-server' class='underline' target='_blank'>documentation</a>."
instantSave id="application.settings.is_build_server_enabled"
label="Use a Build Server? (experimental)" />
</div>
@endif
@if ($application->could_set_build_commands())
<div class="w-96">
<x-forms.checkbox instantSave id="application.settings.is_static"
label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
</div>
@endif
@endif
</div> </div>
</div> </div>
</div> @else
<div class="flex flex-col gap-2 xl:flex-row">
<x-forms.input placeholder="/" id="application.base_directory" label="Base Directory"
helper="Directory to use as root. Useful for monorepos." />
@if ($application->build_pack === 'dockerfile' && !$application->dockerfile)
<x-forms.input placeholder="/Dockerfile" id="application.dockerfile_location"
label="Dockerfile Location"
helper="It is calculated together with the Base Directory:<br><span class='dark:text-warning'>{{ Str::start($application->base_directory . $application->dockerfile_location, '/') }}</span>" />
@endif
@if ($application->build_pack === 'dockerfile')
<x-forms.input id="application.dockerfile_target_build"
label="Docker Build Stage Target"
helper="Useful if you have multi-staged dockerfile." />
@endif
@if ($application->could_set_build_commands())
@if ($application->settings->is_static)
<x-forms.input placeholder="/dist" id="application.publish_directory"
label="Publish Directory" required />
@else
<x-forms.input placeholder="/" id="application.publish_directory"
label="Publish Directory" />
@endif
@endif
</div>
@if ($this->application->is_github_based() && !$this->application->is_public_repository())
<div class="pb-4">
<x-forms.textarea
helper="Gitignore-style rules to filter Git based webhook deployments."
placeholder="src/pages/**" id="application.watch_paths"
label="Watch Paths" />
</div>
@endif
<x-forms.input
helper="You can add custom docker run options that will be used when your container is started.<br>Note: Not all options are supported, as they could mess up Coolify's automation and could cause bad experience for users.<br><br>Check the <a class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/docker/custom-commands'>docs.</a>"
placeholder="--cap-add SYS_ADMIN --device=/dev/fuse --security-opt apparmor:unconfined --ulimit nofile=1024:1024 --tmpfs /run:rw,noexec,nosuid,size=65536k"
id="application.custom_docker_run_options" label="Custom Docker Options" />
@if ($application->build_pack !== 'dockercompose')
<div class="pt-2 w-96">
<x-forms.checkbox
helper="Use a build server to build your application. You can configure your build server in the Server settings. This is experimental. For more info, check the <a href='https://coolify.io/docs/knowledge-base/server/build-server' class='underline' target='_blank'>documentation</a>."
instantSave id="application.settings.is_build_server_enabled"
label="Use a Build Server? (experimental)" />
</div>
@endif
@if ($application->could_set_build_commands())
<div class="w-96">
<x-forms.checkbox instantSave id="application.settings.is_static"
label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
</div>
@endif
@endif
</div> </div>
@endif @endif
</div> </div>
@ -292,7 +267,6 @@ class="flex items-center justify-between w-full p-1 text-left select-none hover:
id="application.settings.is_container_label_readonly_enabled" instantSave></x-forms.checkbox> id="application.settings.is_container_label_readonly_enabled" instantSave></x-forms.checkbox>
</div> </div>
@endif @endif
@if ($application->dockerfile) @if ($application->dockerfile)
<x-forms.textarea label="Dockerfile" id="application.dockerfile" monacoEditorLanguage="dockerfile" <x-forms.textarea label="Dockerfile" id="application.dockerfile" monacoEditorLanguage="dockerfile"
useMonacoEditor rows="6"> </x-forms.textarea> useMonacoEditor rows="6"> </x-forms.textarea>

View File

@ -1,7 +1,7 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.316" "version": "4.0.0-beta.317"
} }
} }
} }