8  Make

Make automates common shell commands into named targets. On an ndexr server, the Makefile in ~/public/ provides shortcuts for the Docker Compose workflow.

8.1 The ndexr Makefile

scale = 2
profile = ndexrio

logs:
    docker compose --profile=$(profile) logs -f

down:
    docker compose --profile=$(profile) down

build:
    docker compose --profile=$(profile) build

buildnc:
    docker compose --profile=$(profile) build --no-cache

upnc: buildnc scale
    docker compose --profile=$(profile) up -d --remove-orphans

up: build scale
    docker compose --profile=$(profile) up -d --remove-orphans

scale:
    docker compose --profile=$(profile) up --scale $(profile)=$(scale) -d

8.2 Common commands

Start the Shiny app with 10 workers:

make up profile=ndexrio scale=10

Start the database services:

make up profile=db

Watch logs:

make logs profile=ndexrio

Stop everything:

make down profile=ndexrio

Rebuild without cache (useful when dependencies change):

make upnc profile=ndexrio scale=10

8.3 How it connects

Running make up profile=ndexrio scale=10:

  1. Make calls docker compose build to build the container image
  2. Make calls docker compose up --scale ndexrio=10 to start 10 instances
  3. Each instance gets a port from the 9001-9010 range
  4. NGINX is already configured to distribute traffic across those ports

You can add your own targets to the Makefile for anything you repeat — deploying a specific service, running database migrations, pulling updated configs.