Add docker-compose and update Selenium scraping logic with target selectors

This commit is contained in:
Flash
2026-04-10 19:56:19 +00:00
parent 75f51121ea
commit 1b62fe732c
5 changed files with 211 additions and 81 deletions

107
k8s.yaml
View File

@@ -1,5 +1,44 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: gisp-scraper
labels:
app: gisp-scraper
spec:
replicas: 1
selector:
matchLabels:
app: gisp-scraper
template:
metadata:
labels:
app: gisp-scraper
spec:
containers:
- name: gisp-scraper
image: git.danilkolesnikov.ru/flash/gisp-scraper:latest
env:
- name: SELENIUM_HUB_URL
value: "http://selenium-hub:4444/wd/hub"
ports:
- containerPort: 8000
---
apiVersion: v1
kind: Service
metadata:
name: gisp-scraper
spec:
selector:
app: gisp-scraper
ports:
- protocol: TCP
port: 8000
targetPort: 8000
nodePort: 30001
type: NodePort
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: selenium-hub
spec:
@@ -12,13 +51,9 @@ spec:
labels:
app: selenium-hub
spec:
tolerations:
- key: "node.kubernetes.io/disk-pressure"
operator: "Exists"
effect: "NoSchedule"
containers:
- name: selenium-hub
image: selenium/hub:latest
image: selenium/hub:4.16.1
ports:
- containerPort: 4444
---
@@ -30,15 +65,9 @@ spec:
selector:
app: selenium-hub
ports:
- port: 4444
name: http
targetPort: 4444
- port: 4442
name: publish
targetPort: 4442
- port: 4443
name: subscribe
targetPort: 4443
- protocol: TCP
port: 4444
targetPort: 4444
---
apiVersion: apps/v1
kind: Deployment
@@ -54,20 +83,18 @@ spec:
labels:
app: selenium-node-chrome
spec:
tolerations:
- key: "node.kubernetes.io/disk-pressure"
operator: "Exists"
effect: "NoSchedule"
containers:
- name: selenium-node-chrome
image: selenium/node-chrome:latest
image: selenium/node-chrome:4.16.1
env:
- name: SE_EVENT_BUS_HOST
value: "selenium-hub"
value: selenium-hub
- name: SE_EVENT_BUS_PUBLISH_PORT
value: "4442"
- name: SE_EVENT_BUS_SUBSCRIBE_PORT
value: "4443"
- name: SHM_SIZE
value: "2g"
volumeMounts:
- name: dshm
mountPath: /dev/shm
@@ -75,43 +102,3 @@ spec:
- name: dshm
emptyDir:
medium: Memory
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: gisp-scraper
spec:
replicas: 1
selector:
matchLabels:
app: gisp-scraper
template:
metadata:
labels:
app: gisp-scraper
spec:
tolerations:
- key: "node.kubernetes.io/disk-pressure"
operator: "Exists"
effect: "NoSchedule"
containers:
- name: gisp-scraper
image: git.danilkolesnikov.ru/flash/gisp-scraper:latest
ports:
- containerPort: 8000
env:
- name: SELENIUM_HUB_URL
value: "http://selenium-hub:4444/wd/hub"
---
apiVersion: v1
kind: Service
metadata:
name: gisp-scraper
spec:
selector:
app: gisp-scraper
ports:
- protocol: TCP
port: 80
targetPort: 8000
type: ClusterIP