mirror of
https://github.com/cupcakearmy/coolify.git
synced 2024-10-22 16:14:22 +02:00
feat: rollback coolify
This commit is contained in:
parent
e94f450bf0
commit
bd4ce3ac45
@ -17,7 +17,7 @@ import { day } from './dayjs';
|
||||
import { saveBuildLog } from './buildPacks/common';
|
||||
import { scheduler } from './scheduler';
|
||||
|
||||
export const version = '3.11.4';
|
||||
export const version = '3.11.5';
|
||||
export const isDev = process.env.NODE_ENV === 'development';
|
||||
|
||||
const algorithm = 'aes-256-ctr';
|
||||
|
@ -16,9 +16,11 @@
|
||||
updateStatus.loading = true;
|
||||
try {
|
||||
if (dev) {
|
||||
await asyncSleep(4000);
|
||||
localStorage.setItem('lastVersion', $appSession.version);
|
||||
await asyncSleep(1000);
|
||||
return window.location.reload();
|
||||
} else {
|
||||
localStorage.setItem('lastVersion', $appSession.version);
|
||||
await post(`/update`, { type: 'update', latestVersion });
|
||||
addToast({
|
||||
message: 'Update completed.<br><br>Waiting for the new version to start...',
|
||||
|
@ -24,6 +24,7 @@
|
||||
import { addToast, appSession, features } from '$lib/store';
|
||||
import { asyncSleep, errorNotification, getDomain } from '$lib/common';
|
||||
import Explainer from '$lib/components/Explainer.svelte';
|
||||
import { dev } from '$app/env';
|
||||
|
||||
let isAPIDebuggingEnabled = settings.isAPIDebuggingEnabled;
|
||||
let isRegistrationEnabled = settings.isRegistrationEnabled;
|
||||
@ -47,7 +48,50 @@
|
||||
proxyMigration: false,
|
||||
restart: false
|
||||
};
|
||||
let rollbackVersion = localStorage.getItem('lastVersion');
|
||||
|
||||
async function rollback() {
|
||||
const sure = confirm(`Are you sure you want rollback Coolify to ${rollbackVersion}?`);
|
||||
if (sure) {
|
||||
try {
|
||||
if (dev) {
|
||||
console.log('rolling back to', rollbackVersion);
|
||||
await asyncSleep(4000);
|
||||
return window.location.reload();
|
||||
} else {
|
||||
await post(`/update`, { type: 'update', latestVersion: rollbackVersion });
|
||||
addToast({
|
||||
message: 'Update completed.<br><br>Waiting for the new version to start...',
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
let reachable = false;
|
||||
let tries = 0;
|
||||
do {
|
||||
await asyncSleep(4000);
|
||||
try {
|
||||
await get(`/undead`);
|
||||
reachable = true;
|
||||
} catch (error) {
|
||||
reachable = false;
|
||||
}
|
||||
if (reachable) break;
|
||||
tries++;
|
||||
} while (!reachable || tries < 120);
|
||||
addToast({
|
||||
message: 'New version reachable. Reloading...',
|
||||
type: 'success'
|
||||
});
|
||||
await asyncSleep(3000);
|
||||
return window.location.reload();
|
||||
}
|
||||
} catch (error) {
|
||||
return errorNotification(error);
|
||||
} finally {
|
||||
loading.remove = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
async function removeFqdn() {
|
||||
if (fqdn) {
|
||||
loading.remove = true;
|
||||
@ -281,6 +325,17 @@
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="grid grid-cols-2 items-center">
|
||||
<Setting
|
||||
id="dualCerts"
|
||||
dataTooltip={$t('setting.must_remove_domain_before_changing')}
|
||||
disabled={isFqdnSet}
|
||||
bind:setting={dualCerts}
|
||||
title={$t('application.ssl_www_and_non_www')}
|
||||
description={$t('setting.generate_www_non_www_ssl')}
|
||||
on:click={() => !isFqdnSet && changeSettings('dualCerts')}
|
||||
/>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 items-center">
|
||||
<div>
|
||||
Default Redirect URL
|
||||
@ -300,17 +355,25 @@
|
||||
placeholder="{$t('forms.eg')}: https://coolify.io"
|
||||
/>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 items-center">
|
||||
<Setting
|
||||
id="dualCerts"
|
||||
dataTooltip={$t('setting.must_remove_domain_before_changing')}
|
||||
disabled={isFqdnSet}
|
||||
bind:setting={dualCerts}
|
||||
title={$t('application.ssl_www_and_non_www')}
|
||||
description={$t('setting.generate_www_non_www_ssl')}
|
||||
on:click={() => !isFqdnSet && changeSettings('dualCerts')}
|
||||
|
||||
<div class="grid grid-cols-4 items-center">
|
||||
<div class="col-span-2">
|
||||
Rollback to a specific version
|
||||
<Explainer
|
||||
position="dropdown-bottom"
|
||||
explanation="You can rollback to a specific version of your application. This will not affect your current running resources. <a href='https://github.com/coollabsio/coolify/releases' target='_blank'>See available versions</a>"
|
||||
/>
|
||||
</div>
|
||||
<input
|
||||
class="w-full"
|
||||
bind:value={rollbackVersion}
|
||||
readonly={!$appSession.isAdmin}
|
||||
disabled={!$appSession.isAdmin}
|
||||
name="lastVersion"
|
||||
id="lastVersion"
|
||||
/>
|
||||
<button class="btn btn-primary ml-2" on:click|preventDefault|stopPropagation={rollback}>Rollback</button>
|
||||
</div>
|
||||
<div class="grid grid-cols-2 items-center">
|
||||
<div>
|
||||
{$t('forms.public_port_range')}
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coolify",
|
||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||
"version": "3.11.4",
|
||||
"version": "3.11.5",
|
||||
"license": "Apache-2.0",
|
||||
"repository": "github:coollabsio/coolify",
|
||||
"scripts": {
|
||||
|
Loading…
Reference in New Issue
Block a user