Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62a37b677a | ||
|
|
4dba0475c7 |
No files matched your search
@@ -200,9 +200,10 @@ A push to `main` is a release, as for thukthuk and lampbench-web: once the
|
||||
checks pass, CI builds the server on Ubuntu 22.04, signs it with a key only
|
||||
CI holds (the repository secret `RELEASE_SIGNING_KEY`; its public half is
|
||||
`release/allowed-signers`) and publishes it as the next release, named by
|
||||
date (2026.11.0, 2026.11.1, ...). cnx01 looks every 15 minutes, installs a
|
||||
release only with that signature, and restarts the app on it; migrations
|
||||
run at that start. So `main` must stay deployable. On cnx01,
|
||||
date (2026.11.0, 2026.11.1, ...). The release's webhook tells cnx01 at once
|
||||
(the fleet's `hooks.cnx.network/hooks/visa-release`), and it also looks
|
||||
every 15 minutes; it installs a release only with that signature, and
|
||||
restarts the app on it; migrations run at that start. So `main` must stay deployable. On cnx01,
|
||||
`visa-releases status` shows what runs, and `visa-releases rollback` goes
|
||||
back one release and holds it until `visa-releases unpin`; a rollback does
|
||||
not undo a migration. The fleet's VM test `checks.visa` signs in through a
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ The first round of questions was answered on November 17, 2026.
|
||||
| Question | Decision |
|
||||
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| Where it runs | cnx01, installed on the host like proplan and lampbench: database `visa` on cnx01's PostgreSQL, documents in its Garage, encrypted by the app, borg backups to juliet |
|
||||
| Releases (Nov 20) | as thukthuk and lampbench-web: every push to main that passes CI becomes a signed release (CalVer), which cnx01 fetches and restarts on within 15 minutes; no fleet PR per release |
|
||||
| Releases (Nov 20) | as thukthuk and lampbench-web: every push to main that passes CI becomes a signed release (CalVer), which cnx01 fetches and restarts on at once (the release webhook, since Nov 23; the 15-minute timer as backstop); no fleet PR per release |
|
||||
| Documents in Garage | bucket `visa-documents` on cnx01's Garage, 10 GB (Nov 19, 2026); the app encrypts each file before it leaves the app, so Garage holds no key; Garage's SSE-C is off |
|
||||
| How it is published | bkk01 publishes `app.lannadesk.com` through a `modules/web-sites` app entry; `visa.buildfor.life` and the app's paths on `lannadesk.com` redirect there |
|
||||
| Login | Kanidm at id.cnx.network, OAuth2 client `visa-web`, group `visa` with grabowski and oltmanns |
|
||||
|
||||
+9
-4
@@ -319,12 +319,16 @@ pub async fn run_daily(cfg: &Config, db: &PgPool, now: DateTime<Utc>) -> Result<
|
||||
if cfg.mail.is_none() {
|
||||
return Ok(None);
|
||||
}
|
||||
// one server sends: the lock keeps two runs from both sending
|
||||
// one server sends: the lock keeps two runs from both sending. Every
|
||||
// way out ends the transaction itself: a dropped one is only rolled
|
||||
// back when its connection is used again, and until then it keeps the
|
||||
// lock, so the next run would find it taken and skip the day.
|
||||
let mut tx = db.begin().await?;
|
||||
let locked: bool = sqlx::query_scalar("SELECT pg_try_advisory_xact_lock(7464530001)")
|
||||
.fetch_one(&mut *tx)
|
||||
.await?;
|
||||
if !locked {
|
||||
tx.rollback().await?;
|
||||
return Ok(None);
|
||||
}
|
||||
let today = now.with_timezone(&dates::bangkok()).date_naive();
|
||||
@@ -334,11 +338,12 @@ pub async fn run_daily(cfg: &Config, db: &PgPool, now: DateTime<Utc>) -> Result<
|
||||
.fetch_all(db)
|
||||
.await?;
|
||||
if !due(now, &rows) {
|
||||
tx.rollback().await?;
|
||||
return Ok(None);
|
||||
}
|
||||
let out = send(cfg, db, true, "daily anchor", now).await?;
|
||||
tx.commit().await?;
|
||||
Ok(Some(out))
|
||||
let out = send(cfg, db, true, "daily anchor", now).await;
|
||||
tx.rollback().await?;
|
||||
Ok(Some(out?))
|
||||
}
|
||||
|
||||
/// Checks every ten minutes whether the day's anchor is due.
|
||||
|
||||
@@ -289,6 +289,19 @@ async fn the_journal_anchor_goes_out_daily_and_checks_later(pool: PgPool) {
|
||||
.unwrap()
|
||||
.is_none()
|
||||
);
|
||||
// a run that sends nothing lets go of its lock before it returns, as a
|
||||
// connection of its own (another run's) sees it
|
||||
let mut other = <sqlx::PgConnection as sqlx::Connection>::connect_with(&pool.connect_options())
|
||||
.await
|
||||
.unwrap();
|
||||
let held: i64 = sqlx::query_scalar(
|
||||
"SELECT count(*) FROM pg_locks WHERE locktype = 'advisory' \
|
||||
AND database = (SELECT oid FROM pg_database WHERE datname = current_database())",
|
||||
)
|
||||
.fetch_one(&mut other)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(held, 0, "the anchor's lock is still held");
|
||||
let out = visa::anchor::run_daily(&cfg, &pool, cm(0, 7, 5))
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Reference in new issue
Block a user