Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

9.4 KB
Raw Blame
<div>
    @if ($resource->type() === 'application')
        @php
            $manualWebhookProviders = [
                [
                    'name' => 'GitHub',
                    'url' => $githubManualWebhook,
                    'key' => 'github',
                    'secret' => 'githubManualWebhookSecret',
                    'description' => 'Accepts JSON or form-urlencoded webhook payloads.',
                ],
                [
                    'name' => 'GitLab',
                    'url' => $gitlabManualWebhook,
                    'key' => 'gitlab',
                    'secret' => 'gitlabManualWebhookSecret',
                    'description' => 'Use the same secret when configuring the webhook in GitLab.',
                ],
                [
                    'name' => 'Bitbucket',
                    'url' => $bitbucketManualWebhook,
                    'key' => 'bitbucket',
                    'secret' => 'bitbucketManualWebhookSecret',
                    'description' => 'Use the same secret when configuring the webhook in Bitbucket.',
                ],
                [
                    'name' => 'Gitea',
                    'url' => $giteaManualWebhook,
                    'key' => 'gitea',
                    'secret' => 'giteaManualWebhookSecret',
                    'description' => 'Use the same secret when configuring the webhook in Gitea.',
                ],
            ];
        @endphp

        <div class="flex flex-col gap-6">
            <x-application.settings-section id="deploy-webhook-section" title="Deploy webhook"
                helper="Trigger a deployment from an external service. Requests must include a valid Coolify API authorization token.">
                <x-slot:actions>
                    <a class="button" href="https://coolify.io/docs/api-reference/authorization" target="_blank"
                        rel="noopener noreferrer">
                        Documentation
                        <x-external-link />
                    </a>
                </x-slot:actions>
                <x-api-disabled-callout class="mb-4"
                    message="Enable API access before external services can call the deploy webhook." />
                <x-forms.copy-input label="Deploy webhook URL" :text="$deploywebhook ?? ''" />
            </x-application.settings-section>

            @if ($resource->git_based() && $githubManualWebhook && $gitlabManualWebhook)
                <form wire:submit.prevent="submit" class="application-settings-form flex flex-col">
                    <x-unsaved-bar action="submit"
                        dirty="Object.entries($wire.savedSecrets).some(([property, saved]) => ($wire[property] ?? '') !== (saved ?? ''))" />
                    <x-application.settings-section id="manual-git-webhooks-section" title="Manual Git webhooks"
                        helper="Configure these endpoints when the repository is not connected through an official Git App." flush>
                        <x-slot:actions>
                            @if (filled($resource?->gitWebhook))
                                <a class="button" href="{{ $resource->gitWebhook }}" target="_blank"
                                    rel="noopener noreferrer">
                                    Repository settings
                                    <x-external-link />
                                </a>
                            @endif
                        </x-slot:actions>

                        <div class="divide-y divide-neutral-200 dark:divide-white/[0.07]">
                            @foreach ($manualWebhookProviders as $provider)
                                <section class="px-4 py-5 first:pt-4 last:pb-4"
                                    wire:key="manual-webhook-{{ str($provider['name'])->slug() }}">
                                    <div class="mb-4">
                                        <h4 class="text-sm font-semibold text-black dark:text-fg">
                                            {{ $provider['name'] }}
                                        </h4>
                                        <p class="mt-1 text-[13px] leading-5 text-neutral-500 dark:text-fg-dim">
                                            {{ $provider['description'] }}
                                        </p>
                                    </div>
                                    <div class="grid gap-4 md:grid-cols-2">
                                        <x-forms.copy-input label="Webhook URL" :text="$provider['url'] ?? ''" />
                                        @can('update', $resource)
                                            <div class="flex items-end gap-2">
                                                <x-forms.input type="password" :id="$provider['secret']"
                                                    label="Webhook secret"
                                                    helper="Must exactly match the secret configured in {{ $provider['name'] }}. New secrets need at least 16 characters. Leave empty to disable this webhook."
                                                    autocomplete="new-password" copyable />
                                                <x-forms.button type="button"
                                                    wire:click="generateSecret('{{ $provider['key'] }}')"
                                                    aria-label="Generate {{ $provider['name'] }} webhook secret">
                                                    Generate
                                                </x-forms.button>
                                            </div>
                                        @else
                                            <x-forms.input disabled label="Webhook secret"
                                                value="Hidden (only administrators can view)" />
                                        @endcan
                                    </div>
                                </section>
                            @endforeach
                        </div>
                    </x-application.settings-section>
                </form>
            @elseif ($gitlabAppWebhook)
                <x-application.settings-section id="manual-git-webhooks-section" title="Manual Git webhooks"
                    helper="GitLab Apps cannot register repository webhooks, so add this webhook to the GitLab project yourself." flush>
                    <x-slot:actions>
                        @can('view', $resource->source)
                            <a class="button" href="{{ route('source.gitlab.show', ['gitlab_app_uuid' => $resource->source->uuid]) }}"
                                {{ wireNavigate() }}>
                                Source settings
                            </a>
                        @endcan
                        @if (filled($resource?->gitWebhook))
                            <a class="button" href="{{ $resource->gitWebhook }}" target="_blank"
                                rel="noopener noreferrer">
                                Repository settings
                                <x-external-link />
                            </a>
                        @endif
                    </x-slot:actions>

                    <section class="px-4 py-5">
                        <div class="mb-4">
                            <h4 class="text-sm font-semibold text-black dark:text-fg">GitLab</h4>
                            <p class="mt-1 text-[13px] leading-5 text-neutral-500 dark:text-fg-dim">
                                Add this URL in the GitLab project under Settings → Webhooks. Set the Secret token to
                                the Webhook secret token from the source settings, and enable Push events and Merge
                                request events.
                            </p>
                        </div>
                        <x-forms.copy-input label="Webhook URL" :text="$gitlabAppWebhook" />
                    </section>
                </x-application.settings-section>
            @else
                <x-application.settings-section id="manual-git-webhooks-section" title="Manual Git webhooks"
                    helper="Manual repository webhooks are only required when a repository is not connected through an official Git App.">
                    <x-empty size="sm" title="Managed by your Git App"
                        description="This application uses an official Git App, so Coolify configures repository webhooks automatically."
                        icon-name="notifications" />
                </x-application.settings-section>
            @endif
        </div>
    @else
        <div class="application-settings-form">
            <x-application.settings-section title="Deploy webhook"
                helper="Trigger an external deployment with a valid Coolify API authorization token.">
                <x-slot:actions>
                    <a class="button" href="https://coolify.io/docs/api-reference/authorization" target="_blank"
                        rel="noopener noreferrer">
                        Documentation
                        <x-external-link />
                    </a>
                </x-slot:actions>
                <x-api-disabled-callout class="mb-4"
                    message="Enable API access before external services can call the deploy webhook." />
                <x-forms.copy-input label="Deploy webhook URL" :text="$deploywebhook ?? ''" />
            </x-application.settings-section>
        </div>
    @endif
</div>