diff --git a/.env.docker b/.env.docker new file mode 100644 index 0000000..65d1205 --- /dev/null +++ b/.env.docker @@ -0,0 +1,22 @@ +PORT=8888 + +DB_USERNAME=sneakerbot +DB_PASSWORD=A6aqvt7>8E,bd@RH +DB_NAME=sneakerbot +DB_PORT=5432 +DB_HOST=host.docker.internal + +EMAIL_HOST= +EMAIL_PORT= +EMAIL_USERNAME= +EMAIL_PASSWORD= + +CARD_NUMBER= +NAME_ON_CARD= +EXPIRATION_MONTH= +EXPIRATION_YEAR= +SECURITY_CODE= + +API_KEY_2CAPTCHA= + +WEBHOOK_ENDPOINT= diff --git a/Dockerfile b/Dockerfile index 716a757..81b4e4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,20 @@ -FROM node:12 +FROM node:16 # Install dependencies for running Chrome, an X server, and VNC server -RUN apt-get update &&\ +RUN apt-get update && \ apt-get install -yq net-tools 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 libappindicator1 libnss3 lsb-release xdg-utils \ - xvfb x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps + xvfb x11vnc x11-xkb-utils xfonts-100dpi xfonts-75dpi xfonts-scalable xfonts-cyrillic x11-apps # Install latest version of google-chrome-stable RUN apt-get update && apt-get install -y wget --no-install-recommends \ && wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \ && sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \ && apt-get update \ - && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst ttf-freefont \ + && apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst \ --no-install-recommends \ && rm -rf /var/lib/apt/lists/* \ && apt-get purge --auto-remove -y curl \ @@ -25,35 +25,24 @@ ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.2/dumb-init_1.2.2_x RUN chmod +x /usr/local/bin/dumb-init -ENTRYPOINT ["dumb-init", "--"] +ENTRYPOINT ["dumb-init", "--"] ENV PUPPETEER_EXECUTABLE_PATH="/usr/bin/google-chrome-stable" - -# Puppeteer is packaged with Chromium, but we can skip the download since we are using google-chrome-stable ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true RUN mkdir ~/.vnc - -# Set password on VNC server RUN x11vnc -storepasswd 1234 ~/.vnc/passwd -# Expose default port for VNC server EXPOSE 5900 WORKDIR /app - COPY package.json . - RUN npm install - -COPY . . +COPY . . ARG NODE_ENV - ENV NODE_ENV=$NODE_ENV - RUN chmod +x ./container_start.sh EXPOSE 8000 - -CMD /bin/sh './container_start.sh' \ No newline at end of file +CMD ["sh", "./container_start.sh"] diff --git a/README.md b/README.md index 2770d52..7419453 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,30 @@ -# SneakerBot +# SneakerBot brik-patch version +This is an update, this bot is up and running and we do not need vncviewer for this. + +### To run the bot: + +```docker build -t sneakerbot .``` + +```docker ps``` + +- from your output of docker ps find the name "samc621/sneakerbot" + +```docker kill [Container ID for samc621/sneakerbot]``` + +```docker run -p 5900:5900 -p 8000:8000 -p 8080:8080 -p 8888:8888 --env NODE_ENV=docker --env-file .env.docker sneakerbot``` + +- Open chrome and type in url: + +```localhost:8888/v1``` + +Use the ```POST``` method mentioned down below to create tasks. + +Use [this link](https://editor.swagger.io/?_ga=2.252362959.790550088.1692949915-879429909.1692949915) for API docs + +API doc is openapi.yaml file + +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ [![build, lint, test, deploy](https://github.com/samc621/SneakerBot/actions/workflows/build_lint_deploy.yml/badge.svg)](https://github.com/samc621/SneakerBot/actions/workflows/build_lint_deploy.yml) This bot uses Node.js and Puppeteer to automate the checkout on various sneaker websites. It currently works on: @@ -114,7 +139,7 @@ Then run it and specify the env file with: `docker run -p 5900:5900 -p 8000:8000 --env NODE_ENV=docker --env-file .env.docker sneakerbot` (replace `8000` with whatever `PORT` you specified in `.env.docker`) -This Docker image is built from `node:12` and uses [xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) with [x11vnc](https://github.com/LibVNC/x11vnc) to provide access to a GUI. +This Docker image is built from `node:16` and uses [xvfb](https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml) with [x11vnc](https://github.com/LibVNC/x11vnc) to provide access to a GUI. You can use [vncviewer](https://www.realvnc.com/en/connect/download/viewer/) to connect to the VNC server running in the container. @@ -180,16 +205,4 @@ You must sign up for and fund a 2Captcha account, and then add your `API_KEY_2CA For manually-solving captchas, you will be given a 5-minute timeout after the email notification to check the browser and solve the captcha. -## Motivation - -As a teenager, I operated sneakerbots.us, where I sold sneakerbots like this in addition to early links and ATC services. - -Fastforward several years, I decided to upgrade this all-in-one bot from Java + Selenium to Node.js + Puppeteer, which I enjoy more for bot projects. - -I am open sourcing this repo now, since I no longer operate the business, but also because I am of the opinion that this software can rival many of its commercial competitors. - -Feel free to open a Pull Request to contribute to this project and help make it better! I will continue to support more websites and add more features as I can. - -Also feel free to open an Issue or contact me via Telegram @samc621 if you have any trouble. -If you appreciate this, consider [buying me a coffee](https://www.buymeacoffee.com/samc621).