Coder Social home page Coder Social logo

oscarmorrison / nightmare-heroku Goto Github PK

View Code? Open in Web Editor NEW
45.0 9.0 27.0 17 KB

😱 a setup for nightmarejs on heroku

Home Page: http://blog.oscarmorrison.com/nightmarejs-on-heroku-the-ultimate-scraping-setup/

License: MIT License

Shell 10.40% JavaScript 89.60%
nightmare nightmarejs scraper scary heroku node

nightmare-heroku's Introduction

logo

NightmareJS on Heroku Heroku deploy

contributions welcome license GitHub issues

Intro

NightmareJS is an awesome highlevel webscraping and browser automation library built ontop of electron. This repo is a good starting place to be able to use it with some default setups ontop of heroku using the following instructions. Read more

Getting started

  • git clone --depth 1 [email protected]:oscarmorrison/nightmare-heroku [new-project-name]

  • cd [new-project-name]

  • rm -rf .git

  • git init

  • setup git remote repository on github.com from existing code

git remote add origin [email protected]:[username]/[new-project-name].git
git add -A
git commit -m "Initial commit"
git push -u origin master
  • heroku create
  • heroku stack:set cedar-14
  • set build packs
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt &&
heroku buildpacks:add --index 2 https://github.com/captain401/heroku-buildpack-xvfb.git &&
heroku buildpacks:add --index 3 https://github.com/causztic/heroku-electron-buildpack.git &&
heroku buildpacks:add --index 4 https://github.com/heroku/heroku-buildpack-nodejs.git
  • git push heroku master
  • goto heroku dashboard and select created app; install Heroku Scheduler add-on
  • heroku ps:scale web=0
  • node ./index.js to verify nightmare runs correctly locally; npm install needs to be run. The following output should be seen.
Welcome to Nightmare scrape
==========
NightmareJS on Heroku the ultimate scraping setup
=========
All done
  • Open heroku app from heroku dashboard. 'Application error' is displayed because no routes have been defined yet so this is normal in this case.
  • heroku logs to check output for any errors. If everything went well, near the bottom of the output the 'Welcome to Nightmare scrape' messages as displayed above should appear. Now, you can work on the rest of your code knowing that nightmarejs will work on heroku as it works locally.

Debugging

Other

You may need to set a engines in package.json:

"engines": {
      "node": "8.11.4"
  },

nightmare-heroku's People

Contributors

f-flores avatar m-tambo avatar oscarmorrison avatar seanpascoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nightmare-heroku's Issues

electron error: symbol lookup error, undefined symbol

Hey @oscarmorrison , first of all, thanks for putting the time into this.
I've followed your directions with a couple different instances and I keep getting the same error:

  electron:stderr /app/node_modules/electron/dist/electron: symbol lookup error: /app/node_modules/electron/dist/electron: undefined symbol: _ZN12v8_inspector8protocol8Debugger3API6Paused10ReasonEnum3XHRE +96ms
  nightmare electron child process exited with code 127: command not found - you may not have electron installed correctly +8ms

Do you have any idea what this is about? Thanks again

Pairing with a web server?

This has been very helpful, thank you! I have a web server that when pinged, runs nightmarejs and saves some results. I just realized nightmare is running from my node/express server. Do you have any suggestions for passing off work from the web server to the worker?

EDIT: Ah, think this is getting at my need: https://devcenter.heroku.com/articles/asynchronous-web-worker-model-using-rabbitmq-in-node -- perhaps would be cool to incorporate something similar to your repo!

SyntaxError: Unexpected token ILLEGAL

Having a weird syntax error that I can't figure out. Any help would be great!
This is my Heroku Logs. No idea where this error could be coming from so if you need to see other files I'm happy to provide them.

