version: '3'

services:
  mongo:
    image: mongo:latest
    volumes:
      - /data/db

  web:
    image: subjectrefresh/shortener:latest
    ports:
      - 8080:8080
    deploy:
      mode: replicated
      replicas: 6
    environment:
      NODE_ENV: production
      PORT: 8080
      SSL: 'true'
      URL: subr.pw
    depends_on:
      - mongo
    command: ["npm", "start"]

version: '3'

services:
  mongo:
    image: mongo:latest
    volumes:
      - /data/db
    deploy:
      placement:
        constraints:
          - node.role == manager

  web:
    image: subjectrefresh/shortener:latest
    ports:
      - 8080:8080
    deploy:
      mode: replicated
      replicas: 6
    environment:
      NODE_ENV: production
      PORT: 8080
      SSL: 'true'
      URL: subr.pw
    depends_on:
      - mongo
    command: ["npm", "start"]

Make sure mongo is pinned to the manager
Make sure mongo is pinned to the manager
