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

About Docker's Logging Driver

Docker has a lot of built-in log mechanisms to help us obtain service information executed in the container. These mechanisms (mechanisms) we usually call logging drivers.

docker

How to update or rebuild D-Laravel's FPM Image

Sometimes, the docker image will undergo some corrections or add more plug-ins, how do we update the image in the computer? It's very simple, use docker pull [use the image], if you want to create your own image is also feasible...

docker, tinkerwell, tinker, laravel

Application of Tinkerwell and docker environment

In fact, I don't use Tinkerwell recently because it keeps costing me money to update. If you want to test the direct ssh host, it’s done, isn’t it?