diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..f9bd2d35f0 --- /dev/null +++ b/Makefile @@ -0,0 +1,17 @@ +.DEFAULT_GOAL := run + +.PHONY: build +build: + docker-compose build streetmerchant + +.PHONY: run +run: + docker-compose up + +.PHONY: run-detached +run-detached: + docker-compose up -d + +.PHONY: stop +stop: + docker-compose down diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000000..7c3be17f81 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,10 @@ +version: '3.0' +services: + streetmerchant: + build: + context: . + dockerfile: Dockerfile + container_name: streetmerchant + env_file: .env + # ports: + # - 7997:7997 diff --git a/docs/docker.md b/docs/docker.md new file mode 100644 index 0000000000..e1c3d1b0f6 --- /dev/null +++ b/docs/docker.md @@ -0,0 +1,25 @@ +# Docker + +You will need: +* `docker` (tested on Docker version 19.03.13-ce, build 4484c46d9d) +* `make` (not a strict requirement, but helps out with stages) +* `docker-compose` (tested on docker-compose version 1.27.4,) + +## What +It is assumed you know what docker is. +You can build and run this project inside docker, headless. All the depencies will be downloaded in to the docker image. + +## Why +There is no need to install node, or anything else (apart from above) on your machine to run this. + +## How + +1. Copy pasta the `.env-example` in to `.env`. +2. Edit `.env` in your favourite editor, pick stores, options what ever you want. +3. If you have make, simply run `make` in your terminal to get started. You should see a docker build, and container start automatically. +4. If you want a webserver running, so you can edit the options via web interface, uncomment lines 13-14 in `docker-compose.yml` to open up ports `7997`. Update `.env` file `WEB_PORT="7997"` this is so the service listens on `7997` and we expose the same ports on docker. +5. If you do not have make, because windows, run these commands in order: + ``` + docker-compose build streetmerchant-shop-bot + docker-compose up + ``` \ No newline at end of file diff --git a/docs/getting-started.md b/docs/getting-started.md index 98de39a769..e7ee9d1d26 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -53,6 +53,11 @@ docker run --cap-add=SYS_ADMIN \ To customize streetmerchant, make a copy of `dotenv-example` as `dotenv` and make any changes to your liking. View [Reference](reference/application.md) for more information on variables and their usage. + +## Building docker + +[Docker-Docs](docs/docker.md) + ???+ tip All environment variables are optional. diff --git a/src/index.ts b/src/index.ts index 0293392b83..ad5e06da32 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,8 +26,13 @@ async function main() { } // https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#tips + // https://stackoverflow.com/questions/48230901/docker-alpine-with-node-js-and-chromium-headless-puppeter-failed-to-launch-c if (config.docker) { args.push('--disable-dev-shm-usage'); + args.push('--no-sandbox'); + args.push('--disable-setuid-sandbox'); + args.push('--headless'); + args.push('--disable-gpu'); } // Add the address of the proxy server if defined @@ -38,7 +43,7 @@ async function main() { } await stop(); - + logger.warn('ℹ printing puppeteer configs::', args); browser = await puppeteer.launch({ args, defaultViewport: {