codeclubsocial / codeclub_website_dev

CodeClub website source (website no longer hosted)
http://www.codeclub.social
26 stars 7 forks source link

dev crashed #56

Closed holaymolay closed 7 years ago

holaymolay commented 7 years ago

2017-10-02T06:58:01.955093+00:00 heroku[web.1]: Starting process with command node app.js 2017-10-02T06:58:04.802569+00:00 heroku[web.1]: State changed from starting to crashed 2017-10-02T06:58:04.805175+00:00 heroku[web.1]: State changed from crashed to starting 2017-10-02T06:58:04.789409+00:00 heroku[web.1]: Process exited with status 1 2017-10-02T06:58:04.682763+00:00 app[web.1]: Warning: connect.session() MemoryStore is not 2017-10-02T06:58:04.682780+00:00 app[web.1]: designed for a production environment, as it will leak 2017-10-02T06:58:04.682781+00:00 app[web.1]: memory, and will not scale past a single process. 2017-10-02T06:58:04.725247+00:00 app[web.1]: module.js:471 2017-10-02T06:58:04.725249+00:00 app[web.1]: throw err; 2017-10-02T06:58:04.725250+00:00 app[web.1]: ^ 2017-10-02T06:58:04.725251+00:00 app[web.1]: 2017-10-02T06:58:04.725252+00:00 app[web.1]: Error: Cannot find module 'q' 2017-10-02T06:58:04.725252+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:469:15) 2017-10-02T06:58:04.725253+00:00 app[web.1]: at Function.Module._load (module.js:417:25) 2017-10-02T06:58:04.725254+00:00 app[web.1]: at Module.require (module.js:497:17) 2017-10-02T06:58:04.725254+00:00 app[web.1]: at require (internal/module.js:20:19) 2017-10-02T06:58:04.725255+00:00 app[web.1]: at Object. (/app/config/passport.js:11:20) 2017-10-02T06:58:04.725256+00:00 app[web.1]: at Module._compile (module.js:570:32) 2017-10-02T06:58:04.725256+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10) 2017-10-02T06:58:04.725257+00:00 app[web.1]: at Module.load (module.js:487:32) 2017-10-02T06:58:04.725257+00:00 app[web.1]: at tryModuleLoad (module.js:446:12) 2017-10-02T06:58:04.725258+00:00 app[web.1]: at Function.Module._load (module.js:438:3) 2017-10-02T06:58:04.725259+00:00 app[web.1]: at Module.require (module.js:497:17) 2017-10-02T06:58:04.725259+00:00 app[web.1]: at require (internal/module.js:20:19) 2017-10-02T06:58:04.725260+00:00 app[web.1]: at Object. (/app/app.js:73:1) 2017-10-02T06:58:04.725260+00:00 app[web.1]: at Module._compile (module.js:570:32) 2017-10-02T06:58:04.725261+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10) 2017-10-02T06:58:04.725262+00:00 app[web.1]: at Module.load (module.js:487:32) 2017-10-02T06:58:08.534317+00:00 heroku[web.1]: Starting process with command node app.js 2017-10-02T06:58:12.381366+00:00 app[web.1]: Warning: connect.session() MemoryStore is not 2017-10-02T06:58:12.381385+00:00 app[web.1]: designed for a production environment, as it will leak 2017-10-02T06:58:12.381386+00:00 app[web.1]: memory, and will not scale past a single process. 2017-10-02T06:58:12.436909+00:00 app[web.1]: throw err; 2017-10-02T06:58:12.436906+00:00 app[web.1]: module.js:471 2017-10-02T06:58:12.436909+00:00 app[web.1]: ^ 2017-10-02T06:58:12.436911+00:00 app[web.1]: 2017-10-02T06:58:12.436911+00:00 app[web.1]: Error: Cannot find module 'q' 2017-10-02T06:58:12.436914+00:00 app[web.1]: at Module.require (module.js:497:17) 2017-10-02T06:58:12.436914+00:00 app[web.1]: at require (internal/module.js:20:19) 2017-10-02T06:58:12.436912+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:469:15) 2017-10-02T06:58:12.436915+00:00 app[web.1]: at Object. (/app/config/passport.js:11:20) 2017-10-02T06:58:12.436917+00:00 app[web.1]: at Module.load (module.js:487:32) 2017-10-02T06:58:12.436916+00:00 app[web.1]: at Module._compile (module.js:570:32) 2017-10-02T06:58:12.436913+00:00 app[web.1]: at Function.Module._load (module.js:417:25) 2017-10-02T06:58:12.436916+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10) 2017-10-02T06:58:12.436917+00:00 app[web.1]: at tryModuleLoad (module.js:446:12) 2017-10-02T06:58:12.436918+00:00 app[web.1]: at Function.Module._load (module.js:438:3) 2017-10-02T06:58:12.436918+00:00 app[web.1]: at Module.require (module.js:497:17) 2017-10-02T06:58:12.436919+00:00 app[web.1]: at require (internal/module.js:20:19) 2017-10-02T06:58:12.436920+00:00 app[web.1]: at Object. (/app/app.js:73:1) 2017-10-02T06:58:12.436920+00:00 app[web.1]: at Module._compile (module.js:570:32) 2017-10-02T06:58:12.436921+00:00 app[web.1]: at Object.Module._extensions..js (module.js:579:10) 2017-10-02T06:58:12.436922+00:00 app[web.1]: at Module.load (module.js:487:32) 2017-10-02T06:58:12.551734+00:00 heroku[web.1]: State changed from starting to crashed 2017-10-02T06:58:12.533243+00:00 heroku[web.1]: Process exited with status 1 2017-10-02T06:58:13.964336+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=codeclubsocial.herokuapp.com request_id=cbdac5d1-bdbc-4f0b-9e97-204221c2ac41 fwd="76.102.204.242" dyno= connect= service= status=503 bytes= protocol=http 2017-10-02T06:58:23.553283+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=codeclubsocial.herokuapp.com request_id=5ad0bd6c-6802-420d-b706-86047827a0c6 fwd="76.102.204.242" dyno= connect= service= status=503 bytes= protocol=http 2017-10-02T06:58:40.034640+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=codeclubsocial.herokuapp.com request_id=0574c033-0367-4048-afff-448bbdec18aa fwd="76.102.204.242" dyno= connect= service= status=503 bytes= protocol=http

