Skip to content

Commit 70271be

Browse files
Move cron tick inside app server (#104)
* feat: Move cron tick to internal app server scheduler This change integrates the cron tick logic into the app server, removing external dependencies and enabling more frequent task processing. Co-authored-by: pierre <pierre@bazoge.com> * Refactor: Analyze and decide on scheduler merge strategy Co-authored-by: pierre <pierre@bazoge.com> * Refactor: Remove external cron and use internal scheduler Co-authored-by: pierre <pierre@bazoge.com> * Refactor: Move cron tick inside app server, keep endpoints Co-authored-by: pierre <pierre@bazoge.com> * Refactor: Remove external cron, use internal scheduler Co-authored-by: pierre <pierre@bazoge.com> * Refactor: Update README to link to full documentation Co-authored-by: pierre <pierre@bazoge.com> * Refactor README to link to external documentation Co-authored-by: pierre <pierre@bazoge.com> * feat: Implement internal task scheduler Removes the need for external cron jobs by integrating a task scheduler directly into the application. This improves reliability and simplifies setup. Co-authored-by: pierre <pierre@bazoge.com> * test: Add mock for Info logging in task handler Co-authored-by: pierre <pierre@bazoge.com> * Refactor: Introduce TaskExecutor interface for TaskScheduler This change decouples the TaskScheduler from the specific TaskService implementation by introducing a TaskExecutor interface. This allows for greater flexibility and testability. Unit tests have been added to cover the new interface and scheduler behavior. Co-authored-by: pierre <pierre@bazoge.com> * feat: Implement internal task scheduler Replaces external cron job with an internal background scheduler for improved performance and simplified deployment. Co-authored-by: pierre <pierre@bazoge.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 7c490f0 commit 70271be

File tree

14 files changed

+2785
-275
lines changed

14 files changed

+2785
-275
lines changed

CHANGELOG.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [14.0] - 2025-10-26
5+
## [14.0] - 2025-10-30
66

77
### Database Schema Changes
88
- Added `channel_options` JSONB column to `message_history` table
@@ -11,6 +11,11 @@ All notable changes to this project will be documented in this file.
1111
- JSONB structure allows future SMS/push options without schema changes
1212

1313
### Features
14+
- **Internal Task Scheduler**: Tasks now execute automatically every 30 seconds
15+
- No external cron job required
16+
- Configurable via `TASK_SCHEDULER_ENABLED`, `TASK_SCHEDULER_INTERVAL`, `TASK_SCHEDULER_MAX_TASKS`
17+
- Starts automatically with the app, stops gracefully on shutdown
18+
- Faster task processing (30s vs 60s minimum with external cron)
1419
- Message history now stores email delivery options:
1520
- CC (carbon copy recipients)
1621
- BCC (blind carbon copy recipients)
@@ -19,6 +24,15 @@ All notable changes to this project will be documented in this file.
1924
- Message preview drawer displays email delivery options when present
2025
- Only stores email options in this version (SMS/push to be added later)
2126

27+
### UI Changes
28+
- Removed cron setup instructions from setup wizard
29+
- Removed cron status warning banner from workspace layout
30+
- Simpler onboarding experience - no manual cron configuration needed
31+
32+
### Deprecated (kept for backward compatibility)
33+
- `/api/cron` HTTP endpoint (internal scheduler is now primary)
34+
- `/api/cron.status` HTTP endpoint (still functional but not advertised)
35+
2236
### Fixes
2337
- Fix: SMTP now supports unauthenticated/anonymous connections (e.g., local mail relays on port 25)
2438
- Magic code emails, workspace invitations, and circuit breaker alerts now work without SMTP credentials

README.md

Lines changed: 3 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -80,99 +80,11 @@ Notifuse follows clean architecture principles with clear separation of concerns
8080
└── config/ # Configuration files
8181
```
8282

83-
## 🚀 Getting Started
83+
## 🚀 Installation
8484

85-
### One-click deployment
85+
For installation instructions, configuration options, and deployment guides, see:
8686

87-
[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/aBzOMu?referralCode=73Ps3m)
88-
89-
### Quick Start with Docker Compose
90-
91-
1. **Clone the repository**:
92-
93-
```bash
94-
git clone https://github.com/Notifuse/notifuse.git
95-
cd notifuse
96-
```
97-
98-
2. **Configure required environment variables**:
99-
100-
```bash
101-
cp env.example .env
102-
# Edit .env with database credentials and SECRET_KEY
103-
```
104-
105-
**Minimum required variables**: `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD`, `SECRET_KEY`
106-
107-
3. **Start the services**:
108-
109-
```bash
110-
docker-compose up -d
111-
```
112-
113-
4. **Access the application and complete setup**:
114-
- Open http://localhost:8080
115-
- Follow the interactive **Setup Wizard** to configure:
116-
- Root administrator email
117-
- API endpoint
118-
- SMTP settings
119-
- PASETO keys (automatically generated)
120-
- Save the generated keys securely!
121-
122-
**Alternative**: You can skip the setup wizard by pre-configuring all environment variables in your `.env` file. Generate PASETO keys at [paseto.notifuse.com](https://paseto.notifuse.com) or use `make keygen`.
123-
124-
### Environment Configuration
125-
126-
**⚠️ Important**: The included `docker-compose.yml` is designed for **testing and development only**. For production deployments:
127-
128-
- **Use a separate PostgreSQL database** (managed service recommended)
129-
- **Configure external storage** for file uploads
130-
- **Set up proper SSL/TLS termination**
131-
- **Use a reverse proxy** (nginx, Traefik, etc.)
132-
133-
#### Development Setup
134-
135-
The docker-compose includes a PostgreSQL container for quick testing. Simply run `docker-compose up -d` to get started, then complete the setup wizard in your browser.
136-
137-
#### Production Setup
138-
139-
**Required Environment Variables:**
140-
141-
- `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD` - External PostgreSQL database
142-
- `SECRET_KEY` - Secret key for encrypting sensitive data (or `PASETO_PRIVATE_KEY` as fallback)
143-
- `DB_SSLMODE=require` - For secure database connections
144-
145-
**Optional (can be configured via Setup Wizard or environment variables):**
146-
147-
- `ROOT_EMAIL` - Root administrator email
148-
- `API_ENDPOINT` - Public API endpoint URL
149-
- `PASETO_PRIVATE_KEY`, `PASETO_PUBLIC_KEY` - Authentication keys (auto-generated in wizard)
150-
- `SMTP_HOST`, `SMTP_PORT`, `SMTP_USERNAME`, `SMTP_PASSWORD` - Email provider settings
151-
- `SMTP_FROM_EMAIL`, `SMTP_FROM_NAME` - From address and name
152-
153-
**Database Connection Management:**
154-
155-
Notifuse uses a smart connection pooling system to efficiently manage database connections across unlimited workspaces:
156-
157-
- `DB_MAX_CONNECTIONS=100` - Total maximum connections across all databases (default: 100)
158-
- `DB_MAX_CONNECTIONS_PER_DB=3` - Max connections per workspace database (default: 3)
159-
- `DB_CONNECTION_MAX_LIFETIME=10m` - Maximum lifetime of a connection (default: 10m)
160-
- `DB_CONNECTION_MAX_IDLE_TIME=5m` - Maximum idle time before closing (default: 5m)
161-
162-
**Connection Capacity:**
163-
- With default settings (100 max, 3 per DB), supports ~30 concurrent active workspace databases
164-
- Total workspaces supported: **unlimited** (100, 500, 1000+)
165-
- Idle workspace connections are automatically closed (LRU eviction)
166-
- Monitor real-time connection usage via `/api/admin.connectionStats`
167-
168-
**Tuning Guidelines:**
169-
- Set `DB_MAX_CONNECTIONS` to 80-90% of your PostgreSQL `max_connections` setting
170-
- Lower `DB_MAX_CONNECTIONS_PER_DB` (to 2) for more concurrent workspaces
171-
- Increase `DB_MAX_CONNECTIONS_PER_DB` (to 5-7) if queries are long-running
172-
173-
**Note:** Environment variables always take precedence over database settings configured via the setup wizard.
174-
175-
For detailed installation instructions, configuration options, and setup guides, visit **[docs.notifuse.com](https://docs.notifuse.com)**.
87+
👉 **[docs.notifuse.com/installation](https://docs.notifuse.com/installation)**
17688

17789
## 📚 Documentation
17890

0 commit comments

Comments
 (0)