Closed daviddekoning closed 4 years ago
Hey @AntoineDao! If you want to, explore away! I think keeping the DBs dependencies separate from the app deployment script is preferable (as you mentioned), but i'm not a Heroku user so I can't judge. I'll ping @pearswj as he's fumbled originally with this some time ago (before redis was needed).
Thanks for the ping, @didimitrie! I had a Speckle server running on Heroku a couple of years ago, but moved it to Ubuntu after having problems with the frontend. Since learning that you can use https://app.speckle.systems instead of running the frontend plugin yourself (which also gave me issues when trying to deploy with Docker recently!) I had another crack at running just the server on Heroku again – it works! 🤘
Test server at https://lit-caverns-50107.herokuapp.com
.
In terms of configuration, Heroku sets the MONGODB_URI
, REDIS_URL
and PORT
environment variables for you. Then there are a few env vars that I found to be necessary for a working Speckle server...
CANONICAL_URL: https://lit-caverns-50107.herokuapp.com
FIRST_USER_ADMIN: true
SERVER_NAME: Heroku Speckle Server
PLUGIN_DIRS: ./node_modules/@speckle,./plugins
PUBLIC_REGISTRATION: true
REDIRECT_URLS: https://app.speckle.systems
SESSION_SECRET: somethingsupersecret
USE_LOCAL: true
Finally, I ran into an issue with the number of Redis connections on the Hobby Dev plan.
...
2020-01-29T11:15:14.932760+00:00 app[web.1]: 2020-01-29 11:15:14 debug: Speckle worker process 345 now running on port 20015.
2020-01-29T11:15:14.946223+00:00 app[web.1]: 2020-01-29 11:15:14 debug: 345 connected to redis.
2020-01-29T11:15:14.951845+00:00 app[web.1]:
2020-01-29T11:15:14.951848+00:00 app[web.1]: events.js:200
2020-01-29T11:15:14.951851+00:00 app[web.1]: throw er; // Unhandled 'error' event
2020-01-29T11:15:14.951853+00:00 app[web.1]: ^
2020-01-29T11:15:14.953996+00:00 app[web.1]: ReplyError: ERR max number of clients reached
2020-01-29T11:15:14.953999+00:00 app[web.1]: at parseError (/app/node_modules/redis-parser/lib/parser.js:193:12)
2020-01-29T11:15:14.954001+00:00 app[web.1]: at parseType (/app/node_modules/redis-parser/lib/parser.js:303:14)
2020-01-29T11:15:14.954003+00:00 app[web.1]: Emitted 'error' event on RedisClient instance at:
2020-01-29T11:15:14.954005+00:00 app[web.1]: at /app/node_modules/redis/index.js:310:22
2020-01-29T11:15:14.954008+00:00 app[web.1]: at Object.callbackOrEmit [as callback_or_emit] (/app/node_modules/redis/lib/utils.js:89:9)
...
Heroku's free dyno defaults to starting 8 worker processes. Setting MAX_PROC=4
seems to fix this.
I think it would be possible to set up a "Deploy to Heroku" button by including an app.json file in the repo.
@AntoineDao – out of curiosity, I experimented with adding an app.json and "Deploy to Heroku" button the readme. Could you please go here and test it?
The only awkward thing is that you need to configure both "App name" and CANONICAL_URL
, otherwise everything else can be left as the default values.
@pearswj sorry for replying so late to this. Was about to have a look at setting up an app.json file (keeping myself busy in quarantine) but it seems that your set up totally works! Awesome work! :smile: You should totally PR these changes in!
Sure thing, I'll send a pull request! Hope you found another project to pass the time :D
Awesome work thanks for this @pearswj :smile:
:tada: This issue has been resolved in version 1.9.10 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
I'm interested in helping develop this if you're struggling with capacity. Top of my head the easiest way to do this is with a
heroku.yml
file as indicated here however I think this will only suitside hustle
use cases rather than reliable enterprise deploys. This is because managing a MongoDB and a Redis DB using only docker containers that will not be able to cluster/scale/resist node failures will make for an unhappy user in the medium term.As a side note, it's worth noting it might be possible to run deployment scripts that make use of the Heroku Redis offering and then connect to an existing or deploy an MLab MongoDB instance.