Sorok-Dva / freenom-auto-renew-domains

A scraper built with puppeteer that auto renew free domains on Freenom and send discord message using bot
50 stars 20 forks source link

Can the utility run on a server without a GPU? #25

Closed abramovantonru closed 1 year ago

abramovantonru commented 1 year ago

I'm start in docker on server without GPU and take error

image

I try fix by this guide? but not work for me. Has anyone tested this on the server?

Sorok-Dva commented 1 year ago

This error is thrown by Puppeteer, please see https://github.com/puppeteer/puppeteer/issues/8148

Unfortunately, it's not something that can be fixed in Puppeteer. A headful browser requires an x server or a display: see for various solutions depending on a operating system/docker etc https://stackoverflow.com/questions/60304251/unable-to-open-x-display-when-trying-to-run-google-chrome-on-centos-rhel-7-5 The issue also affects a whole range of programs not just chrome: see https://www.baeldung.com/linux/no-x11-display-error

abramovantonru commented 1 year ago

If you are interested in how to run everything on the server without a video adapter:

add to Dockerfile->

...
&& apt-get install -y google-chrome-stable ...
&& apt-get install -yq dnsutils xvfb xorg xvfb gtk2-engines-pixbuf dbus-x11 xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic xfonts-scalable \
    gconf-service libasound2 libatk1.0-0 libc6 libcairo2 \
    libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 \
    libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 \
    libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
    libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 \
    libxss1 libxtst6 ca-certificates fonts-liberation libnss3 lsb-release \
    xdg-utils wget \
...

edit docker-compose.yml ->

remove command: npm run start

add new properties ->

entrypoint: sh /build/start.sh
cap_add:
    - SYS_ADMIN

create start.sh file with content ->

Xvfb :90 -screen 0 1024x1024x24 -nolisten unix &

FREENOM_CLIENT_AREA_IP=$(dig +short my.freenom.com @8.8.8.8 | sed -n '2p')
echo "$FREENOM_CLIENT_AREA_IP my.freenom.com" >> /etc/hosts

npm run start

add to .env -> DISPLAY=:90


And I also had a problem (Failed Error: net::ERR_NAME_NOT_RESOLVED at my.freenom.com) with determining the IP of my personal account. In start.sh through dig, the IP is determined and written to /etc/hosts.