fix errors

This commit is contained in:
2026-07-06 16:06:06 +02:00
parent 3d5aa94aa0
commit 90ebcbb26a
3 changed files with 19 additions and 6 deletions
-1
View File
@@ -3,7 +3,6 @@ FROM debian:bullseye-slim
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
xserver-xorg-core \ xserver-xorg-core \
xserver-xorg-video-fbdev \ xserver-xorg-video-fbdev \
xserver-xorg-video-fbturbo \
xserver-xorg-video-all \ xserver-xorg-video-all \
x11-xserver-utils \ x11-xserver-utils \
xinit \ xinit \
+4
View File
@@ -25,6 +25,8 @@ services:
- "5011:5011" - "5011:5011"
volumes: volumes:
- x11-socket:/tmp/.X11-unix - x11-socket:/tmp/.X11-unix
devices:
- "/dev/dri:/dev/dri"
environment: environment:
- DISPLAY=:0 - DISPLAY=:0
- MONITOR=HDMI-1 - MONITOR=HDMI-1
@@ -42,6 +44,8 @@ services:
- "5012:5012" - "5012:5012"
volumes: volumes:
- x11-socket:/tmp/.X11-unix - x11-socket:/tmp/.X11-unix
devices:
- "/dev/dri:/dev/dri"
environment: environment:
- DISPLAY=:0 - DISPLAY=:0
- MONITOR=HDMI-2 - MONITOR=HDMI-2
+15 -5
View File
@@ -100,12 +100,13 @@ async function startChromium() {
stdio: 'inherit' stdio: 'inherit'
}); });
// Connect Puppeteer // Connect Puppeteer with retries
setTimeout(async () => { let retries = 15;
const tryConnect = async () => {
try { try {
console.log('Connecting puppeteer...'); console.log('Connecting puppeteer...');
browser = await puppeteer.connect({ browser = await puppeteer.connect({
browserURL: 'http://localhost:9222', browserURL: 'http://127.0.0.1:9222',
defaultViewport: null defaultViewport: null
}); });
@@ -116,10 +117,19 @@ async function startChromium() {
console.log(`Navigating to ${currentUrl}`); console.log(`Navigating to ${currentUrl}`);
await page.goto(currentUrl); await page.goto(currentUrl);
} }
console.log('Puppeteer connected successfully!');
} catch (e) { } catch (e) {
console.error('Puppeteer connect error:', e); if (retries > 0) {
console.log(`Puppeteer connect failed, retrying in 2s... (${retries} attempts left)`);
retries--;
setTimeout(tryConnect, 2000);
} else {
console.error('Puppeteer connect error (fatal):', e);
} }
}, 3000); }
};
setTimeout(tryConnect, 2000);
} }
// API Endpoints // API Endpoints