dashboard fixes
This commit is contained in:
parent
e0311f9d8f
commit
771b3f67c3
|
|
@ -218,10 +218,9 @@ func remotePathType(ctx context.Context, site store.Site, path string) (string,
|
||||||
|
|
||||||
func pullSQLiteTarget(ctx context.Context, jobID int64, site store.Site, target store.SiteTarget, stageDir string) error {
|
func pullSQLiteTarget(ctx context.Context, jobID int64, site store.Site, target store.SiteTarget, stageDir string) error {
|
||||||
tmpBase := fmt.Sprintf("/tmp/satoru-backup-%d-%s.sqlite3", jobID, shortHash(target.Path))
|
tmpBase := fmt.Sprintf("/tmp/satoru-backup-%d-%s.sqlite3", jobID, shortHash(target.Path))
|
||||||
quotedDB := shellQuote(target.Path)
|
|
||||||
quotedTmp := shellQuote(tmpBase)
|
quotedTmp := shellQuote(tmpBase)
|
||||||
remoteCmd := strings.Join([]string{
|
remoteCmd := strings.Join([]string{
|
||||||
sqliteBackupCommand(quotedDB, quotedTmp),
|
sqliteBackupCommand(target.Path, quotedTmp),
|
||||||
fmt.Sprintf("gzip -f -- %s", quotedTmp),
|
fmt.Sprintf("gzip -f -- %s", quotedTmp),
|
||||||
}, " && ")
|
}, " && ")
|
||||||
if err := sshCheck(ctx, site, remoteCmd); err != nil {
|
if err := sshCheck(ctx, site, remoteCmd); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,7 @@ func sqlitePreflightCheck(ctx context.Context, site store.Site, dbPath string) e
|
||||||
"sqlite3 --version >/dev/null",
|
"sqlite3 --version >/dev/null",
|
||||||
"[ -r " + quoted + " ]",
|
"[ -r " + quoted + " ]",
|
||||||
"tmp=$(mktemp /tmp/satoru-preflight.XXXXXX)",
|
"tmp=$(mktemp /tmp/satoru-preflight.XXXXXX)",
|
||||||
sqliteBackupCommand(quoted, "$tmp"),
|
sqliteBackupCommand(dbPath, "$tmp"),
|
||||||
"rm -f -- \"$tmp\"",
|
"rm -f -- \"$tmp\"",
|
||||||
}, " && ")
|
}, " && ")
|
||||||
return sshCheck(ctx, site, cmd)
|
return sshCheck(ctx, site, cmd)
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,13 @@ const (
|
||||||
sqliteBackupTimeoutMS = 5000
|
sqliteBackupTimeoutMS = 5000
|
||||||
)
|
)
|
||||||
|
|
||||||
func sqliteBackupCommand(quotedDBPath, quotedBackupPath string) string {
|
func sqliteBackupCommand(dbPath, quotedBackupPath string) string {
|
||||||
|
readonlyURI := shellQuote("file:" + dbPath + "?mode=ro")
|
||||||
return fmt.Sprintf(
|
return fmt.Sprintf(
|
||||||
"ok=0; for i in $(seq 1 %d); do sqlite3 -cmd \".timeout %d\" %s \".backup %s\" && ok=1 && break; sleep 1; done; [ \"$ok\" -eq 1 ]",
|
"ok=0; for i in $(seq 1 %d); do sqlite3 -readonly -cmd \".timeout %d\" %s \".backup %s\" && ok=1 && break; sleep 1; done; [ \"$ok\" -eq 1 ]",
|
||||||
sqliteBackupRetryCount,
|
sqliteBackupRetryCount,
|
||||||
sqliteBackupTimeoutMS,
|
sqliteBackupTimeoutMS,
|
||||||
quotedDBPath,
|
readonlyURI,
|
||||||
quotedBackupPath,
|
quotedBackupPath,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ func Dashboard(data DashboardData) templ.Component {
|
||||||
<div class="row split">
|
<div class="row split">
|
||||||
<div>
|
<div>
|
||||||
<p class="eyebrow">Satoru</p>
|
<p class="eyebrow">Satoru</p>
|
||||||
<h1>Managed Sites Overview</h1>
|
<h1>Manage Backups</h1>
|
||||||
<p class="muted">Signed in as <strong>%s</strong> (%s).</p>
|
<p class="muted">Signed in as <strong>%s</strong> (%s).</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue