Compare commits

...

2 Commits

Author SHA1 Message Date
77842647fd v5.0.4
Some checks failed
Docker (tags) / security (push) Failing after 1s
Docker (tags) / test (push) Has been skipped
Docker (tags) / release (push) Has been skipped
Docker (tags) / metadata (push) Has been skipped
2026-02-12 14:20:42 +00:00
a309145829 fix(cache): use user-writable ~/.serve.zone/dcrouter for TsmDB and centralize data path logic 2026-02-12 14:20:42 +00:00
9 changed files with 34 additions and 18 deletions

View File

@@ -1,5 +1,14 @@
# Changelog # Changelog
## 2026-02-12 - 5.0.4 - fix(cache)
use user-writable ~/.serve.zone/dcrouter for TsmDB and centralize data path logic
- Default TsmDB storage changed from /etc/dcrouter/tsmdb to ~/.serve.zone/dcrouter/tsmdb
- Introduced dcrouterHomeDir, dataDir, and defaultTsmDbPath in ts/paths.ts
- CacheDb now defaults to defaultTsmDbPath when no storagePath is provided
- DcRouter initialization updated to use paths.defaultTsmDbPath; README and readme.hints updated to document the new defaults
- Avoids /etc permission issues and prevents starting a real MongoDB process in tests by using a user-writable default path
## 2026-02-12 - 5.0.3 - fix(packaging) ## 2026-02-12 - 5.0.3 - fix(packaging)
add files whitelist to package.json and remove Playwright-generated screenshots add files whitelist to package.json and remove Playwright-generated screenshots

View File

