From 1e61e314a6090805e277f7848fb3f70dd0ed42e3 Mon Sep 17 00:00:00 2001 From: Eddy Date: Fri, 19 Jun 2026 00:36:13 +0200 Subject: [PATCH] docs: update deployment from Mac Mini launchd to nextcloud PM2 --- README.md | 59 +++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 3f82cb6..b7ec27f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ De bot gebruikt een **speciale groep** (Dienst opvragen EdGPT-EBS) waarin **elk ## Vereisten - [Node.js](https://nodejs.org/) 18+ -- [wwebjs-api](https://github.com/pedroslopez/whatsapp-web.js) Docker container (poort 3000) +- [wwebjs-api](https://github.com/pedroslopez/whatsapp-web.js) Docker container op nextcloud (poort 3001) - WhatsApp sessie "EdGpt" actief in wwebjs-api ## Installatie @@ -33,7 +33,7 @@ Kopieer `.env.example` naar `.env` en vul de waarden in: ```env # WhatsApp API -WHATSAPP_API_ENDPOINT=http://localhost:3000 +WHATSAPP_API_ENDPOINT=http://192.168.5.252:3001 WHATSAPP_SESSION=EdGpt # Webhook @@ -53,7 +53,7 @@ ADMIN_NUMBER=31620248011@c.us In de `.env` van wwebjs-api: ```env -BASE_WEBHOOK_URL=http://host.docker.internal:3002/webhook +BASE_WEBHOOK_URL=http://192.168.5.252:3002/webhook ENABLE_LOCAL_CALLBACK_EXAMPLE=FALSE ENABLE_WEBHOOK=TRUE ``` @@ -84,49 +84,48 @@ Beide zijn uitgesloten van git via `.gitignore`. ## Gebruik -### Starten +### Starten (nextcloud — huidig) -De bot draait als macOS LaunchDaemon (`/Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist`) met `RunAtLoad` en `KeepAlive`. -De LaunchDaemon start via `run-dienst-bot.sh`, een wrapper die bij elke start de -code signing signature van Node.js herstelt. Dit voorkomt uitval na een `brew upgrade node`. +De bot draait op **nextcloud** via **PM2** (gemigreerd van Mac Mini LaunchDaemon, juni 2026). -Herstarten: ```bash -sudo launchctl bootout system /Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist -sudo launchctl bootstrap system /Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist +# SSH naar nextcloud +ssh aiaiaiaiagent@nextcloud + +# Starten +cd ~/whatsapp-scripts/dienst_echo_whatsappgroep +pm2 start src/index.js --name dienst-bot +pm2 save ``` ### Stoppen ```bash -sudo launchctl bootout system /Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist +pm2 stop dienst-bot +``` + +### Herstarten + +```bash +pm2 restart dienst-bot +``` + +### Status + +```bash +pm2 status ``` ### Logs bekijken ```bash -tail -f /Users/eddy/.pm2/logs/dienst-bot-out.log -tail -f /Users/eddy/.pm2/logs/dienst-bot-error.log +pm2 logs dienst-bot ``` -Of met PM2: +### Oude Mac Mini (niet meer actief) -```bash -npx pm2 start src/index.js --name dienst-bot -npx pm2 save -``` - -### Stoppen - -```bash -npx pm2 stop dienst-bot -``` - -### Logs bekijken - -```bash -npx pm2 logs dienst-bot -``` +Plist: `/Library/LaunchDaemons/nl.eddydevink.dienst-bot.plist` → `.disabled` +Wrapper: `run-dienst-bot.sh` (codesign fix voor Homebrew Node) ## Projectstructuur