An example project for deploying Grouparoo on Amazon Web Services (AWS
) with ElasticBeanstalk
& CodeDeploy
.
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
- 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 -
Remove any
engines
declaration from yourpackage.json
-
Create the
.npmrc
to enableunsafe-perm
Assuming you have node.js installed (v12+):
git clone https://github.com/grouparoo/app-example-aws.git
cd app-example-aws
npm install
cp .env.example .env
npm start
-
Configure your VPC
- Create an internal Security Group that redis and postgres can use to communicate with the app servers from other members of the security group (port 5432/tcp and 6379/tcp)
-
Create the Grouparoo Database
- Use Aurora + Postgres
- Use
Provisioned
servers, we recommenddb.t3.large
- Create a postgres user + password for the Grouparoo application to use
- Apply the internal Security Group made in step 1
-
Create the Grouparoo Redis Server
- Create 1 replica
- We recommend
cache.t2.small
servers - Apply the internal Security Group made in step 1
- Learn more about connecting to an ElasticCache redis server here
-
Create the Elastic Beanstalk Application + Environments
- Application
Node.js 14 running on 64bit Amazon Linux 2
- Environment:
- Choose to deploy the sample project first
t2.small
instances should be OK
- Enable Config / Managed Updates
- Deploy the Example Project
- Set the Environment variables to link up the application to the Postgres and Redis server, as well as enable the web server and workers (while the example project is deployed).
You can create multiple Environments in the same Application so you can have a WEB and WORKER environment.
- Application
-
Create the CodeDeploy Pipeline to update the application from your git repository
- Do not use a
build
step, all you need isSource
andDeploy
- If you you created multiple Elastic Beanstalk Environments, you can create a second Deploy step within a single CodeDeploy pipeline.
- Do not use a
-
Configure Monitoring
-
Configure Load Balancer, SSL, and DNS
- Elastic Beanstalk needs special install permissions (see
.npmrc
) - Set the ENV first before setting up
AWS CodePipeline
- No need for a
Procfile
, we usenpm start
- Don't use
package.json/engines
, AWS will manage this for you - You may want to modify logging behavior with:
GROUPAROO_LOGS_STDOUT_DISABLE_TIMESTAMP=true
- AWS adds timestamps to all log messagesGROUPAROO_LOGS_STDOUT_DISABLE_COLOR=true
- AWS will not render log messages in color
Visit https://github.com/grouparoo/app-examples to see other Grouparoo Example Projects.