by Devin Yang
(This article was automatically translated.)

Published - 7 years ago ( Updated - 7 years ago )

The video below the article introduces how to use rendertron to solve Polymer SEO optimization problems.
In the source of my fork, it has been adjusted to support the Chinese environment.
And also added the API interface of pdf, which can also be used to convert pdf.

Original Rendertron GitHub link
https://github.com/GoogleChrome/rendertron

The source of my fork has adjusted the Chinese environment, you can refer to the settings on my GitHub.
In addition, I also adjusted the source and added the pdf API, so if I use my source to build image, there will be an extra pdf button.
https://github.com/DevinY/rendertron
 

Error about 'ECONNREFUSED':

When your kernel lacks user namespace support or when you try to access a service in a container, you will encounter an ECONNREFUSED error,
Here are two recommended ways to resolve this issue:
  1. [Recommended] - Use Jessie Frazelle' seccomp profile with the -security-opt flag
  2. Use the --cap-add SYS_ADMIN flag
1. Download the seccomp configuration file (chrome.json) of Jessie Frazelle's Chrome browser via wget to start the container with the built-in image:
wget https://raw.githubusercontent.com/jfrazelle/dotfiles/master/etc/docker/seccomp/chrome.json -O ~/chrome.json
docker run -it -p 8080:8080 --security-opt seccomp=$HOME/chrome.json --name rendertron-container rendertron

2. The container of the image file created and executed using SYS_ADMIN:
docker run -it -p 8080:8080 --cap-add SYS_ADMIN --name rendertron-container rendertron

About Chinese Support

You may have noticed that the image built in the original docker environment is in English.
Therefore, it is also in English when capturing pictures through the API (test URL):
https://render-tron.appspot.com/screenshot/https://www.google.com

If you don't want to build the image yourself
You can directly use the image I built first,
The execution method is as follows:
1. First download chrome.json to the home directory of your host ( you only need to do it once, if you use a Mac system without wget installed, please use other methods to download the json file ):
wget https://raw.githubusercontent.com/jfrazelle/dotfiles/master/etc/docker/seccomp/chrome.json -O ~/chrome.json

2. Create a container. Here I added the --rm parameter. When stopping, I want to remove the container. Try the function of capturing pictures, and it will be in Chinese.
docker run --rm -it -p 8080:8080 --security-opt seccomp=$HOME/chrome.json --name rendertron-container deviny/rendertron

Note:
If you use npm install to install and use npm start to execute,
If your system environment is Chinese, Chinese can be displayed.
npm start
> bot-render@1.0.0 start /Users/devin/rendertron
> node src/main.js
Chrome launched with debugging on port 54791
Listening on port 3000


For a detailed introduction on how rendertron is actually used, please see the video below:

Tags: docker polymer seo

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


docker,laravel

How to use multiple YAML files to execute multiple docker container services

This video introduces how to use the docker-compose command to specify multiple YAML structure language configuration files to create container execution, and introduces how we simplify docker-compose by using .env in the D-Laravel environment Start command.

laravel,docker

How to customize Laravel pagination

Recently, I have been free, and I want to adjust the arrows on the upper and lower pages of the website. If you don’t know how to customize Laravel’s pagination, You can take a look at a short three-minute introduction on how I customize Laravel's pagination.

docker

The use of iptabels is required in the Docker Swarm environment

First of all, in the Linux environment, Docker uses iptables rules to provide network isolation. However, in the environment of Docker swarm mode, we cannot identify the connection port under 127.0.0.1 of the host. At this time, we can customize the rules through the DOCKER-USER chain in iptables.