feat: rollback coolify

This commit is contained in:
Andras Bacsai 2022-11-10 13:57:34 +01:00
parent e94f450bf0
commit bd4ce3ac45
4 changed files with 77 additions and 12 deletions

View File

@ -17,7 +17,7 @@ import { day } from './dayjs';
import { saveBuildLog } from './buildPacks/common'; import { saveBuildLog } from './buildPacks/common';
import { scheduler } from './scheduler'; import { scheduler } from './scheduler';
export const version = '3.11.4'; export const version = '3.11.5';
export const isDev = process.env.NODE_ENV === 'development'; export const isDev = process.env.NODE_ENV === 'development';
const algorithm = 'aes-256-ctr'; const algorithm = 'aes-256-ctr';

View File

@ -16,9 +16,11 @@
updateStatus.loading = true; updateStatus.loading = true;
try { try {
if (dev) { if (dev) {
await asyncSleep(4000); localStorage.setItem('lastVersion', $appSession.version);
await asyncSleep(1000);
return window.location.reload(); return window.location.reload();
} else { } else {
localStorage.setItem('lastVersion', $appSession.version);
await post(`/update`, { type: 'update', latestVersion }); await post(`/update`, { type: 'update', latestVersion });
addToast({ addToast({
message: 'Update completed.<br><br>Waiting for the new version to start...', message: 'Update completed.<br><br>Waiting for the new version to start...',

View File

@ -24,6 +24,7 @@
import { addToast, appSession, features } from '$lib/store'; import { addToast, appSession, features } from '$lib/store';
import { asyncSleep, errorNotification, getDomain } from '$lib/common'; import { asyncSleep, errorNotification, getDomain } from '$lib/common';
import Explainer from '$lib/components/Explainer.svelte'; import Explainer from '$lib/components/Explainer.svelte';
import { dev } from '$app/env';
let isAPIDebuggingEnabled = settings.isAPIDebuggingEnabled; let isAPIDebuggingEnabled = settings.isAPIDebuggingEnabled;
let isRegistrationEnabled = settings.isRegistrationEnabled; let isRegistrationEnabled = settings.isRegistrationEnabled;
@ -47,7 +48,50 @@
proxyMigration: false, proxyMigration: false,
restart: 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() { async function removeFqdn() {
if (fqdn) { if (fqdn) {
loading.remove = true; loading.remove = true;
@ -281,6 +325,17 @@
</div> </div>
{/if} {/if}
</div> </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 class="grid grid-cols-2 items-center">
<div> <div>
Default Redirect URL Default Redirect URL
@ -300,16 +355,24 @@
placeholder="{$t('forms.eg')}: https://coolify.io" placeholder="{$t('forms.eg')}: https://coolify.io"
/> />
</div> </div>
<div class="grid grid-cols-2 items-center">
<Setting <div class="grid grid-cols-4 items-center">
id="dualCerts" <div class="col-span-2">
dataTooltip={$t('setting.must_remove_domain_before_changing')} Rollback to a specific version
disabled={isFqdnSet} <Explainer
bind:setting={dualCerts} position="dropdown-bottom"
title={$t('application.ssl_www_and_non_www')} 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>"
description={$t('setting.generate_www_non_www_ssl')} />
on:click={() => !isFqdnSet && changeSettings('dualCerts')} </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>
<div class="grid grid-cols-2 items-center"> <div class="grid grid-cols-2 items-center">
<div> <div>

View File

@ -1,7 +1,7 @@
{ {
"name": "coolify", "name": "coolify",
"description": "An open-source & self-hostable Heroku / Netlify alternative.", "description": "An open-source & self-hostable Heroku / Netlify alternative.",
"version": "3.11.4", "version": "3.11.5",
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": "github:coollabsio/coolify", "repository": "github:coollabsio/coolify",
"scripts": { "scripts": {