by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 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,Synology

How to modify the logging driver of Docker on Synolog NAS

On my Synolog Nas, a strange logging driver named db is running by default, how to modify it to a normal json-file? In Synolog's Nas, his Daemon config file is special, and it is placed in the /var/packages/Docker/etc/ directory. Called dockerd.json.

docker,php,cli

MacOS's php is not powerful, use docker to execute laravel installer

It's very simple, just add an "alias" alias laravel='docker run --rm -v ${PWD}:/var/www/html -v ~/.dlaravel/cache:/home/dlaravel/.composer /cache -ti deviny/fpm:8.1.10 /home/dlaravel/.composer/vendor/bin/laravel'