mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
fix: disallow backups if data dir doesn't exist
This commit is contained in:
parent
4e65a7b948
commit
c798f067c6
@ -119,9 +119,14 @@ export const createInstanceService = async (config: InstanceServiceConfig) => {
|
||||
api.shutdown()
|
||||
},
|
||||
})
|
||||
|
||||
const { pid } = childProcess
|
||||
assertTruthy(pid, `Expected PID here but got ${pid}`)
|
||||
|
||||
if (!instance.isBackupAllowed) {
|
||||
await client.updateInstance(instance.id, { isBackupAllowed: true })
|
||||
}
|
||||
|
||||
const invocation = await client.createInvocation(instance, pid)
|
||||
const tm = createTimerManager({})
|
||||
const api: InstanceApi = (() => {
|
||||
|
@ -58,44 +58,49 @@
|
||||
<div class="py-4">
|
||||
<h2>Backup</h2>
|
||||
|
||||
<div class="text-center py-5">
|
||||
<button class="btn btn-light" on:click={() => startBackup()} disabled={isBackingUp}>
|
||||
<i class="bi bi-safe" /> Backup Now
|
||||
</button>
|
||||
</div>
|
||||
{#if instance.isBackupAllowed}
|
||||
<div class="text-center py-5">
|
||||
<button class="btn btn-light" on:click={() => startBackup()} disabled={isBackingUp}>
|
||||
<i class="bi bi-safe" /> Backup Now
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{#each $backups as { id, bytes, updated, platform, version, status, message, progress }}
|
||||
<div>
|
||||
{#if status === BackupStatus.FinishedSuccess}
|
||||
<div class="text-success">
|
||||
{platform}:{version} ({prettyBytes(bytes)}) - Finished {new Date(updated)}
|
||||
</div>
|
||||
{/if}
|
||||
{#if status === BackupStatus.FinishedError}
|
||||
<div class="text-danger">
|
||||
{platform}:{version} - Finished {new Date(updated)}
|
||||
<AlertBar icon="bi bi-exclamation-triangle-fill" text={message} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if status !== BackupStatus.FinishedError && status !== BackupStatus.FinishedSuccess}
|
||||
<div class="text-warning">
|
||||
{platform}:{version}
|
||||
{status}
|
||||
{#each Object.entries(progress || {}) as [src, pct]}
|
||||
<div class="badge bg-secondary" style="margin-right: 3px">
|
||||
{src}
|
||||
<code>
|
||||
{Math.ceil(pct * 100)}%
|
||||
</code>
|
||||
</div>
|
||||
{/each}
|
||||
Started {formatDistanceToNow(Date.parse(updated))} ago
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
<div>
|
||||
{#each $backups as { id, bytes, updated, platform, version, status, message, progress }}
|
||||
<div>
|
||||
{#if status === BackupStatus.FinishedSuccess}
|
||||
<div class="text-success">
|
||||
{platform}:{version} ({prettyBytes(bytes)}) - Finished {new Date(updated)}
|
||||
</div>
|
||||
{/if}
|
||||
{#if status === BackupStatus.FinishedError}
|
||||
<div class="text-danger">
|
||||
{platform}:{version} - Finished {new Date(updated)}
|
||||
<AlertBar icon="bi bi-exclamation-triangle-fill" text={message} />
|
||||
</div>
|
||||
{/if}
|
||||
{#if status !== BackupStatus.FinishedError && status !== BackupStatus.FinishedSuccess}
|
||||
<div class="text-warning">
|
||||
{platform}:{version}
|
||||
{status}
|
||||
{#each Object.entries(progress || {}) as [src, pct]}
|
||||
<div class="badge bg-secondary" style="margin-right: 3px">
|
||||
{src}
|
||||
<code>
|
||||
{Math.ceil(pct * 100)}%
|
||||
</code>
|
||||
</div>
|
||||
{/each}
|
||||
Started {formatDistanceToNow(Date.parse(updated))} ago
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{#if !instance.isBackupAllowed}
|
||||
You must access this instance at least once before backups can be made.
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style lang="scss">
|
||||
|
@ -136,13 +136,13 @@ open https://pockethost.io
|
||||
|
||||
**next**
|
||||
|
||||
- [x] fix: incorrect instance information displaying on dashboard details
|
||||
- [x] fix: incorrect instance information displaying on dashboard details in some cases
|
||||
- [x] fix: more helpful error message when backup fails for nonexistent instance
|
||||
- [x] chore: move version number to base package.json
|
||||
- [x] refactor: logging and async helpers
|
||||
- [x] chore: restore auto-cancellation
|
||||
- [x] chore: rebuild with go 1.19.3 and include in bin name
|
||||
- [ ] fix: Disallow backups if data dir doesn't exist
|
||||
- [x] fix: Disallow backups if data dir doesn't exist
|
||||
|
||||
**0.5.2**
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user