Skip to main content

Docker and docker-compose

Installing A-Parser on Linux and MacOS via Docker is the recommended method; we have prepared an image that includes all necessary dependencies and libraries for A-Parser and Headless Chrome to function.

Before installation

Before installation, you need to specify your IP in the Members Area.

Docker

You need to install Docker on your system.

Installation and start

Download and unpack the A-Parser distribution:

curl -O https://a-parser.com/members/onetime/ce42f308eaa577b5/aparser-linux-x64.tar.gz
tar zxf aparser-linux-x64.tar.gz
rm -f aparser-linux-x64.tar.gz
note

The download uses a one-time link for Linux. You should get it in the Members Area, A-Parser tab -> Downloads

Run it using the command:

docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t aparser/runtime ./aparser -foreground

The -foreground option outputs the log file content directly to the terminal:

Apr 27 07:06:53.10427 [master] foreground mode
Apr 27 07:06:54.06409 [master] Found local Chromium: /app/dist/nodejs/node_modules/puppeteer/.local-chromium/linux-856583/chrome-linux/chrome
Apr 27 07:06:55.36487 [master] NodeJS console: [Rank::CMS] total loaded 1446 apps
Apr 27 07:07:19.01377 [master] Start ProxyChecker nocheck
Apr 27 07:07:19.24418 [master] Start ProxyChecker default
Apr 27 07:07:19.62635 [master] A-Parser v1.2.1176-linux-x64 started, tasks: 0 / 2, memory total: 1989 MB, available: 610 MB

After starting, A-Parser will be available at http://127.0.0.1:9091

To run the container in the background, use the command:

docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t -d aparser/runtime ./aparser

Linux tuning for more threads

By default, the container also has a limit on the number of open files/sockets. To increase the limit to 10240 when running via Docker, use the --ulimit option:

docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 --ulimit nofile=10240:10240 -t -d aparser/runtime ./aparser

A similar setting can be specified in docker-compose.yml:

services:
a-parser:
image: aparser/runtime:latest
command: ./aparser
restart: always
volumes:
- ./aparser:/app
ports:
- 9091:9091
ulimits:
nofile:
soft: 10240
hard: 10240

Additionally, it is recommended to perform Linux tuning for more threads on the host system.

Updating A-Parser

Stop the container:

docker stop aparser

Update A-Parser:

docker run --rm --name aparser -v $(pwd)/aparser:/app -p 9091:9091 -t aparser/runtime ./aparser -foreground -doupdate

Once the update is complete, start A-Parser

note

You can also use the update via the interface or a one-time link

docker-compose

Download and unpack the A-Parser distribution:

curl -O https://a-parser.com/members/onetime/ce42f308eaa577b5/aparser.tar.gz
tar zxf aparser.tar.gz
rm -f aparser.tar.gz

Create a docker-compose.yml file:

version: '3'

services:
a-parser:
image: aparser/runtime:latest
command: ./aparser
restart: always
volumes:
- ./aparser:/app
ports:
- 9091:9091

Start A-Parser:

docker compose up -d

TODO: (next) #### Connecting HTTPS via Let's Encrypt