From ab5866b3ffec68db16ea4e2147ee4f61a6550c02 Mon Sep 17 00:00:00 2001 From: Rishabh Pandey <81532347+brikjr@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:48:22 -0400 Subject: [PATCH 1/7] Update Dockerfile Updated docker file that works. Node12 wasn't in support anymore and changed and upgraded some of the apt modules for docker containers --- Dockerfile | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) 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"] From 9dc11eca22e13a6c39f7fff17e04b384110817dc Mon Sep 17 00:00:00 2001 From: Rishabh Pandey <81532347+brikjr@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:55:11 -0400 Subject: [PATCH 2/7] Updated README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2770d52..f5dc78e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# SneakerBot +# SneakerBot brik-patch version + +This is an update, this bot is up and running and we do not need [![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) @@ -114,7 +116,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. From af79575beeec5920983ce4ca9a8111091c909369 Mon Sep 17 00:00:00 2001 From: Rishabh Pandey <81532347+brikjr@users.noreply.github.com> Date: Tue, 12 Sep 2023 18:58:39 -0400 Subject: [PATCH 3/7] Created .env.docker Added a docker env file which DB Username and Password to bypass the entire making database process --- .env.docker | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .env.docker 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= From 2a1e0e76476cdee74c260dbeecf3f9837c97dc5c Mon Sep 17 00:00:00 2001 From: Rishabh Pandey <81532347+brikjr@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:16:28 -0400 Subject: [PATCH 4/7] Update README.md Poorly edited but has all the instructions to get someone started with the bot with no knowledge. --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f5dc78e..0016f8e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,22 @@ # SneakerBot brik-patch version -This is an update, this bot is up and running and we do not need +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: From 943fc5c1b53ddc47b8c75ef5979d401278365f75 Mon Sep 17 00:00:00 2001 From: Rishabh Pandey <81532347+brikjr@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:17:17 -0400 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0016f8e..b993c6d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This is an update, this bot is up and running and we do not need vncviewer for t ```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 +Use [this link](https://editor.swagger.io/?_ga=2.252362959.790550088.1692949915-879429909.1692949915) for API docs API doc is openapi.yaml file ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ From 5100d9a8721572292323493278e3f5eb1c992440 Mon Sep 17 00:00:00 2001 From: Rishabh Pandey <81532347+brikjr@users.noreply.github.com> Date: Tue, 12 Sep 2023 19:18:00 -0400 Subject: [PATCH 6/7] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index b993c6d..8c1f208 100644 --- a/README.md +++ b/README.md @@ -5,15 +5,23 @@ This is an update, this bot is up and running and we do not need vncviewer for t ### 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 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ From 05b9d3d3342aa7335b1bea31c2afa1e265b63cd4 Mon Sep 17 00:00:00 2001 From: Rishabh Pandey <81532347+brikjr@users.noreply.github.com> Date: Thu, 26 Oct 2023 23:17:53 -0400 Subject: [PATCH 7/7] Update README.md (#5) --- README.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/README.md b/README.md index 8c1f208..7419453 100644 --- a/README.md +++ b/README.md @@ -205,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).