An example project for deploying Grouparoo on Heroku.
Goal: To create a scalable and flexible Grouparoo deployment that:
- Has no servers to directly manage
- Can be auto-scaled as needed
- Will be automatically deployed when the code changes
- Is a 12-factor app with all configuration stored in the Environment
Some of the setup steps have already been done for you to create this app. Here's what we've taken care of:
- Create a new Grouparoo project. Learn more @ https://www.grouparoo.com/docs/installation.
npm install -g grouparoo
grouparoo init .
-
Install the Grouparoo plugins you want, e.g.:
grouparoo install @grouparoo/postgres. Learn more @ https://www.grouparoo.com/docs/installation/plugins -
Create the
Procfileto enable bothwebandworkerdynos. We are running the same code, but using in-line environment varaibles to configure if the instance should boot as a web server or worker.
web: cd node_modules/@grouparoo/core && WEB_SERVER=true WORKERS=0 ./bin/start
worker: cd node_modules/@grouparoo/core && WEB_SERVER=false WORKERS=10 ./bin/start
Assuming you have node.js installed (v12+):
git clone https://github.com/grouparoo/app-example-heroku.gitcd app-example-herokunpm installcp .env.example .envnpm start
- Create a new Heroku app with
Heroku PostgresandHeroku Redis.- Add the Heroku add-on
heroku-postgresviaheroku addons:create heroku-postgresql:<PLAN_NAME>or the heroku website. Learn more about the plan options here: https://devcenter.heroku.com/articles/heroku-postgresql. This add-on will set the Environment VariableDATABASE_URLwhich Grouparoo will automatically use. We recommend at leaststandard2for the Postgres Database - Add the Heroku add-on
heroku-redisviaheroku addons:create heroku-redis:<PLAN_NAME>or the heroku website. Learn more about the plan options here: https://devcenter.heroku.com/articles/heroku-redis. This add-on will set the Environment VariableREDIS_URLwhich Grouparoo will automatically use. We recommend at leastpremium0for the Redis Database
- Add the Heroku add-on
- Configure Heroku to automatically deploy the
mainbranch of your repository on thedeploytab of the Heroku website for your app. - Configure the following environment variables:
DATABASE_SSL_SELF_SIGNED=true- The lower tier of Heroku databases use self-signed SSL certificatesGROUPAROO_LOGS_STDOUT_DISABLE_TIMESTAMP=true- Heroku adds timestamps to all log messagesGROUPAROO_LOGS_STDOUT_DISABLE_COLOR=true- Heroku will not render log messages in color
Click this button to deploy a copy of this repository!
- You can scale the number of
webandworkerprocesses with theheroku pscommand. Depending on your workload, you may need more of one type of process than another. - Grouparoo will source Heroku's
PORTvariable automatically to bind to the proper port. - Heroku uses a
Procfileto define thewebandworkerdynos. - This repo also powers the
Deploy with Herokubutton, so there's anapp.jsonfile to configure that deployment. You won't need that in your project.
Visit https://github.com/grouparoo/app-examples to see other Grouparoo Example Projects.