Rename Castle Accounting extension to Libra
Full identifier rename: module path lnbits.extensions.castle →
lnbits.extensions.libra, DB ext_castle → ext_libra, URL prefix
/castle/ → /libra/, manifest id castle → libra, fava ledger slug
default castle-ledger → libra-ledger, Beancount source metadata
castle-api → libra-api and link prefixes castle-{entry,tx}- →
libra-{entry,tx}-, column castle_wallet_id → libra_wallet_id, all
Python/JS/HTML identifiers (castle_ext, CastleSettings,
castle_reference, castleWalletConfigured, etc.).
Display name "Castle Accounting" → "Libra" (the scales/balance
metaphor — fits double-entry bookkeeping).
No backward compat: production hosts will be force-updated. Old
castle-prefixed Beancount metadata in existing Fava ledgers is
historical; new entries use libra-* prefixes going forward.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c577c740c
commit
c174cda48d
44 changed files with 953 additions and 953 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Automated Daily Reconciliation
|
||||
|
||||
The Castle extension includes automated daily balance checking to ensure accounting accuracy.
|
||||
The Libra extension includes automated daily balance checking to ensure accounting accuracy.
|
||||
|
||||
## Overview
|
||||
|
||||
|
|
@ -16,7 +16,7 @@ You can manually trigger the reconciliation check from the UI or via API:
|
|||
|
||||
### Via API
|
||||
```bash
|
||||
curl -X POST https://your-lnbits-instance.com/castle/api/v1/tasks/daily-reconciliation \
|
||||
curl -X POST https://your-lnbits-instance.com/libra/api/v1/tasks/daily-reconciliation \
|
||||
-H "X-Api-Key: YOUR_ADMIN_KEY"
|
||||
```
|
||||
|
||||
|
|
@ -28,7 +28,7 @@ Add to your crontab:
|
|||
|
||||
```bash
|
||||
# Run daily at 2 AM
|
||||
0 2 * * * curl -X POST http://localhost:5000/castle/api/v1/tasks/daily-reconciliation -H "X-Api-Key: YOUR_ADMIN_KEY" >> /var/log/castle-reconciliation.log 2>&1
|
||||
0 2 * * * curl -X POST http://localhost:5000/libra/api/v1/tasks/daily-reconciliation -H "X-Api-Key: YOUR_ADMIN_KEY" >> /var/log/libra-reconciliation.log 2>&1
|
||||
```
|
||||
|
||||
To edit crontab:
|
||||
|
|
@ -38,22 +38,22 @@ crontab -e
|
|||
|
||||
### Option 2: Systemd Timer
|
||||
|
||||
Create `/etc/systemd/system/castle-reconciliation.service`:
|
||||
Create `/etc/systemd/system/libra-reconciliation.service`:
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Castle Daily Reconciliation Check
|
||||
Description=Libra Daily Reconciliation Check
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=lnbits
|
||||
ExecStart=/usr/bin/curl -X POST http://localhost:5000/castle/api/v1/tasks/daily-reconciliation -H "X-Api-Key: YOUR_ADMIN_KEY"
|
||||
ExecStart=/usr/bin/curl -X POST http://localhost:5000/libra/api/v1/tasks/daily-reconciliation -H "X-Api-Key: YOUR_ADMIN_KEY"
|
||||
```
|
||||
|
||||
Create `/etc/systemd/system/castle-reconciliation.timer`:
|
||||
Create `/etc/systemd/system/libra-reconciliation.timer`:
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Run Castle reconciliation daily
|
||||
Description=Run Libra reconciliation daily
|
||||
|
||||
[Timer]
|
||||
OnCalendar=daily
|
||||
|
|
@ -66,8 +66,8 @@ WantedBy=timers.target
|
|||
|
||||
Enable and start:
|
||||
```bash
|
||||
sudo systemctl enable castle-reconciliation.timer
|
||||
sudo systemctl start castle-reconciliation.timer
|
||||
sudo systemctl enable libra-reconciliation.timer
|
||||
sudo systemctl start libra-reconciliation.timer
|
||||
```
|
||||
|
||||
### Option 3: Docker/Kubernetes CronJob
|
||||
|
|
@ -78,7 +78,7 @@ For containerized deployments:
|
|||
apiVersion: batch/v1
|
||||
kind: CronJob
|
||||
metadata:
|
||||
name: castle-reconciliation
|
||||
name: libra-reconciliation
|
||||
spec:
|
||||
schedule: "0 2 * * *" # Daily at 2 AM
|
||||
jobTemplate:
|
||||
|
|
@ -91,7 +91,7 @@ spec:
|
|||
args:
|
||||
- /bin/sh
|
||||
- -c
|
||||
- curl -X POST http://lnbits:5000/castle/api/v1/tasks/daily-reconciliation -H "X-Api-Key: ${ADMIN_KEY}"
|
||||
- curl -X POST http://lnbits:5000/libra/api/v1/tasks/daily-reconciliation -H "X-Api-Key: ${ADMIN_KEY}"
|
||||
restartPolicy: OnFailure
|
||||
```
|
||||
|
||||
|
|
@ -129,7 +129,7 @@ The endpoint returns:
|
|||
grep CRON /var/log/syslog
|
||||
|
||||
# View custom log (if using cron with redirect)
|
||||
tail -f /var/log/castle-reconciliation.log
|
||||
tail -f /var/log/libra-reconciliation.log
|
||||
```
|
||||
|
||||
### Success Criteria
|
||||
|
|
@ -142,7 +142,7 @@ tail -f /var/log/castle-reconciliation.log
|
|||
|
||||
If `failed > 0`:
|
||||
1. Check the `failed_assertions` array for details
|
||||
2. Investigate discrepancies in the Castle UI
|
||||
2. Investigate discrepancies in the Libra UI
|
||||
3. Review recent transactions
|
||||
4. Check for data entry errors
|
||||
5. Verify exchange rate conversions (for fiat)
|
||||
|
|
@ -172,7 +172,7 @@ Planned features:
|
|||
|
||||
3. **Check network connectivity**:
|
||||
```bash
|
||||
curl http://localhost:5000/castle/api/v1/reconciliation/summary -H "X-Api-Key: YOUR_KEY"
|
||||
curl http://localhost:5000/libra/api/v1/reconciliation/summary -H "X-Api-Key: YOUR_KEY"
|
||||
```
|
||||
|
||||
### Permission Denied
|
||||
|
|
@ -202,31 +202,31 @@ Planned features:
|
|||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
# setup-castle-reconciliation.sh
|
||||
# setup-libra-reconciliation.sh
|
||||
|
||||
# Configuration
|
||||
LNBITS_URL="http://localhost:5000"
|
||||
ADMIN_KEY="your_admin_key_here"
|
||||
LOG_FILE="/var/log/castle-reconciliation.log"
|
||||
LOG_FILE="/var/log/libra-reconciliation.log"
|
||||
|
||||
# Create log file
|
||||
touch "$LOG_FILE"
|
||||
chmod 644 "$LOG_FILE"
|
||||
|
||||
# Add cron job
|
||||
(crontab -l 2>/dev/null; echo "0 2 * * * curl -X POST $LNBITS_URL/castle/api/v1/tasks/daily-reconciliation -H 'X-Api-Key: $ADMIN_KEY' >> $LOG_FILE 2>&1") | crontab -
|
||||
(crontab -l 2>/dev/null; echo "0 2 * * * curl -X POST $LNBITS_URL/libra/api/v1/tasks/daily-reconciliation -H 'X-Api-Key: $ADMIN_KEY' >> $LOG_FILE 2>&1") | crontab -
|
||||
|
||||
echo "Daily reconciliation scheduled for 2 AM"
|
||||
echo "Logs will be written to: $LOG_FILE"
|
||||
|
||||
# Test the endpoint
|
||||
echo "Running test reconciliation..."
|
||||
curl -X POST "$LNBITS_URL/castle/api/v1/tasks/daily-reconciliation" \
|
||||
curl -X POST "$LNBITS_URL/libra/api/v1/tasks/daily-reconciliation" \
|
||||
-H "X-Api-Key: $ADMIN_KEY"
|
||||
```
|
||||
|
||||
Make executable and run:
|
||||
```bash
|
||||
chmod +x setup-castle-reconciliation.sh
|
||||
./setup-castle-reconciliation.sh
|
||||
chmod +x setup-libra-reconciliation.sh
|
||||
./setup-libra-reconciliation.sh
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue