Phantomjs install via composer on a domain


#1

Would anyone who has figured out getting phantomjs / PHP phantomjs via composer set up on a Reclaim site be willing to walk me through how you did it?

I’ve tried using the init process to build the composer.js file. I’ve also written my composer.js file by hand. I can’t seem to get phantomjs to install nicely in the ‘bin’ folder I’ve specified. In fact, I can’t tell if it’s installing at all.

My ultimate goal is to write a php file I can run via cron that makes screen-captured thumbnails of DoOO sites. I’m feeling really good about what I have for that because I borrowed from folks who know what they’re doing. What I have adapted works great on my mac, either from the command line or as a php file kicked-off through a browser. But until I get phantomjs running on a domain, I can’t do the rest.

I’ve been trying to figure this out for two weeks and I’m (embarrassed
and) stumped. Thanks in advance.


#2

@bionicteaching Didn’t you use PhantomJS for some of the community stuff you were building with a few schools for taking screenshots of the domain? Did you have to do anything special?


#3

Yeah. I did that with the sites plugin and I’ve run that on a few different sites (rampages and a few different reclaim shared hosting sites). I ran it plain and as part of the wp plugin.

I pretty much brute forced it in the plugin and then made sure it was executable when we got it on the server. I never got it working correctly on my local dev VVV install.


#4

Sorry, I don’t exactly follow. What do you mean ‘got it on the server’? By executable, do you mean the phantomjs binary? Did you not build phantomjs by installing with composer? If there is another means, I’m up to try that.


#5

I’m hard to follow because I often don’t make sense.

I did mean making the phantomjs binary executable.

I believe you can just download the binary to your computer and then get it on the server via ssh. In the sites plugin, it’s in there already. I didn’t bother with composer installs on the various server as the hassle != the benefits for me. You might have to alter whatever paths your using to go wherever you opt to put it.


#6

You get this settled?


#7

I never got the phantomjs binary to work on a domain, most likely because I’m doing something wrong. I was a little nervous about putting too much effort into phantomjs when it looks like the project might be abandoned or at least not fully supported in the future: phantomjs is dead. I think it will be a slow death, but a death all the same.

So I’ve written something in node.js using puppeteer
Puppeteer  |  Tools for Web Developers  |  Google Developers . And get this – it works!

I have this about 90-95% working. I still get exceptions every once in awhile when folks have incorporated video into the front page of their theme. Again, mostly because I don’t know what I’m doing. But I’m working out those issues as they arise, too.

My next scheme is to try and look at puppeteer/chromium as an app that can be installed inside a domain through the “setup node.js app” feature. Once I’ve learned more about that, I’m hopeful that 100% of this project can run on domains. Right now, I’m running just the thumbnail generation part from my laptop.

I’ll clean everything up and share it, in case anyone is interested, in the next couple weeks.
Thanks for checking on me!


#8

Nice! Sounds like a smart path and I look forward to seeing what you end up with.