Situation:
I want to run some app on my vps ubuntu server for crawl testing purposes.
My app uses meteor-router from ‘atmosphere’ with mrt package manager.
On my local mac os x 10.8 with phantomjs, installed with brew, everything goes fine. I get nice snapshot of my page by adding
http://sample.com/?_escaped_fragment_=
to url.
Problem:
Lets try the same on my ubuntu vps server. 2 ways:
1) copy not bundled app to server and run it with mrt run command: It works unstable. Sometimes it renders ok. But sometimes my dynamic content is blank. Like my db is empty.
2) copy not bundled app to server and mrt bundle fname.tgz it, then unpack .tgz and run its main.js with node. This way spiderable works absolutely wrong. i get blank instead of dynamic data every time i try.
My ideas:
My ubuntu machine has a lot less memory and processor resources than my local machine. That is why it takes more time to generate dynamic content, but phantom thinks that page is over and makes snapshot before meteor render.
Any suggestions?
I think I solved this issue.
It is really a problem in spiderable.js file.
this module runs phantomjs in REPL state and gives him such code by stdin:
The problem is when all Meteor conditions are passed, it thinks that page.content is 100% updated. But it is not. The solution i found and tested is to wrap
ifblock insetTimeout(500ms worked for me just fine):