Hardened systemd deployment contract for read-only Monero observer
This commit is contained in:
+10
-3
@@ -9,7 +9,8 @@ import { PostgresCustody } from '../server/market/postgres-custody.ts';
|
||||
import { IS_MAINNET } from '../shared/network.ts';
|
||||
import { resolveCustodyIncident } from '../server/market/custody-incident.ts';
|
||||
import { loadMoneroDepositReviewApproval, loadMoneroDepositReviewPolicy } from '../server/market/monero-deposit-review-config.ts';
|
||||
import { assertCustodyDbActionAllowedOnNetwork, parseCustodyDbArguments } from '../server/market/custody-db-args.ts';
|
||||
import { assertCustodyDbActionAllowedOnNetwork, assertMainnetSchemaMigrationAcknowledged,
|
||||
parseCustodyDbArguments } from '../server/market/custody-db-args.ts';
|
||||
import { prepareDepositCreditReview, postReviewedDepositPendingCredit, prepareDepositCreditReleaseReview,
|
||||
releaseReviewedDepositCredit, reconcileDepositCreditReorgHolds, prepareDepositReorgResolution,
|
||||
resolveReleasedDepositReorgHold, type DepositCreditApproval, type DepositCreditReleaseApproval,
|
||||
@@ -19,10 +20,11 @@ import { prepareDepositCreditReview, postReviewedDepositPendingCredit, prepareDe
|
||||
const commandArgs = process.argv.slice(2);
|
||||
const depositActions = ['deposit-prepare-credit', 'deposit-stage-credit', 'deposit-prepare-release', 'deposit-release',
|
||||
'deposit-reconcile-holds', 'deposit-prepare-resolve-hold', 'deposit-resolve-hold'];
|
||||
const custodyActions = ['migrate', 'grant-runtime', 'grant-monero-observer-runtime', 'grant-monero-credit-runtime',
|
||||
const custodyActions = ['migrate', 'migrate-mainnet-schema', 'grant-runtime', 'grant-monero-observer-runtime', 'grant-monero-credit-runtime',
|
||||
'import-sqlite', 'audit', 'resolve-integrity'];
|
||||
const { action, argument, extraArgument } = parseCustodyDbArguments(commandArgs);
|
||||
assertCustodyDbActionAllowedOnNetwork(action, IS_MAINNET);
|
||||
assertMainnetSchemaMigrationAcknowledged(action, process.env.WIKIDECK_MAINNET_SCHEMA_MIGRATION);
|
||||
if (!custodyActions.includes(action) && !depositActions.includes(action)) throw new Error('Unsupported custody operation');
|
||||
try {
|
||||
const config = await postgresConfig();
|
||||
@@ -32,7 +34,12 @@ try {
|
||||
} else {
|
||||
const pool = new Pool(config);
|
||||
try {
|
||||
if (action === 'migrate') { await migrateCustody(pool); console.log('Custody PostgreSQL schema verified/migrated. No funds activated.'); }
|
||||
if (action === 'migrate' || action === 'migrate-mainnet-schema') {
|
||||
await migrateCustody(pool);
|
||||
console.log(action === 'migrate-mainnet-schema'
|
||||
? 'Mainnet custody schema verified/migrated; no runtime grants, deposits, or payments enabled.'
|
||||
: 'Custody PostgreSQL schema verified/migrated. No funds activated.');
|
||||
}
|
||||
if (action === 'grant-runtime') { await grantCustodyRuntime(pool, argument ?? ''); console.log('Runtime grants applied; no credentials printed.'); }
|
||||
if (action === 'grant-monero-observer-runtime') {
|
||||
await grantMoneroObserverRuntime(pool, argument ?? '');
|
||||
|
||||
Reference in New Issue
Block a user