phantom_server is a deploy-ready phantomjs cluster which will help you render full HTML pages for your single-page web application.
It performs a similar role as other services like Pre-Render
If you're using single-page frameworks like AngularJS or EmberJS you must know the major pains:
- SEO - search engines do not render JS so they have to get a full version of the page in order to correctly index your site.
- Caching - In order to cache full rendred pages in your local cache or CDN you have to be able to fully render them
- Mobile Performance - Some older devices are having difficulties executing the JS involved in single-page applications.
By rendering full HTML pages:
- Search engines will receive a full HTML of your pages and won't have any trouble indexing it.
- You will have fully rendered HTML pages in your local cache or CDN.
- Since mobile devices will mainly get fully renderd pages they won't have to go through the hassle of rendering them themselves thus reducing the performance issues with single-page applications.
phantom_server has a poll of phantomjs processes managed by phantom-manager
Each process runs a modified version of rndr.me
These processes are load-balanced by an Nginx HTTP server
The basic flow of page rendering is:
- Your server gets a request to /url
- Your server requests phantom_server to render /url
- phantom_server requests the single-page version of /url from your server
- phantom_server renders the page
- phantom_server returns the fully renderd page to your server
- Your server responds with a fully rendred page
phantom_server is currently configured to work on AWS EC2.
To get started, you will need an EC2 instance with the following:
- tags:
Tag Name | Tag Value |
---|---|
Project | phantom_server |
Env | qa |
Roles | web |
- nginx installed
- phantomjs installed
- ruby, rubygems and bundler installed
- Clone this repository to your machine
- Fill in config/server.yml
- run
cap qa deploy:setup deploy:cold
That's it - You're supposed to have phantom server started!
phantom_server is intended to work with phantom_renderer which runs on your server and performs the communication with the phantom server.