Docker

Last Updated: 2020-08-01

Grouparoo is easy to deploy with Docker and Docker Compose. An example project can be found at https://github.com/grouparoo/app-example-docker.

Step 1: Create a new git repository and Grouparoo Project

Create a new git repository on your local machine. Note the following:

  • Do not include an environment file, .env. Your environment variables will be managed by Docker
  • Include a package.json file which contains your dependencies
  • Include a .dockerignore file which excludes node_modules and any local config you might have (ie: .env)

Step 2: Build your Dockerfile

Include a Dockerfile which is similar the to the below. We are building a single Dockerfile which can be used in multiple modes. For example, the image can be run as a background task worker (WEB_SERVER=false, WORKERS=10) or web server (WEB_SERVER=true, WORKERS=0). These settings are controlled by environment variables. The default environment variables set here are expected to be overridden by your runtime environment (Swarm, Kubernetes, etc).

# Dockerfile
FROM node:16

WORKDIR /grouparoo

ENV NODE_ENV=production
ENV PORT=3000
ENV WEB_URL=https://grouparoo.company.com:$PORT
ENV WEB_SERVER="true"
ENV SERVER_TOKEN="change-me"
ENV WORKERS=1
ENV REDIS_URL="redis://redis:6379/0"
ENV DATABASE_URL="postgresql://postgres:password@db:5432/grouparoo_docker"

COPY . .
RUN npm install
RUN npm prune

WORKDIR /grouparoo/node_modules/@grouparoo/core
CMD ["./bin/start"]

EXPOSE $PORT/tcp

Step 3: Build your docker image

Run:

docker build .

Step 4: Run Your Image

Push and run your docker image!

grouparoo/omnibus

You can also try the grouparoo/omnibus docker image. This Docker image contains a number of popular Grouparoo plugins, including commercially licensed @grouparoo/ui-enterprise package. You can trial this docker image for a 1-month period before contacting us for a license.

curl -L https://www.grouparoo.com/docker-compose --output docker-compose.yml
docker compose up
# wait for boot
# visit http://localhost:3000

This project may be a good reference if you need to install private NPM packages within your Docker image.