# AyrisTech Worker (V10.3) This worker monitors Mailcow vmail volumes and triggers Next.js webhooks when new mail arrives. ## Features - Real-time filesystem monitoring with `chokidar` - Automatic mail decoding via `doveadm` - Next.js Webhook integration - Secure secret-based authentication ## Setup Instructions ### 1. Configuration Create a `.env` file in the root directory (copy from `.env.example` if available): ```env NEXTJS_WEBHOOK_URL=https://your-nextjs-app.com/api/webhooks/mail-signal WEBHOOK_SECRET=your_secret_here ``` ### 2. Local Installation ```bash npm install npm start ``` ### 3. Docker Deployment To run as a container, you must provide access to the Docker socket and the Mailcow volumes: ```bash docker build -t ayristech-worker . docker run -d \ --name ayristech-worker \ -v /var/run/docker.sock:/var/run/docker.sock \ -v /var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/:/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/ \ --env-file .env \ ayristech-worker ``` ## Important Notes - **Docker Socket**: The worker runs `docker exec` commands, so `/var/run/docker.sock` must be mounted. - **Vmail Path**: The worker watches `/var/lib/docker/volumes/mailcowdockerized_vmail-vol-1/_data/`. Ensure this volume exists and is mounted at the exact same path inside the container.