Merge branch 'v2' into feature/implement-basic-auth-handling

This commit is contained in:
Andras Bacsai
2023-07-18 14:48:02 +02:00
30 changed files with 983 additions and 802 deletions

View File

@@ -1,13 +1,10 @@
import * as Sentry from '@sentry/svelte';
export async function handle({ event, resolve }) {
const response = await resolve(event, { ssr: false });
return response;
const response = await resolve(event, { ssr: false });
return response;
}
export const handleError = ({ error, event }) => {
Sentry.captureException(error, { event });
return {
message: 'Whoops!',
code: error?.code ?? 'UNKNOWN'
};
};
return {
message: 'Whoops!',
code: error?.code ?? 'UNKNOWN'
};
};

View File

@@ -1,5 +1,6 @@
import { dev } from '$app/env';
import Cookies from 'js-cookie';
import { dashify } from './common';
export function getAPIUrl() {
if (GITPOD_WORKSPACE_URL) {
@@ -100,6 +101,14 @@ async function send({
responseData = await response.json();
} else if (contentType?.indexOf('text/plain') !== -1) {
responseData = await response.text();
} else if (contentType?.indexOf('application/octet-stream') !== -1) {
responseData = await response.blob();
const fileName = dashify(data.id + '-' + data.name)
const fileLink = document.createElement('a');
fileLink.href = URL.createObjectURL(new Blob([responseData]))
fileLink.download = fileName + '.gz';
fileLink.click();
fileLink.remove();
} else {
return {};
}

View File

@@ -65,7 +65,6 @@
<script lang="ts">
export let settings: any;
export let sentryDSN: any;
export let baseSettings: any;
export let pendingInvitations: any = 0;
@@ -98,10 +97,6 @@
import Toasts from '$lib/components/Toasts.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
import { onMount } from 'svelte';
import LocalePicker from '$lib/components/LocalePicker.svelte';
import * as Sentry from '@sentry/svelte';
import { BrowserTracing } from '@sentry/tracing';
import { dev } from '$app/env';
if (userId) $appSession.userId = userId;
if (teamId) $appSession.teamId = teamId;
@@ -293,7 +288,7 @@
</a>
<a
id="documentation"
href="https://docs.coollabs.io/coolify/"
href="https://docs.coollabs.io/coolify-v3/"
target="_blank"
rel="noreferrer external"
class="icons hover:text-info"
@@ -384,7 +379,7 @@
</div>
<div class="drawer-side">
<label for="main-drawer" class="drawer-overlay w-full" />
<ul class="menu bg-coolgray-200 w-60 p-2 space-y-3 pt-4 ">
<ul class="menu bg-coolgray-200 w-60 p-2 space-y-3 pt-4">
<li>
<a
class="no-underline icons hover:text-white hover:bg-pink-500"
@@ -498,7 +493,7 @@
<li>
<a
class="no-underline icons hover:text-white hover:bg-info"
href="https://docs.coollabs.io/coolify/"
href="https://docs.coollabs.io/coolify-v3/"
target="_blank"
rel="noreferrer external"
>

View File

@@ -255,12 +255,12 @@
{/if}
<div class="flex flex-row items-center">
<div class="title py-4 pr-4">Public Repository from Git</div>
<DocLink url="https://docs.coollabs.io/coolify/applications/#public-repository-from-git" />
<DocLink url="https://docs.coollabs.io/coolify-v3/applications/#public-repository-from-git" />
</div>
<PublicRepository />
<div class="flex flex-row items-center pt-10">
<div class="title py-4 pr-4">Simple Dockerfile <Beta /></div>
<DocLink url="https://docs.coollabs.io/coolify/applications/#dockerfile" />
<DocLink url="https://docs.coollabs.io/coolify-v3/applications/#simple-dockerfile" />
</div>
<div class="mx-auto max-w-screen-2xl">
<form class="flex flex-col" on:submit|preventDefault={handleDockerImage}>

View File

@@ -13,17 +13,19 @@
import Redis from './_Redis.svelte';
import CouchDb from './_CouchDb.svelte';
import EdgeDB from './_EdgeDB.svelte';
import { post } from '$lib/api';
import { get, post } from '$lib/api';
import { t } from '$lib/translations';
import { errorNotification } from '$lib/common';
import { addToast, appSession, status } from '$lib/store';
import Explainer from '$lib/components/Explainer.svelte';
import Tooltip from '$lib/components/Tooltip.svelte';
const { id } = $page.params;
let loading = {
main: false,
public: false
public: false,
backup: false
};
let publicUrl = '';
let appendOnly = database.settings.appendOnly;
@@ -109,6 +111,7 @@
if ($status.database.isPublic) {
database.publicPort = publicPort;
}
generateUrl();
} catch (error) {
return errorNotification(error);
} finally {
@@ -130,6 +133,22 @@
loading.main = false;
}
}
async function backupDatabase() {
try {
loading.backup = true;
addToast({
message:
'Backup will be downloaded soon and saved to /var/lib/docker/volumes/coolify-local-backup/ on the host system.',
type: 'success',
timeout: 15000
});
return await post(`/databases/${id}/backup`, { id, name: database.name });
} catch (error) {
return errorNotification(error);
} finally {
loading.backup = false;
}
}
</script>
<div class="mx-auto max-w-6xl p-4">
@@ -144,6 +163,19 @@
class:bg-databases={!loading.main}
disabled={loading.main}>{$t('forms.save')}</button
>
{#if database.type !== 'redis' && database.type !== 'edgedb'}
{#if $status.database.isRunning}
<button
class="btn btn-sm"
on:click={backupDatabase}
class:loading={loading.backup}
class:bg-databases={!loading.backup}
disabled={loading.backup}>Backup Database</button
>
{:else}
<button disabled class="btn btn-sm">Backup Database (start the database)</button>
{/if}
{/if}
{/if}
</div>
<div class="grid gap-2 grid-cols-2 auto-rows-max lg:px-10 px-2">

View File

@@ -34,14 +34,20 @@
customClass="max-w-[32rem]"
text="Remote Docker Engines are using <span class='text-white font-bold'>SSH</span> to communicate with the remote docker engine.
You need to setup an <span class='text-white font-bold'>SSH key</span> in advance on the server and install Docker.
<br>See <a class='text-white' href='https://docs.coollabs.io/coolify/destinations#remote-docker-engine' target='blank'>docs</a> for more details."
<br>See <a class='text-white' href='https://docs.coollabs.io-v3/coolify/destinations#remote-docker-engine' target='blank'>docs</a> for more details."
/>
</div>
<div class="flex justify-center px-6 pb-8">
<form on:submit|preventDefault={handleSubmit} class="grid grid-flow-row gap-2 py-4">
<div class="flex items-start lg:items-center space-x-0 lg:space-x-4 pb-5 flex-col lg:flex-row space-y-4 lg:space-y-0">
<div
class="flex items-start lg:items-center space-x-0 lg:space-x-4 pb-5 flex-col lg:flex-row space-y-4 lg:space-y-0"
>
<div class="title font-bold">{$t('forms.configuration')}</div>
<button type="submit" class="btn btn-sm bg-destinations w-full lg:w-fit" class:loading disabled={loading}
<button
type="submit"
class="btn btn-sm bg-destinations w-full lg:w-fit"
class:loading
disabled={loading}
>{loading
? payload.isCoolifyProxyUsed
? $t('destination.new.saving_and_configuring_proxy')

View File

@@ -75,6 +75,25 @@
}
}
}
async function forceDeleteDestination(destination: any) {
let sure = confirm($t('application.confirm_to_delete', { name: destination.name }));
if (sure) {
sure = confirm(
'Are you REALLY sure? This will delete all resources associated with this destination, but not on the destination (server) itself. You will have manually delete everything on the server afterwards.'
);
if (sure) {
sure = confirm('REALLY?');
if (sure) {
try {
await del(`/destinations/${destination.id}/force`, { id: destination.id });
return await goto('/', { replaceState: true });
} catch (error) {
return errorNotification(error);
}
}
}
}
}
function deletable() {
if (!isDestinationDeletable) {
return 'Please delete all resources before deleting this.';
@@ -88,7 +107,7 @@
</script>
{#if $page.params.id !== 'new'}
<nav class="header lg:flex-row flex-col-reverse">
<nav class="header lg:flex-row flex-col-reverse gap-2">
<div class="flex flex-row space-x-2 font-bold pt-10 lg:pt-0">
<div class="flex flex-col items-center justify-center title">
{#if $page.url.pathname === `/destinations/${$page.params.id}`}
@@ -111,6 +130,16 @@
>
<Tooltip triggeredBy="#delete">{deletable()}</Tooltip>
</div>
<div class="flex flex-row flex-wrap justify-center lg:justify-start lg:py-0 items-center">
<button
id="forceDelete"
on:click={() => forceDeleteDestination(destination)}
type="submit"
disabled={!$appSession.isAdmin && isDestinationDeletable}
class="icons bg-transparent text-sm text-red-500"><DeleteIcon /></button
>
<Tooltip triggeredBy="#forceDelete">Force Delete</Tooltip>
</div>
</nav>
{/if}
<slot />

View File

@@ -52,7 +52,7 @@
appSecret: source.gitlabApp.appSecret,
groupName: source.gitlabApp.groupName,
customPort: source.customPort,
customUser: source.customUser,
customUser: source.customUser
});
const from = $page.url.searchParams.get('from');
if (from) {
@@ -169,8 +169,8 @@
<div class="grid grid-flow-row gap-2 lg:px-10">
{#if !source.gitlabAppId}
<a
href="https://docs.coollabs.io/coolify/sources#how-to-integrate-with-gitlab"
class="font-bold "
href="https://docs.coollabs.io-v3/coolify/sources#how-to-integrate-with-gitlab"
class="font-bold"
target="_blank noreferrer"
rel="noopener noreferrer">Documentation and detailed instructions.</a
>