codebuddies / cb-connect

Platform to connect mentors with mentees, accountability partners, and OS project maintainers with new contributors
GNU General Public License v3.0
14 stars 8 forks source link

Setup automated deploys of Staging branch to Heroku #51

Closed lpatmo closed 5 years ago

lpatmo commented 5 years ago

Set up Travis so that it automatically deploys our staging branch to Heroku. For reference: https://docs.travis-ci.com/user/deployment/heroku/

angelocordon commented 5 years ago

@lpatmo Do we have a staging instance setup yet? Is the idea that the production branch going to Digital Ocean and Staging should go up to Heroku?

lpatmo commented 5 years ago

Sorry, didn't see this earlier. Production should go to DigitalOcean and staging can go to Heroku, yes.

angelocordon commented 5 years ago

Currently in progress -- looks like we're having some Mongo issues in Heroku, looking to figure it out within the next few days. Last logs:

2019-04-29T07:10:54.346195+00:00 app[web.1]: at authenticateStragglers (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:504:16)
2019-04-29T07:10:54.346197+00:00 app[web.1]: at Connection.messageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:540:5)
2019-04-29T07:10:54.346199+00:00 app[web.1]: at emitMessageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:310:10)
2019-04-29T07:10:54.346200+00:00 app[web.1]: at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:453:17)
2019-04-29T07:10:54.346202+00:00 app[web.1]: at emitOne (events.js:116:13)
2019-04-29T07:10:54.346204+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2019-04-29T07:10:54.346206+00:00 app[web.1]: at addChunk (_stream_readable.js:263:12)
2019-04-29T07:10:54.346208+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:250:11)
2019-04-29T07:10:54.346209+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:208:10)
2019-04-29T07:10:54.346211+00:00 app[web.1]: at TCP.onread (net.js:597:20)
2019-04-29T07:10:54.439017+00:00 heroku[web.1]: Process exited with status 1
2019-04-29T10:00:24.459239+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-29T10:00:38.271412+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2019-04-29T10:00:41.348453+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-29T10:00:41.256280+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:313
2019-04-29T10:00:41.256303+00:00 app[web.1]: throw(ex);
2019-04-29T10:00:41.256305+00:00 app[web.1]: ^
2019-04-29T10:00:41.256307+00:00 app[web.1]: 
2019-04-29T10:00:41.256309+00:00 app[web.1]: MongoError: Authentication failed.
2019-04-29T10:00:41.256311+00:00 app[web.1]: at /app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:581:63
2019-04-29T10:00:41.256322+00:00 app[web.1]: at authenticateStragglers (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:504:16)
2019-04-29T10:00:41.256324+00:00 app[web.1]: at Connection.messageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:540:5)
2019-04-29T10:00:41.256326+00:00 app[web.1]: at emitMessageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:310:10)
2019-04-29T10:00:41.256327+00:00 app[web.1]: at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:453:17)
2019-04-29T10:00:41.256329+00:00 app[web.1]: at emitOne (events.js:116:13)
2019-04-29T10:00:41.256331+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2019-04-29T10:00:41.256332+00:00 app[web.1]: at addChunk (_stream_readable.js:263:12)
2019-04-29T10:00:41.256334+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:250:11)
2019-04-29T10:00:41.256336+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:208:10)
2019-04-29T10:00:41.256337+00:00 app[web.1]: at TCP.onread (net.js:597:20)
2019-04-29T10:00:41.323738+00:00 heroku[web.1]: Process exited with status 1
2019-04-29T15:44:35.706918+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-29T15:44:46.997721+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2019-04-29T15:44:49.411501+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-29T15:44:49.337423+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:313
2019-04-29T15:44:49.337448+00:00 app[web.1]: throw(ex);
2019-04-29T15:44:49.337450+00:00 app[web.1]: ^
2019-04-29T15:44:49.337452+00:00 app[web.1]: 
2019-04-29T15:44:49.337454+00:00 app[web.1]: MongoError: Authentication failed.
2019-04-29T15:44:49.337456+00:00 app[web.1]: at /app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:581:63
2019-04-29T15:44:49.337470+00:00 app[web.1]: at authenticateStragglers (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:504:16)
2019-04-29T15:44:49.337472+00:00 app[web.1]: at Connection.messageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:540:5)
2019-04-29T15:44:49.337474+00:00 app[web.1]: at emitMessageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:310:10)
2019-04-29T15:44:49.337475+00:00 app[web.1]: at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:453:17)
2019-04-29T15:44:49.337477+00:00 app[web.1]: at emitOne (events.js:116:13)
2019-04-29T15:44:49.337479+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2019-04-29T15:44:49.337481+00:00 app[web.1]: at addChunk (_stream_readable.js:263:12)
2019-04-29T15:44:49.337483+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:250:11)
2019-04-29T15:44:49.337485+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:208:10)
2019-04-29T15:44:49.337486+00:00 app[web.1]: at TCP.onread (net.js:597:20)
2019-04-29T15:44:49.392967+00:00 heroku[web.1]: Process exited with status 1
2019-04-29T19:35:51.577192+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=cbconnect.herokuapp.com request_id=8d223031-80dc-4925-9d88-01a083e94047 fwd="141.8.144.44" dyno= connect= service= status=503 bytes= protocol=http
2019-04-29T19:35:55.428105+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cbconnect.herokuapp.com request_id=0cf887a2-059d-466e-a91a-a8d4ff5f25a9 fwd="141.8.144.44" dyno= connect= service= status=503 bytes= protocol=http
2019-04-29T19:35:59.210253+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cbconnect.herokuapp.com request_id=cbc1a0c2-85b8-46e9-bc79-55350686bf42 fwd="77.88.5.8" dyno= connect= service= status=503 bytes= protocol=http
2019-04-29T19:36:02.889793+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cbconnect.herokuapp.com request_id=3354dc99-aaa5-44f1-b932-2b308cd38cd9 fwd="93.158.161.100" dyno= connect= service= status=503 bytes= protocol=http
2019-04-29T21:30:50.106384+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-29T21:31:06.448680+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2019-04-29T21:31:11.033501+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-29T21:31:11.014731+00:00 heroku[web.1]: Process exited with status 1
2019-04-29T21:31:10.885928+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:313
2019-04-29T21:31:10.885946+00:00 app[web.1]: throw(ex);
2019-04-29T21:31:10.885948+00:00 app[web.1]: ^
2019-04-29T21:31:10.885950+00:00 app[web.1]: 
2019-04-29T21:31:10.885951+00:00 app[web.1]: MongoError: Authentication failed.
2019-04-29T21:31:10.885953+00:00 app[web.1]: at /app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:581:63
2019-04-29T21:31:10.885967+00:00 app[web.1]: at authenticateStragglers (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:504:16)
2019-04-29T21:31:10.885969+00:00 app[web.1]: at Connection.messageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:540:5)
2019-04-29T21:31:10.885970+00:00 app[web.1]: at emitMessageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:310:10)
2019-04-29T21:31:10.885972+00:00 app[web.1]: at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:453:17)
2019-04-29T21:31:10.885973+00:00 app[web.1]: at emitOne (events.js:116:13)
2019-04-29T21:31:10.885975+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2019-04-29T21:31:10.885977+00:00 app[web.1]: at addChunk (_stream_readable.js:263:12)
2019-04-29T21:31:10.885978+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:250:11)
2019-04-29T21:31:10.885980+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:208:10)
2019-04-29T21:31:10.885981+00:00 app[web.1]: at TCP.onread (net.js:597:20)
2019-04-30T01:47:19.690773+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/robots.txt" host=cbconnect.herokuapp.com request_id=3f0f7350-86a9-40b9-8a03-d23f42cba7a9 fwd="178.154.246.138" dyno= connect= service= status=503 bytes= protocol=http
2019-04-30T01:47:23.431013+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cbconnect.herokuapp.com request_id=454f2cb6-bc55-4b03-a03a-4d09278daeca fwd="37.9.87.212" dyno= connect= service= status=503 bytes= protocol=http
2019-04-30T01:47:27.248249+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cbconnect.herokuapp.com request_id=f4d15c1e-fb5f-483f-b3ab-4e252b388a39 fwd="100.43.90.113" dyno= connect= service= status=503 bytes= protocol=http
2019-04-30T01:47:30.775678+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cbconnect.herokuapp.com request_id=3fd1b18a-edf0-4bae-8680-0ec0796d3f99 fwd="100.43.85.185" dyno= connect= service= status=503 bytes= protocol=http
2019-04-30T01:47:31.009110+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=cbconnect.herokuapp.com request_id=500d6ef1-d2f7-42cf-a11e-16453b77a2a5 fwd="100.43.85.185" dyno= connect= service= status=503 bytes= protocol=http
2019-04-30T03:15:04.379380+00:00 heroku[web.1]: State changed from crashed to starting
2019-04-30T03:15:18.835118+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2019-04-30T03:15:22.859009+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-30T03:15:22.843104+00:00 heroku[web.1]: Process exited with status 1
2019-04-30T03:15:22.760216+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:313
2019-04-30T03:15:22.760242+00:00 app[web.1]: throw(ex);
2019-04-30T03:15:22.760244+00:00 app[web.1]: ^
2019-04-30T03:15:22.760245+00:00 app[web.1]: 
2019-04-30T03:15:22.760247+00:00 app[web.1]: MongoError: Authentication failed.
2019-04-30T03:15:22.760249+00:00 app[web.1]: at /app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:581:63
2019-04-30T03:15:22.760263+00:00 app[web.1]: at authenticateStragglers (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:504:16)
2019-04-30T03:15:22.760266+00:00 app[web.1]: at Connection.messageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/pool.js:540:5)
2019-04-30T03:15:22.760267+00:00 app[web.1]: at emitMessageHandler (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:310:10)
2019-04-30T03:15:22.760269+00:00 app[web.1]: at Socket.<anonymous> (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb-core/lib/connection/connection.js:453:17)
2019-04-30T03:15:22.760270+00:00 app[web.1]: at emitOne (events.js:116:13)
2019-04-30T03:15:22.760272+00:00 app[web.1]: at Socket.emit (events.js:211:7)
2019-04-30T03:15:22.760274+00:00 app[web.1]: at addChunk (_stream_readable.js:263:12)
2019-04-30T03:15:22.760276+00:00 app[web.1]: at readableAddChunk (_stream_readable.js:250:11)
2019-04-30T03:15:22.760277+00:00 app[web.1]: at Socket.Readable.push (_stream_readable.js:208:10)
2019-04-30T03:15:22.760279+00:00 app[web.1]: at TCP.onread (net.js:597:20)
angelocordon commented 5 years ago

Made some progress by using my personal MongoDB Atlas account; will be working with @lpatmo on correcting authentication issues with the correct Mongo database. I believe it might be due to whitelisting IP addresses and due to Heroku using dynamic IPs, we'd have to allow all IP address (open to better ideas here, this doesn't seem to be too secure but 1. it's staging and 2. it's been the only way I've made it work so far. See this SO reference)

Second snag was getting build errors as our email configuration are looking for environment variables that were not defined in production (this is typically done by passing dev-settings.json through the settings parameter when we run meteor). I've gotten around it by using a stringified version of dev-settings and defining it as an environment variable in Heroku (ref). I think ideally we should move away from using JSON settings and instead move towards using proper environment variables, but will circle back to that at a later time.

angelocordon commented 5 years ago

Solved by following above references, and adding proper roles and users to MongoDB Atlas; then connecting to staging server with correct authentication keys.