2017-08-24T22:11:42.361900+00:00 heroku[worker.1]: Starting process with command `DEBUG=* xvfb-run --auto-servernum --server-args="-screen 0 1024x768x24" node --harmony .meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2017-08-24T22:11:43.097597+00:00 heroku[worker.1]: State changed from starting to up
2017-08-24T22:11:48.404983+00:00 heroku[worker.1]: Process exited with status 1
2017-08-24T22:11:48.229718+00:00 app[worker.1]: /app/.meteor/heroku_build/bin/node:1
2017-08-24T22:11:48.229746+00:00 app[worker.1]: (function (exports, require, module, __filename, __dirname) { �ELF���
2017-08-24T22:11:48.229755+00:00 app[worker.1]:                                                               ^
2017-08-24T22:11:48.229763+00:00 app[worker.1]: 
2017-08-24T22:11:48.229764+00:00 app[worker.1]: SyntaxError: Unexpected token ILLEGAL
2017-08-24T22:11:48.229765+00:00 app[worker.1]:     at exports.runInThisContext (vm.js:53:16)
2017-08-24T22:11:48.229765+00:00 app[worker.1]:     at Module._compile (module.js:373:25)
2017-08-24T22:11:48.229766+00:00 app[worker.1]:     at Object.Module._extensions..js (module.js:416:10)
2017-08-24T22:11:48.229767+00:00 app[worker.1]:     at Module.load (module.js:343:32)
2017-08-24T22:11:48.229768+00:00 app[worker.1]:     at Function.Module._load (module.js:300:12)
2017-08-24T22:11:48.229768+00:00 app[worker.1]:     at Function.Module.runMain (module.js:441:10)
2017-08-24T22:11:48.229769+00:00 app[worker.1]:     at startup (node.js:140:18)
2017-08-24T22:11:48.229770+00:00 app[worker.1]:     at node.js:1043:3
2017-08-24T22:11:48.439650+00:00 heroku[worker.1]: State changed from up to crashed

libXss not found

No matter what I do, anything involving Nightmare/Electron on Heroku crashes like so:

Process exited with status 0

No errors or anything, the "Welcome to Nightmare scare" log message occurs and then nothing. Full logs below:

2017-06-16T14:08:40.000000+00:00 app[api]: Build succeeded
2017-06-16T14:10:20.534553+00:00 heroku[web.1]: Starting process with command `npm start`
2017-06-16T14:10:23.419781+00:00 app[web.1]:
2017-06-16T14:10:23.419795+00:00 app[web.1]: > [email protected] start /app
2017-06-16T14:10:23.419796+00:00 app[web.1]: > node index.js
2017-06-16T14:10:23.419796+00:00 app[web.1]:
2017-06-16T14:10:23.702317+00:00 app[web.1]: Welcome to Nightmare scrape
2017-06-16T14:10:23.702331+00:00 app[web.1]: ==========
2017-06-16T14:10:23.982112+00:00 heroku[web.1]: Process exited with status 0
2017-06-16T14:10:23.995483+00:00 heroku[web.1]: State changed from starting to crashed
2017-06-16T14:10:23.996544+00:00 heroku[web.1]: State changed from crashed to starting
2017-06-16T14:10:30.171802+00:00 heroku[web.1]: Starting process with command `npm start`
2017-06-16T14:10:32.263245+00:00 app[web.1]:
2017-06-16T14:10:32.263264+00:00 app[web.1]: > [email protected] start /app
2017-06-16T14:10:32.263266+00:00 app[web.1]: > node index.js
2017-06-16T14:10:32.263266+00:00 app[web.1]:
2017-06-16T14:10:32.399945+00:00 app[web.1]: Welcome to Nightmare scrape
2017-06-16T14:10:32.399949+00:00 app[web.1]: ==========
2017-06-16T14:10:32.584567+00:00 heroku[web.1]: Process exited with status 0
2017-06-16T14:10:32.592243+00:00 heroku[web.1]: State changed from starting to crashed

Nightmare in heroku not called

@oscarmorrison i cloned your sample app and deployed in heroku it wont reate any errors but i cant able to get results,it halts,can you please help me to resolve that,im using free version of heroku.

Unable to clone repo despite public ssh

I'm not all that familiar with the workings of (public) ssh keys, but despite having a working public ssh (id_rsa), I'm unable to clone your repo. It results in the the error:
[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

Heroku crashes after starting

As soon as I start the app it crashes with this error:
2019-02-21T04:11:48.050563+00:00 heroku[web.1]: Process exited with status 139

I've done nothing but clone the repo and follow the instructions.

app unreachable - heroku has suggestions

An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the
Heroku CLI with the command
heroku logs --tail

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.