fix errors
This commit is contained in:
@@ -3,7 +3,6 @@ FROM debian:bullseye-slim
|
||||
RUN apt-get update && apt-get install -y \
|
||||
xserver-xorg-core \
|
||||
xserver-xorg-video-fbdev \
|
||||
xserver-xorg-video-fbturbo \
|
||||
xserver-xorg-video-all \
|
||||
x11-xserver-utils \
|
||||
xinit \
|
||||
|
||||
@@ -25,6 +25,8 @@ services:
|
||||
- "5011:5011"
|
||||
volumes:
|
||||
- x11-socket:/tmp/.X11-unix
|
||||
devices:
|
||||
- "/dev/dri:/dev/dri"
|
||||
environment:
|
||||
- DISPLAY=:0
|
||||
- MONITOR=HDMI-1
|
||||
@@ -42,6 +44,8 @@ services:
|
||||
- "5012:5012"
|
||||
volumes:
|
||||
- x11-socket:/tmp/.X11-unix
|
||||
devices:
|
||||
- "/dev/dri:/dev/dri"
|
||||
environment:
|
||||
- DISPLAY=:0
|
||||
- MONITOR=HDMI-2
|
||||
|
||||
+15
-5
@@ -100,12 +100,13 @@ async function startChromium() {
|
||||
stdio: 'inherit'
|
||||
});
|
||||
|
||||
// Connect Puppeteer
|
||||
setTimeout(async () => {
|
||||
// Connect Puppeteer with retries
|
||||
let retries = 15;
|
||||
const tryConnect = async () => {
|
||||
try {
|
||||
console.log('Connecting puppeteer...');
|
||||
browser = await puppeteer.connect({
|
||||
browserURL: 'http://localhost:9222',
|
||||
browserURL: 'http://127.0.0.1:9222',
|
||||
defaultViewport: null
|
||||
});
|
||||
|
||||
@@ -116,10 +117,19 @@ async function startChromium() {
|
||||
console.log(`Navigating to ${currentUrl}`);
|
||||
await page.goto(currentUrl);
|
||||
}
|
||||
console.log('Puppeteer connected successfully!');
|
||||
} 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
|
||||
|
||||
Reference in New Issue
Block a user