From 04823a1233d6d92ed6225305999b9db00c82d551 Mon Sep 17 00:00:00 2001 From: test2 Date: Tue, 7 Apr 2020 21:48:03 +0300 Subject: [PATCH] askisi --- DockerSwarm/run.yaml.adoc | 213 ++++++++++++++++++++++++++++++++++ DockerSwarm/swarm-deploy.adoc | 9 ++ 2 files changed, 222 insertions(+) create mode 100644 DockerSwarm/run.yaml.adoc diff --git a/DockerSwarm/run.yaml.adoc b/DockerSwarm/run.yaml.adoc new file mode 100644 index 0000000..23ab82f --- /dev/null +++ b/DockerSwarm/run.yaml.adoc @@ -0,0 +1,213 @@ += Swarm deploy Yaml ! +Apostolos rootApostolos@swarmlab.io +:description: IoT Εισαγωγή στο Cloud +:keywords: Cloud, swarm +:data-uri: +:toc: right +:toc-title: Πίνακας περιεχομένων +:toclevels: 4 +:source-highlighter: highlight +:icons: font +:sectnums: + +include::header.adoc[] + + +{empty} + + +== Create Swarm Service YAML + +.YAML +[NOTE] +==== +Eχουμε κάνει σύνδεση στον manager +==== + + + +[source,yaml] +---- +version: "3.4" + +services: + +# όνομα υπηρεσίας + master: + image: registry.vlabs.uniwa.gr:5080/swarmlab-service-mpi2 + user: root +# ENTRYPOINT instruction allows you to configure a container that will run as an executable. + entrypoint: ["mpi_bootstrap", "role=master", "mpi_master_service_name=master", "mpi_worker_service_name=worker"] +# Environment variables (declared with the ENV statement) can also be used in certain instructions as variables to be interpreted by the Dockerfile. +# https://docs.docker.com/engine/reference/builder/#environment-replacement + environment: + - PASSWORD=padatest + - PASSWORDVIEW=padatestview + - SERVERROLE=master + - SERVERWEB=no +# docker services inspect + - NODENAME={{.Node.Hostname}} + - NODEID={{.Node.ID}} + - SERVICEID={{.Service.ID}} + - SERVICENAME={{.Service.Name}} + - TASKID={{.Task.ID}} + - TASKNAME={{.Task.Name}} + - TASKREPID={{.Task.Slot}} +# Specify configuration related to the deployment and running of services. + deploy: +# If the service is replicated (which is the default), specify the number of containers that should be running at any given time. +# In global mode, running one replica of service per swarm node. The number of global replicas is equal to the number of swarm nodes. In replica mode, you can run any number of service instances. + replicas: 9 + placement: +# max_replicas_per_node: 1 + constraints: + - node.role == worker +# Configures resource constraints. +# resources: +# limits: +# cpus: '0.50' +# memory: 500M +# reservations: +# cpus: '0.25' + + + + +# memory: 200M +# Configures how the service should be rollbacked in case of a failing update. +# +# parallelism: The number of containers to rollback at a time. If set to 0, all containers rollback simultaneously. +# delay: The time to wait between each container group’s rollback (default 0s). +# failure_action: What to do if a rollback fails. One of continue or pause (default pause) +# monitor: Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s). +# max_failure_ratio: Failure rate to tolerate during a rollback (default 0). +# order: Order of operations during rollbacks. One of stop-first (old task is stopped before starting new one), or start-first (new task is started first, and the running tasks briefly overlap) (default stop-first). +# + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 5 + window: 120s + +#Configures how the service should be updated. Useful for configuring rolling updates. +# +# parallelism: The number of containers to update at a time. +# delay: The time to wait between updating a group of containers. +# failure_action: What to do if an update fails. One of continue, rollback, or pause (default: pause). +# monitor: Duration after each task update to monitor for failure (ns|us|ms|s|m|h) (default 0s). +# max_failure_ratio: Failure rate to tolerate during an update. +# order: Order of operations during updates. One of stop-first (old task is stopped before starting new one), or start-first (new task is started first, and the running tasks briefly overlap) (default stop-first) Note: Only supported for v3.4 and higher. +# +# + update_config: + parallelism: 2 + delay: 10s + order: stop-first + networks: + mpi2-net: + volumes: + - mpi3_vol:/var/share + ports: + - "55520:80" + - "55521:8088" + - "55522:6088" + - "55523:6080" + + + worker: + image: registry.vlabs.uniwa.gr:5080/swarmlab-service-mpi2 + user: root + entrypoint: ["mpi_bootstrap", "role=worker", "mpi_master_service_name=master", "mpi_worker_service_name=worker"] + environment: + - SERVERROLE=worker + - SERVERWEB=no + - NODENAME={{.Node.Hostname}} + - NODEID={{.Node.ID}} + - SERVICEID={{.Service.ID}} + - SERVICENAME={{.Service.Name}} + - TASKID={{.Task.ID}} + - TASKNAME={{.Task.Name}} + - TASKREPID={{.Task.Slot}} + deploy: + replicas: 5 + placement: +# max_replicas_per_node: 1 + constraints: + - node.role == worker + #- node.id == ${worker} +# resources: +# limits: +# cpus: '0.50' +# memory: 500M +# reservations: +# cpus: '0.25' +# memory: 200M + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 5 + window: 120s + update_config: + parallelism: 2 + delay: 10s + order: stop-first + networks: + mpi2-net: + volumes: + - mpi3_vol:/var/share + + web: + image: registry.vlabs.uniwa.gr:5080/swarmlab-service-sshfs + user: root + entrypoint: ["mpi_bootstrap", "role=worker", "mpi_master_service_name=master", "mpi_worker_service_name=worker"] + environment: + - SERVERROLE=worker + - SERVERWEB=yes + - NODENAME={{.Node.Hostname}} + - NODEID={{.Node.ID}} + - SERVICEID={{.Service.ID}} + - SERVICENAME={{.Service.Name}} + - TASKID={{.Task.ID}} + - TASKNAME={{.Task.Name}} + - TASKREPID={{.Task.Slot}} + deploy: + replicas: 1 + placement: + constraints: + - node.role == worker + resources: + limits: + cpus: '0.50' + memory: 500M + reservations: + cpus: '0.25' + memory: 200M + restart_policy: + condition: on-failure + delay: 5s + max_attempts: 5 + window: 120s + update_config: + parallelism: 2 + delay: 10s + order: stop-first + networks: + mpi2-net: + ports: + - "55519:80" + +#Creates a new network. The DRIVER accepts bridge or overlay which are the built-in network drivers. +#Bridge networks are isolated networks on a single Engine installation. If you want to create a network that spans multiple Docker hosts each running an Engine, you must create an overlay network. Unlike bridge networks, overlay networks require some pre-existing conditions before you can create one. +# +networks: + mpi2-net: + + +#Mount host paths or named volumes +#Creates a new volume that containers can consume and store data in. +volumes: + mpi3_vol: + external: false + +---- + + diff --git a/DockerSwarm/swarm-deploy.adoc b/DockerSwarm/swarm-deploy.adoc index b81d491..edd7095 100644 --- a/DockerSwarm/swarm-deploy.adoc +++ b/DockerSwarm/swarm-deploy.adoc @@ -64,6 +64,15 @@ exit == swarm deploy +.Reminder +[NOTE] +==== +Εχουμε τρέξει ήδη (κατά τη δημιουργία του σμήνους στο προηγούμενο εργαστήριο) το αρχείο set-ca.sh σε κάθε worker + +chmod +x set-ca.sh +./set-ca.sh +==== + [source,sh] ---- docker stack deploy -c run.yml ondemand_mpi2