Update Portainer starting method

This now starts agents on all worker nodes, using a dedicated overlay
network for communication between agents.
This commit is contained in:
2018-07-12 10:26:37 +02:00
parent 1e06edb9a5
commit b8dab74293
2 changed files with 54 additions and 13 deletions

View File

@@ -0,0 +1,35 @@
version: '3'
networks:
portainer:
driver: overlay
services:
agent:
image: portainer/agent
environment:
AGENT_CLUSTER_ADDR: tasks.agent
# AGENT_PORT: 9001
# LOG_LEVEL: debug
volumes:
- /var/run/docker.sock:/var/run/docker.sock
networks:
- portainer
deploy:
mode: global
master:
image: portainer/portainer
command: -H tcp://tasks.agent:9001 --tlsskipverify
ports:
- "9000:9000"
volumes:
- ${PORTAINER_DATA}:/data
networks:
- portainer
deploy:
mode: replicated
replicas: 1
placement:
constraints: [node.role == manager]

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (c) 2017-2018
# Copyright (c) 2018-2018
# Data Intensive Applications and Systems Labaratory (DIAS)
# Ecole Polytechnique Federale de Lausanne
#
@@ -20,16 +20,22 @@
# Import settings
. ./settings.sh
case $1 in
deploy)
# Permanent storage for Portainer
test -d ${PORTAINER_DATA} \
|| mkdir -p ${PORTAINER_DATA} \
|| ( echo Failed to create ${PORTAINER_DATA}; exit 1 )
docker service create \
--publish ${PORTAINER_PORT}:9000 \
--constraint 'node.role == manager' \
--detach=true \
--mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
--mount type=bind,src=${PORTAINER_DATA},dst=/data \
--name ${COMPOSE_PROJECT_NAME}_portainer \
${PORTAINER_IMAGE}${PORTAINER_VERSION}
docker stack deploy --compose-file=docker-compose-portainer.yml ${COMPOSE_PROJECT_NAME}-portainer
;;
ls)
docker stack ls
;;
ps|rm|services)
docker stack $1 ${COMPOSE_PROJECT_NAME}-portainer
;;
*)
docker stack $1
;;
esac