diff --git a/src/lib/haproxy/configuration.ts b/src/lib/haproxy/configuration.ts
index 619670f19..97cb76c97 100644
--- a/src/lib/haproxy/configuration.ts
+++ b/src/lib/haproxy/configuration.ts
@@ -243,7 +243,6 @@ export async function configureHAProxy() {
const { proxyHash, id } = await db.listSettings();
if (proxyHash !== newHash) {
await db.prisma.setting.update({ where: { id }, data: { proxyHash: newHash } });
- console.log('HAProxy configuration changed, updating...');
await haproxy.post(`v2/services/haproxy/configuration/raw`, {
searchParams: {
skip_version: true
@@ -253,8 +252,6 @@ export async function configureHAProxy() {
'Content-Type': 'text/plain'
}
});
- } else {
- console.log('HAProxy configuration is up to date');
}
} catch (error) {
throw error;
diff --git a/src/routes/__layout.svelte b/src/routes/__layout.svelte
index fc85ac8f5..ec314efb0 100644
--- a/src/routes/__layout.svelte
+++ b/src/routes/__layout.svelte
@@ -38,13 +38,13 @@
import { errorNotification } from '$lib/form';
import { asyncSleep } from '$lib/components/common';
import { del, get, post } from '$lib/api';
- import { browser } from '$app/env';
- import { fade } from 'svelte/transition';
+ import { browser, dev } from '$app/env';
let isUpdateAvailable = false;
+
let updateStatus = {
+ found: false,
loading: false,
- checking: false,
success: null
};
let latestVersion = 'latest';
@@ -60,16 +60,19 @@
}
if ($session.teamId === '0') {
try {
- updateStatus.checking = true;
const data = await get(`/update.json`);
if (overrideVersion || data?.isUpdateAvailable) {
latestVersion = overrideVersion || data.latestVersion;
- isUpdateAvailable = overrideVersion ? true : data?.isUpdateAvailable;
- await post(`/update.json`, { type: 'pull', latestVersion });
+ console.log('checking update');
+ const { exists } = await post(`/update.json`, {
+ type: 'check',
+ latestVersion,
+ overrideVersion
+ });
+ isUpdateAvailable = exists;
}
} catch (error) {
} finally {
- updateStatus.checking = false;
}
}
}
@@ -97,26 +100,32 @@
async function update() {
updateStatus.loading = true;
try {
- await post(`/update.json`, { type: 'update', latestVersion });
- toast.push('Update completed. Waiting for the new version to start...');
- let reachable = false;
- let tries = 0;
- do {
+ if (dev) {
+ console.log(`updating to ${latestVersion}`);
await asyncSleep(4000);
- try {
- await get(`/undead.json`);
- reachable = true;
- } catch (error) {
- reachable = false;
- }
- if (reachable) break;
- tries++;
- } while (!reachable || tries < 120);
- toast.push('New version reachable. Reloading...');
- updateStatus.loading = false;
- updateStatus.success = true;
- await asyncSleep(3000);
- return window.location.reload();
+ return window.location.reload();
+ } else {
+ await post(`/update.json`, { type: 'update', latestVersion });
+ toast.push('Update completed. Waiting for the new version to start...');
+ let reachable = false;
+ let tries = 0;
+ do {
+ await asyncSleep(4000);
+ try {
+ await get(`/undead.json`);
+ reachable = true;
+ } catch (error) {
+ reachable = false;
+ }
+ if (reachable) break;
+ tries++;
+ } while (!reachable || tries < 120);
+ toast.push('New version reachable. Reloading...');
+ updateStatus.loading = false;
+ updateStatus.success = true;
+ await asyncSleep(3000);
+ return window.location.reload();
+ }
} catch ({ error }) {
updateStatus.success = false;
updateStatus.loading = false;
@@ -311,35 +320,10 @@
{#if $session.teamId === '0'}
- {#if updateStatus.checking}
-
-
-
-
-
-
-
-
-
- {:else if isUpdateAvailable}
+ {#if isUpdateAvailable}
diff --git a/src/routes/applications/[id]/previews/index.svelte b/src/routes/applications/[id]/previews/index.svelte
index 9ac2dd940..632dafb62 100644
--- a/src/routes/applications/[id]/previews/index.svelte
+++ b/src/routes/applications/[id]/previews/index.svelte
@@ -43,39 +43,41 @@
-
-
-
-
- Name
- Value
- Need during buildtime?
- Action
-
-
-
- {#each applicationSecrets as secret}
- {#key secret.id}
-
- s.name === secret.name)}
- isPRMRSecret
- name={secret.name}
- value={secret.value}
- isBuildSecret={secret.isBuildSecret}
- on:refresh={refreshSecrets}
- />
-
- {/key}
- {/each}
-
-
-
+{#if applicationSecrets.length !== 0}
+
+
+
+
+ Name
+ Value
+ Need during buildtime?
+ Action
+
+
+
+ {#each applicationSecrets as secret}
+ {#key secret.id}
+
+ s.name === secret.name)}
+ isPRMRSecret
+ name={secret.name}
+ value={secret.value}
+ isBuildSecret={secret.isBuildSecret}
+ on:refresh={refreshSecrets}
+ />
+
+ {/key}
+ {/each}
+
+
+
+{/if}
Please add secrets to the application first. These values overwrite application secrets in PR/MR deployments. Useful for creating staging environments."
+ ? "You can add secrets to PR/MR deployments. Please add secrets to the application first. Useful for creating staging environments."
: "These values overwrite application secrets in PR/MR deployments. Useful for creating staging environments."}
/>
diff --git a/src/routes/update.json.ts b/src/routes/update.json.ts
index 1cfdc5f50..87a728352 100644
--- a/src/routes/update.json.ts
+++ b/src/routes/update.json.ts
@@ -12,7 +12,7 @@ export const get: RequestHandler = async () => {
const versions = await got
.get(`https://get.coollabs.io/versions.json?appId=${process.env['COOLIFY_APP_ID']}`)
.json();
- const latestVersion = dev ? '10.0.0' : versions['coolify'].main.version;
+ const latestVersion = versions['coolify'].main.version;
const isUpdateAvailable = compare(latestVersion, currentVersion);
return {
body: {
@@ -26,27 +26,11 @@ export const get: RequestHandler = async () => {
};
export const post: RequestHandler = async (event) => {
- const { type, latestVersion } = await event.request.json();
- if (type === 'pull') {
+ const { type, latestVersion, overrideVersion } = await event.request.json();
+ if (type === 'update') {
try {
if (!dev) {
await asyncExecShell(`docker pull coollabsio/coolify:${latestVersion}`);
- return {
- status: 200,
- body: {}
- };
- } else {
- return {
- status: 200,
- body: {}
- };
- }
- } catch (error) {
- return ErrorHandler(error);
- }
- } else if (type === 'update') {
- try {
- if (!dev) {
await asyncExecShell(`env | grep COOLIFY > .env`);
await asyncExecShell(
`docker run --rm -tid --env-file .env -v /var/run/docker.sock:/var/run/docker.sock -v coolify-db coollabsio/coolify:${latestVersion} /bin/sh -c "env | grep COOLIFY > .env && echo 'TAG=${latestVersion}' >> .env && docker stop -t 0 coolify coolify-redis && docker rm coolify coolify-redis && docker compose up -d --force-recreate"`
@@ -66,6 +50,31 @@ export const post: RequestHandler = async (event) => {
} catch (error) {
return ErrorHandler(error);
}
+ } else if (type === 'check') {
+ try {
+ if (overrideVersion) {
+ return {
+ status: 200,
+ body: {
+ exists: true
+ }
+ };
+ }
+ await asyncExecShell(`docker image inspect coollabsio/coolify:${latestVersion}`);
+ return {
+ status: 200,
+ body: {
+ exists: true
+ }
+ };
+ } catch (error) {
+ return {
+ status: 200,
+ body: {
+ exists: false
+ }
+ };
+ }
}
return {
status: 500