mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2026-07-26 09:02:00 +00:00
Replace Playwright server with a pre-built image
This commit is contained in:
@@ -103,7 +103,7 @@ class html_playwright(Fetcher):
|
||||
self.browser_type = os.getenv("PLAYWRIGHT_BROWSER_TYPE", 'chromium').strip('"')
|
||||
self.command_executor = os.getenv(
|
||||
"PLAYWRIGHT_DRIVER_URL",
|
||||
'ws://playwright-server:4444/playwright'
|
||||
'ws://playwright-chrome:3000/playwright'
|
||||
).strip('"')
|
||||
|
||||
# If any proxy settings are enabled, then we should setup the proxy object
|
||||
|
||||
+7
-17
@@ -24,11 +24,7 @@ services:
|
||||
# https://selenium-python.readthedocs.io/api.html#module-selenium.webdriver.common.proxy
|
||||
#
|
||||
# Alternative Playwright URL, do not use "'s or 's!
|
||||
# - PLAYWRIGHT_DRIVER_URL=ws://playwright-server:4444/playwright
|
||||
#
|
||||
# Alternative Playwright Browser Type, must match with PLAYWRIGHT_BROWSER_TYPE in the playwright-server service
|
||||
# See https://playwright.dev/docs/browsers
|
||||
# - PLAYWRIGHT_BROWSER_TYPE=chromium
|
||||
# - PLAYWRIGHT_DRIVER_URL=ws://playwright-chrome:3000/playwright
|
||||
#
|
||||
# Playwright proxy settings playwright_proxy_server, playwright_proxy_bypass, playwright_proxy_username, playwright_proxy_password
|
||||
#
|
||||
@@ -71,18 +67,12 @@ services:
|
||||
# - /dev/shm:/dev/shm
|
||||
# restart: unless-stopped
|
||||
|
||||
# playwright-server:
|
||||
# hostname: playwright-server
|
||||
# build: ./playwright
|
||||
# environment:
|
||||
# - PLAYWRIGHT_PORT=4444
|
||||
# # Must match with PLAYWRIGHT_BROWSER_TYPE in the changedetection service
|
||||
# - PLAYWRIGHT_BROWSER_TYPE=chromium
|
||||
# ipc: host
|
||||
# user: pwuser
|
||||
# security_opt:
|
||||
# - seccomp:./playwright/seccomp_profile.json
|
||||
# restart: unless-stopped
|
||||
# Used for fetching pages via Playwright+Chrome where you need Javascript support.
|
||||
|
||||
playwright-chrome:
|
||||
hostname: playwright-chrome
|
||||
image: browserless/chrome
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
changedetection-data:
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
FROM mcr.microsoft.com/playwright:v1.20.0-focal
|
||||
|
||||
WORKDIR /server
|
||||
RUN npm install playwright
|
||||
COPY server.js .
|
||||
|
||||
ENV PLAYWRIGHT_PORT=4444
|
||||
ENV PLAYWRIGHT_BROWSER_TYPE=chromium
|
||||
ENV PLAYWRIGHT_HEADLESS=true
|
||||
|
||||
EXPOSE ${PLAYWRIGHT_PORT}
|
||||
|
||||
CMD [ "node", "server.js" ]
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"comment": "Allow create user namespaces",
|
||||
"names": [
|
||||
"clone",
|
||||
"setns",
|
||||
"unshare"
|
||||
],
|
||||
"action": "SCMP_ACT_ALLOW",
|
||||
"args": [],
|
||||
"includes": {},
|
||||
"excludes": {}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
const playwright = require('playwright');
|
||||
|
||||
const port = parseInt(process.env.PLAYWRIGHT_PORT) || 4444;
|
||||
const browserType = process.env.PLAYWRIGHT_BROWSER_TYPE?.toLowerCase() || 'chromium';
|
||||
const headless = process.env.PLAYWRIGHT_HEADLESS?.toLowerCase() === 'true' || true;
|
||||
const wsPath = 'playwright';
|
||||
console.log('using port:', port, 'browser:', browserType, 'headless:', headless, 'wspath:', wsPath);
|
||||
|
||||
const serverPromise = playwright[browserType].launchServer({ headless: headless, port: port, wsPath: wsPath });
|
||||
serverPromise.then(bs => console.log(bs.wsEndpoint()));
|
||||
Reference in New Issue
Block a user