holaymolay commented 7 years ago

craig, this happened after I merged craig-email-verify

I have no idea of what the reason can be. Any ideas?

craig429 commented 7 years ago

Well, Heroku is distressed! Luckily, it's all good outside of the Heroku environment. This series of commands brings up the site on localhostwithout errors: git clone https://github.com/codeclubsocial/codeclub_website_dev cd codeclub_website_dev/ git checkout dev npm install node app.js

localDB can be true or false (assuming you've got a local DB).

craig429 commented 7 years ago

Cannot find module q

is clearly the kicker. I am available by chat, hangout, or over strawberry lemonades if you are inclined. I hesitate to wade into this Heroku stuff without a wing man.

holaymolay commented 7 years ago

sounds good Craig. We will need to get to the bottom of this, I'm just not sure yet what has changed on the server side.

one clue i happened across suggests line app.js line 59: app.use(session({ secret: 'keyboard cat', resave: false, saveUninitialized: false}));

holaymolay commented 7 years ago

Here's a couple more clues:

craig429 commented 7 years ago

The original showstopper was the "Cannot find module 'q'" error. A quick Google directed me to npm install q and bower. If I wasn't testing on a live site I would roll back the bower install to see if it's really necessary, but we'll leave it for now.

craig429 commented 7 years ago

The next showstopper came when Heroku objected to our site opening servers at port 80 (HTTP) and port 443 (HTTPS).When you do this locally you need to run as root, since ports below 1024 are inaccessible to non-admin users (for good reason). Since Heroku is a proxy environment it doesn't allow Joe Average user to "run as root", so attempts to create servers at ports 80 and 443 fail. Luckily, Heroku takes care of these ports behind the curtain, as well as certs for SSL negotiation, so that code is not necessary for Heroku, but WILL be necessary when we move to a real server. So I've commented out the severs for port 80 and 443 in app.js and included narrative referencing this issue. The site is back up, but I am by no means closing this issue because I don't fully understand what limitations this places on future development such as cross-domain accesses and other use of ports that Heroku may or may not feel like letting us have access to.

For instance, I added a console.log to report the port (nominally 3000) that a third server runs on. It is 33675, which should be imported via process.env.PORT in app.js. However, an env command in the Heroku console returns PORT=19643 so there is a disconnect here. Regardless, pointing a browser at either of these ports does not work.

In fact, an nmap scan of the site returns these open ports: PORT STATE SERVICE 80/tcp open http 110/tcp open pop3 143/tcp open imap 443/tcp open https 993/tcp open imaps 995/tcp open pop3s

So Heroku takes care of managing HTTP, IMAP and POP secure and insecure ports. We'll want to keep that in mind if we ever put up a mail server on the site. But Heroku clearly ignores our third server instantiation and the PORT environment variable has no effect. A journey of discovery commences. Stay tuned.....

craig429 commented 7 years ago

I discovered how to roll back Heroku to a previous release using the command line. I will capture this commentary here, then it will go into our blog when we get that running. Post-rollback, the site is now running: https://github.com/codeclubsocial/codeclub_website_dev/commit/72dc1196977c6d390da17077118dedfecc3a5c86 which was deployed on 9/21. The procedure:

  1. List previous Heroku deploys: heroku releases -a codeclubsocial My list looked like: === codeclubsocial Releases - Current: v68 v68 Deploy f85bedd1 brianjason@gmail.com 2017/10/02 19:16:32 -0700 (~ 15h ago) v67 Deploy e562296e brianjason@gmail.com 2017/10/02 19:13:12 -0700 (~ 15h ago) v66 Deploy c857d22b brianjason@gmail.com 2017/10/02 19:08:53 -0700 (~ 15h ago) v65 Deploy e562296e brianjason@gmail.com 2017/10/02 19:04:54 -0700 (~ 15h ago) v64 Deploy 3633de85 brianjason@gmail.com 2017/10/02 11:36:20 -0700 (~ 22h ago) v63 Deploy f85bedd1 brianjason@gmail.com 2017/10/02 10:36:40 -0700 (~ 23h ago) v62 Deploy 4160ff03 brianjason@gmail.com 2017/10/02 10:18:20 -0700 (~ 24h ago) v61 Deploy 1899dc7e brianjason@gmail.com 2017/10/01 23:57:57 -0700 v60 Deploy 72dc1196 brianjason@gmail.com 2017/09/21 19:08:38 -0700 v59 Deploy ec859afc brianjason@gmail.com 2017/09/18 23:16:38 -0700 v58 Deploy 015f27bf brianjason@gmail.com 2017/09/18 08:30:36 -0700 v57 Deploy 9158b6cf brianjason@gmail.com 2017/09/15 11:01:46 -0700 v56 Deploy cd3c3955 brianjason@gmail.com 2017/09/15 10:33:49 -0700 v55 Deploy 90fa2e04 brianjason@gmail.com 2017/09/14 20:21:47 -0700 v54 Deploy 9e5c6bde brianjason@gmail.com 2017/09/14 19:56:27 -0700

  2. I chose to roll back to the 9/21 deploy, which is Heroku-assigned version V60: heroku rollback v60 -a codeclubsocial Boom. That's it. Re-executing heroku releases -a codeclubsocial now gives me: === codeclubsocial Releases - Current: v69 v69 Rollback to v60 craig429@mac.com 2017/10/03 10:51:38 -0700 (~ 24m ago) v68 Deploy f85bedd1 brianjason@gmail.com 2017/10/02 19:16:32 -0700 (~ 15h ago) v67 Deploy e562296e brianjason@gmail.com 2017/10/02 19:13:12 -0700 (~ 16h ago) v66 Deploy c857d22b brianjason@gmail.com 2017/10/02 19:08:53 -0700 (~ 16h ago) v65 Deploy e562296e brianjason@gmail.com 2017/10/02 19:04:54 -0700 (~ 16h ago) v64 Deploy 3633de85 brianjason@gmail.com 2017/10/02 11:36:20 -0700 (~ 23h ago) v63 Deploy f85bedd1 brianjason@gmail.com 2017/10/02 10:36:40 -0700 (~ 24h ago) v62 Deploy 4160ff03 brianjason@gmail.com 2017/10/02 10:18:20 -0700 (~ 24h ago) v61 Deploy 1899dc7e brianjason@gmail.com 2017/10/01 23:57:57 -0700 v60 Deploy 72dc1196 brianjason@gmail.com 2017/09/21 19:08:38 -0700 v59 Deploy ec859afc brianjason@gmail.com 2017/09/18 23:16:38 -0700 v58 Deploy 015f27bf brianjason@gmail.com 2017/09/18 08:30:36 -0700 v57 Deploy 9158b6cf brianjason@gmail.com 2017/09/15 11:01:46 -0700 v56 Deploy cd3c3955 brianjason@gmail.com 2017/09/15 10:33:49 -0700 v55 Deploy 90fa2e04 brianjason@gmail.com 2017/09/14 20:21:47 -0700

Note that Heroku assigns a new version number to this release. It will persist until a new push happens on dev or another rollback command is issued.

holaymolay commented 7 years ago

Everything seems to be working now. I fixed the signup page as well.