@@ -1,7 +1,7 @@
{ {
"name": "@serve.zone/dcrouter", "name": "@serve.zone/dcrouter",
"private": false, "private": false,
"version": "5.0.3", "version": "5.0.4",
"description": "A multifaceted routing service handling mail and SMS delivery functions.", "description": "A multifaceted routing service handling mail and SMS delivery functions.",
"type": "module", "type": "module",
"exports": { "exports": {

View File

@@ -46,7 +46,7 @@ Source at `../../push.rocks/smartmta`, release with `gitzone commit -ypbrt`
### SmartProxy v23.1.2 Route Validation ### SmartProxy v23.1.2 Route Validation
- SmartProxy 23.1.2 enforces stricter route validation - SmartProxy 23.1.2 enforces stricter route validation
- Forward actions MUST use `targets` (array) instead of `target` (singular) - Forward actions MUST use `targets` (array) instead of `target` (singular)
- Test configurations that call `DcRouter.start()` need `cacheConfig: { enabled: false }` to avoid `/etc/dcrouter` permission errors - Test configurations that call `DcRouter.start()` need `cacheConfig: { enabled: false }` to avoid starting a real MongoDB process in tests
```typescript ```typescript
// WRONG - will fail validation // WRONG - will fail validation
@@ -693,7 +693,7 @@ The configuration UI has been converted from an editable interface to a read-onl
## Smartdata Cache System (2026-02-03) ## Smartdata Cache System (2026-02-03)
### Overview ### Overview
DcRouter now uses smartdata + LocalTsmDb for persistent caching. Data is stored at `/etc/dcrouter/tsmdb`. DcRouter now uses smartdata + LocalTsmDb for persistent caching. Data is stored at `~/.serve.zone/dcrouter/tsmdb`.
### Technology Stack ### Technology Stack
| Layer | Package | Purpose | | Layer | Package | Purpose |
@@ -747,7 +747,7 @@ await email.delete();
const dcRouter = new DcRouter({ const dcRouter = new DcRouter({
cacheConfig: { cacheConfig: {
enabled: true, enabled: true,
storagePath: '/etc/dcrouter/tsmdb', storagePath: '~/.serve.zone/dcrouter/tsmdb',
dbName: 'dcrouter', dbName: 'dcrouter',
cleanupIntervalHours: 1, cleanupIntervalHours: 1,
ttlConfig: { ttlConfig: {

View File

@@ -219,7 +219,7 @@ const router = new DcRouter({
storage: { fsPath: '/var/lib/dcrouter/data' }, storage: { fsPath: '/var/lib/dcrouter/data' },
// Cache database // Cache database
cacheConfig: { enabled: true, storagePath: '/etc/dcrouter/tsmdb' }, cacheConfig: { enabled: true, storagePath: '~/.serve.zone/dcrouter/tsmdb' },
// TLS & ACME // TLS & ACME
tls: { contactEmail: 'admin@example.com' }, tls: { contactEmail: 'admin@example.com' },
@@ -388,7 +388,7 @@ interface IDcRouterOptions {
}; };
cacheConfig?: { cacheConfig?: {
enabled?: boolean; // default: true enabled?: boolean; // default: true
storagePath?: string; // default: '/etc/dcrouter/tsmdb' storagePath?: string; // default: '~/.serve.zone/dcrouter/tsmdb'
dbName?: string; // default: 'dcrouter' dbName?: string; // default: 'dcrouter'
cleanupIntervalHours?: number; // default: 1 cleanupIntervalHours?: number; // default: 1
ttlConfig?: { ttlConfig?: {
@@ -734,7 +734,7 @@ An embedded MongoDB-compatible database (via smartdata + LocalTsmDb) for persist
```typescript ```typescript
cacheConfig: { cacheConfig: {
enabled: true, enabled: true,
storagePath: '/etc/dcrouter/tsmdb', storagePath: '~/.serve.zone/dcrouter/tsmdb',
dbName: 'dcrouter', dbName: 'dcrouter',
cleanupIntervalHours: 1, cleanupIntervalHours: 1,
ttlConfig: { ttlConfig: {

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/dcrouter', name: '@serve.zone/dcrouter',
version: '5.0.3', version: '5.0.4',
description: 'A multifaceted routing service handling mail and SMS delivery functions.' description: 'A multifaceted routing service handling mail and SMS delivery functions.'
} }

View File

@@ -1,11 +1,12 @@
import * as plugins from '../plugins.js'; import * as plugins from '../plugins.js';
import { logger } from '../logger.js'; import { logger } from '../logger.js';
import { defaultTsmDbPath } from '../paths.js';
/** /**
* Configuration options for CacheDb * Configuration options for CacheDb
*/ */
export interface ICacheDbOptions { export interface ICacheDbOptions {
/** Base storage path for TsmDB data (default: /etc/dcrouter/tsmdb) */ /** Base storage path for TsmDB data (default: ~/.serve.zone/dcrouter/tsmdb) */
storagePath?: string; storagePath?: string;
/** Database name (default: dcrouter) */ /** Database name (default: dcrouter) */
dbName?: string; dbName?: string;
@@ -29,7 +30,7 @@ export class CacheDb {
constructor(options: ICacheDbOptions = {}) { constructor(options: ICacheDbOptions = {}) {
this.options = { this.options = {
storagePath: options.storagePath || '/etc/dcrouter/tsmdb', storagePath: options.storagePath || defaultTsmDbPath,
dbName: options.dbName || 'dcrouter', dbName: options.dbName || 'dcrouter',
debug: options.debug || false, debug: options.debug || false,
}; };

View File

@@ -122,7 +122,7 @@ export interface IDcRouterOptions {
cacheConfig?: { cacheConfig?: {
/** Enable cache database (default: true) */ /** Enable cache database (default: true) */
enabled?: boolean; enabled?: boolean;
/** Storage path for TsmDB data (default: /etc/dcrouter/tsmdb) */ /** Storage path for TsmDB data (default: ~/.serve.zone/dcrouter/tsmdb) */
storagePath?: string; storagePath?: string;
/** Database name (default: dcrouter) */ /** Database name (default: dcrouter) */
dbName?: string; dbName?: string;
@@ -349,7 +349,7 @@ export class DcRouter {
// Initialize CacheDb singleton // Initialize CacheDb singleton
this.cacheDb = CacheDb.getInstance({ this.cacheDb = CacheDb.getInstance({
storagePath: cacheConfig.storagePath || '/etc/dcrouter/tsmdb', storagePath: cacheConfig.storagePath || paths.defaultTsmDbPath,
dbName: cacheConfig.dbName || 'dcrouter', dbName: cacheConfig.dbName || 'dcrouter',
debug: false, debug: false,
}); });

View File

@@ -8,11 +8,17 @@ export const packageDir = plugins.path.join(
); );
export const distServe = plugins.path.join(packageDir, './dist_serve'); export const distServe = plugins.path.join(packageDir, './dist_serve');
// Configure data directory with environment variable or default to .nogit/data // Default base for all dcrouter data (always user-writable)
const DEFAULT_DATA_PATH = '.nogit/data'; export const dcrouterHomeDir = plugins.path.join(plugins.os.homedir(), '.serve.zone', 'dcrouter');
// Configure data directory with environment variable or default to ~/.serve.zone/dcrouter/data
const DEFAULT_DATA_PATH = plugins.path.join(dcrouterHomeDir, 'data');
export const dataDir = process.env.DATA_DIR export const dataDir = process.env.DATA_DIR
? process.env.DATA_DIR ? process.env.DATA_DIR
: plugins.path.join(baseDir, DEFAULT_DATA_PATH); : DEFAULT_DATA_PATH;
// Default TsmDB path for CacheDb
export const defaultTsmDbPath = plugins.path.join(dcrouterHomeDir, 'tsmdb');
// MTA directories // MTA directories
export const keysDir = plugins.path.join(dataDir, 'keys'); export const keysDir = plugins.path.join(dataDir, 'keys');

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@serve.zone/dcrouter', name: '@serve.zone/dcrouter',
version: '5.0.3', version: '5.0.4',
description: 'A multifaceted routing service handling mail and SMS delivery functions.' description: 'A multifaceted routing service handling mail and SMS delivery functions.'
} }