Compare commits
4 Commits
5ec57150b1
...
e1dc7bc5c9
Author | SHA1 | Date | |
---|---|---|---|
e1dc7bc5c9 | |||
ffd83d8bbc | |||
9ee391fee8 | |||
f7dfaafc59 |
22
.github/workflows/monolith.yml
vendored
22
.github/workflows/monolith.yml
vendored
@@ -7,7 +7,6 @@ on:
|
||||
|
||||
env:
|
||||
REGISTRY_URL: gitea.kobim.cloud
|
||||
DOCKERHUB_USERNAME: kobimex
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -19,37 +18,20 @@ jobs:
|
||||
- name: Setup Docker Environment
|
||||
uses: ./.github/actions/setup-docker-environment
|
||||
|
||||
- name: Log in to custom Docker registry
|
||||
- name: Log in to Docker registry
|
||||
uses: docker/login-action@v3.3.0
|
||||
with:
|
||||
registry: ${{ env.REGISTRY_URL }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image to custom registry
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6.13.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY_URL }}/${{ github.repository_owner }}/${{ github.event.repository.name }}-monolith:latest
|
||||
file: ./Monolith.dockerfile
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
||||
|
||||
- name: Log in to Docker Hub
|
||||
uses: docker/login-action@v3.3.0
|
||||
with:
|
||||
username: ${{ env.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push Docker image to Docker Hub
|
||||
uses: docker/build-push-action@v6.13.0
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
tags: ${{ env.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }}-monolith:latest
|
||||
file: ./Monolith.dockerfile
|
||||
platforms: |
|
||||
linux/amd64
|
||||
linux/arm64
|
@@ -59,13 +59,7 @@ To stop the Docker containers run: `docker compose down -v`
|
||||
3. Ajust the firewall settings to allow the necessary ports if needed
|
||||
4. Start the Docker container:
|
||||
```sh
|
||||
docker run --rm -p 7900:7900 --env-file .env --name peertube-collector --pull always --shm-size="2g" gitea.kobim.cloud/kobim/peertube-collector-monolith:latest
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
docker run --rm -p 7900:7900 --env-file .env --name peertube-collector --pull always --shm-size="2g" kobimex/peertube-collector-monolith:latest
|
||||
docker run --rm -p 7900:7900 --env-file .env --name peertube-collector gitea.kobim.cloud/kobim/peertube-collector-monolith:latest
|
||||
```
|
||||
|
||||
|
||||
|
27
main.py
27
main.py
@@ -5,7 +5,7 @@ import socket
|
||||
import logging
|
||||
import os
|
||||
import argparse
|
||||
from time import sleep
|
||||
from yaspin import yaspin
|
||||
from functools import partial
|
||||
from http.server import HTTPServer
|
||||
from utils.PostHandler import Handler
|
||||
@@ -50,6 +50,7 @@ def interrupt_handler(signum, driver: webdriver.Remote):
|
||||
driver.quit()
|
||||
raise SystemExit
|
||||
|
||||
@yaspin()
|
||||
def setupChromeDriver(command_executor: str | None, webrtc_internals_path: str) -> webdriver.Remote | webdriver.Chrome:
|
||||
logger.log(logging.INFO, 'Setting up Chrome driver.')
|
||||
chrome_options = Options()
|
||||
@@ -179,24 +180,20 @@ def downloadStats(driver: webdriver.Remote | webdriver.Chrome, peersDict: dict,
|
||||
def convert_to_bytes(down, downUnit):
|
||||
return float(down) * (1024 ** {'B': 0, 'KB': 1, 'MB': 2, 'GB': 3}[downUnit])
|
||||
|
||||
def setupStats(driver: webdriver.Remote, url: str, retries: int = 5) -> webdriver.Remote:
|
||||
@yaspin()
|
||||
def setupStats(driver: webdriver.Remote, url: str):
|
||||
logger.log(logging.INFO, 'Setting up stats.')
|
||||
actions = ActionChains(driver)
|
||||
wait = WebDriverWait(driver, 30, poll_frequency=0.2)
|
||||
|
||||
sleep(2)
|
||||
|
||||
for attempt in range(retries):
|
||||
driver.get(url)
|
||||
try:
|
||||
wait.until(ec.presence_of_element_located((By.CLASS_NAME, 'vjs-big-play-button')))
|
||||
break
|
||||
except Exception:
|
||||
logger.error(f'Timeout while waiting for the big play button to be present. Attempt {attempt + 1} of {retries}')
|
||||
if attempt == retries - 1:
|
||||
logger.error('Timeout limit reached. Exiting.')
|
||||
driver.quit()
|
||||
raise SystemExit(1)
|
||||
driver.get(url)
|
||||
|
||||
try:
|
||||
wait.until(ec.presence_of_element_located((By.CLASS_NAME, 'vjs-big-play-button')))
|
||||
except Exception:
|
||||
logger.error('Timeout while waiting for the big play button to be present.')
|
||||
driver.quit()
|
||||
raise SystemExit(1)
|
||||
|
||||
actions.click(driver.find_element(By.CLASS_NAME ,'video-js')).perform()
|
||||
wait.until(ec.visibility_of_element_located((By.CLASS_NAME, 'vjs-control-bar')))
|
||||
|
@@ -48,8 +48,6 @@ done
|
||||
|
||||
printf '\n'
|
||||
|
||||
# Start the Telegraf agent
|
||||
# Start the Telegraf agent and the main script
|
||||
telegraf --config ./telegraf.conf &
|
||||
|
||||
# Start the main Python script as PID 1
|
||||
exec ./venv/bin/python main.py
|
||||
./venv/bin/python main.py
|
Reference in New Issue
Block a user