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
Procfile
to enable bothweb
andworker
dynos. 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.git
cd app-example-heroku
npm install
cp .env.example .env
npm start
- Create a new Heroku app with
Heroku Postgres
andHeroku Redis
.- Add the Heroku add-on
heroku-postgres
viaheroku 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_URL
which Grouparoo will automatically use. We recommend at leaststandard2
for the Postgres Database - Add the Heroku add-on
heroku-redis
viaheroku 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_URL
which Grouparoo will automatically use. We recommend at leastpremium0
for the Redis Database
- Add the Heroku add-on
- Configure Heroku to automatically deploy the
main
branch of your repository on thedeploy
tab 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
web
andworker
processes with theheroku ps
command. Depending on your workload, you may need more of one type of process than another. - Grouparoo will source Heroku's
PORT
variable automatically to bind to the proper port. - Heroku uses a
Procfile
to define theweb
andworker
dynos. - This repo also powers the
Deploy with Heroku
button, so there's anapp.json
file 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.