weaveworks-experiments / scope-swarm-launcher

Weave Cloud Scope installer for Docker Swarm

Home Page:https://www.weave.works/oss/scope/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document self-hosted deploy

thejmazz opened this issue · comments

On a personal swarm I got weavescope setup like so:

(used a --follow weavescope instead of sed'ing out the -d like here)

Also I had to hardcode the private IP of the node running the app which binds 4040 on the host.

It would be neat if the scope-swarm-launcher to intercept a SIGKILL and then stop the container ran "manually" on host. Also there is no mention of Swarm setup on the website docs, maybe it is considered too experimental? At the very least a link to this repo would be nice.

version: '3.5'

services:
  app:
    image: weaveworks/scope
    command:
      - /home/weave/scope
      - --mode=app
    networks:
      - traefik_net
    ports:
      - target: 4040
        published: 4040
        mode: host
        protocol: tcp
    deploy:
      mode: replicated
      placement:
        constraints:
          - "node.hostname==swarm-manager-02"
      replicas: 1
      labels:
        - "traefik.port=4040"
        - "traefik.docker.network=traefik_net"

  probe-launcher:
    image: weaveworks/scope-swarm-launcher
    command:
      - /bin/sh
      - -c
      - |
        scope launch --mode=probe --probe-only --probe.docker.bridge=docker0 --probe.docker=true $SWARM_MANAGER_2_PRIVATE_IP:4040
        docker logs --follow weavescope
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    deploy:
      mode: global

  # since it launches a standalone container on each host, to clean up you need to:
  # (use case for having terraform output an ansible inventory)
  # docker stop $(docker ps -a | grep weavescope | awk '{print $1}') && docker rm $(docker ps -a | grep weavescope | awk '{print $1}')

networks:
  traefik_net:
    external: true