You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

436 lines
15 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>Deploy :: Swarmlab faq</title>
<link rel="canonical" href="http://docs.swarmlab.io/SwarmLab-HowTos/swarmlab/docs/CloudComputing_Lab/docs/docker-compose.html">
<meta name="generator" content="Antora 2.3.4">
<link rel="stylesheet" href="../../_/css/site.css">
<link rel="stylesheet" href="../../_/css/search.css">
<script>var uiRootPath = '../../_'</script>
</head>
<body class="article">
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="http://docs.swarmlab.io/SwarmLab-HowTos/swarmlab/docs">Swarmlab faq</a>
<button class="navbar-burger" data-target="topbar-nav">
<span></span>
<span></span>
<span></span>
</button>
</div>
<div id="topbar-nav" class="navbar-menu">
<div class="navbar-end">
<a class="navbar-item" href="#">Home</a>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Products</a>
<div class="navbar-dropdown">
<a class="navbar-item" target ="hybridgit" href="https://git.swarmlab.io:3000/zeus/swarmlab-hybrid">Hybrid</a>
<a class="navbar-item" target ="venusgit" href="https://git.swarmlab.io:3000/swarmlab/venus-client">Venus</a>
</div>
</div>
<div class="navbar-item has-dropdown is-hoverable">
<a class="navbar-link" href="#">Services</a>
<div class="navbar-dropdown">
<a class="navbar-item" target ="hybrid" href="https://api-client.swarmlab.io:8088/">Hybrid</a>
<a class="navbar-item" target ="venus" href="https://api-client.swarmlab.io:8088/">Venus</a>
</div>
</div>
<div class="navbar-item">
<input id="search-input" type="text" placeholder="Search docs">
</div>
</div>
</div>
</nav>
</header>
<div class="body">
<div class="nav-container" data-component="CloudComputing_Lab" data-version="docs">
<aside class="nav">
<div class="panels">
<div class="nav-panel-menu is-active" data-panel="menu">
<nav class="nav-menu">
<h3 class="title"><a href="index.html">CloudComputing_Lab</a></h3>
<ul class="nav-list">
<li class="nav-item" data-depth="0">
<ul class="nav-list">
<li class="nav-item" data-depth="1">
<a class="nav-link" href="index.html">Readme_First </a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="a.html">Setup Lab</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="b.html">Create service</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="c.html">Hybrid Cloud Connectivity</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="d.html">Storage I</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="e.html">Storage II</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="f.html">Docker Swarm</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="docker-build.html">DigitalSkills-docker_build</a>
</li>
<li class="nav-item is-current-page" data-depth="1">
<a class="nav-link" href="docker-compose.html">DigitalSkills-deploy_service</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="admin.html">DigitalSkills-Service_Admin</a>
</li>
<li class="nav-item" data-depth="1">
<a class="nav-link" href="tech-list.html">Getting_started</a>
</li>
</ul>
</li>
</ul>
</nav>
</div>
<div class="nav-panel-explore" data-panel="explore">
<div class="context">
<span class="title">CloudComputing_Lab</span>
<span class="version">docs</span>
</div>
<ul class="components">
<li class="component is-current">
<a class="title" href="index.html">CloudComputing_Lab</a>
<ul class="versions">
<li class="version is-current is-latest">
<a href="index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_faq/docs/index.html">swarmlab_faq</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_faq/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_how-to-build-a-Swarmlab-service/docs/index.html">swarmlab_how-to-build-a-Swarmlab-service</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_how-to-build-a-Swarmlab-service/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_infrastructure-as-code/docs/index.html">swarmlab_infrastructure-as-code</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_infrastructure-as-code/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_iot-sensor-node/docs/index.html">swarmlab_iot-sensor-node</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_iot-sensor-node/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_network-adhoc/docs/index.html">swarmlab_network-adhoc</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_network-adhoc/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_poc-datacollector/docs/index.html">swarmlab_poc-datacollector</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_poc-datacollector/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_raspi-docker/docs/index.html">swarmlab_raspi-docker</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_raspi-docker/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sec-intro/docs/index.html">swarmlab_sec-intro</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sec-intro/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sec-iptables/docs/index.html">swarmlab_sec-iptables</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sec-iptables/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sec-ssh-tunneling/docs/index.html">swarmlab_sec-ssh-tunneling</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sec-ssh-tunneling/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_sidecar-firefox/docs/index.html">swarmlab_sidecar-firefox</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_sidecar-firefox/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_tech-list/docs/index.html">swarmlab_tech-list</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_tech-list/docs/index.html">docs</a>
</li>
</ul>
</li>
<li class="component">
<a class="title" href="../../swarmlab_xelatex-thesis/docs/index.html">swarmlab_xelatex-thesis</a>
<ul class="versions">
<li class="version is-latest">
<a href="../../swarmlab_xelatex-thesis/docs/index.html">docs</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
</aside>
</div>
<main class="article">
<div class="toolbar" role="navigation">
<button class="nav-toggle"></button>
<a href="../../swarmlab_faq/docs/index.html" class="home-link"></a>
<nav class="breadcrumbs" aria-label="breadcrumbs">
<ul>
<li><a href="index.html">CloudComputing_Lab</a></li>
<li><a href="docker-compose.html">DigitalSkills-deploy_service</a></li>
</ul>
</nav>
</div>
<div class="content">
<aside class="toc sidebar" data-title="Contents" data-levels="2">
<div class="toc-menu"></div>
</aside>
<article class="doc">
<h1 class="page">Deploy</h1>
<div class="sect1">
<h2 id="_create_yaml_file"><a class="anchor" href="#_create_yaml_file"></a>Create Yaml file</h2>
<div class="sectionbody">
<div class="listingblock">
<div class="title">docker-compose</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-yaml hljs" data-lang="yaml">services:
myapp: <i class="conum" data-value="1"></i><b>(1)</b>
image: node:8.2.1-alpine <i class="conum" data-value="2"></i><b>(2)</b>
hostname: myapp
volumes:
- /PATH_to_app/app.js:/code/app.js <i class="conum" data-value="3"></i><b>(3)</b>
- /PATH_to_app/index.html:/code/index.html <i class="conum" data-value="3"></i><b>(3)</b>
ports:
- "8000:8000" <i class="conum" data-value="4"></i><b>(4)</b>
networks:
- mynet <i class="conum" data-value="5"></i><b>(5)</b>
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
replicas: 1
placement:
constraints:
- node.labels.myapp==true <i class="conum" data-value="6"></i><b>(6)</b>
resources: <i class="conum" data-value="8"></i><b>(8)</b>
limits:
cpus: '0.50'
memory: 500M
reservations:
cpus: '0.25'
memory: 200M
restart_policy: <i class="conum" data-value="9"></i><b>(9)</b>
condition: on-failure
delay: 5s
max_attempts: 5
window: 120s
update_config:
parallelism: 2
delay: 10s
order: stop-first
environment:
- MYPASSWORD=${PASSWORD}
- NODENAME={{.Node.Hostname}}
- NODEID={{.Node.ID}}
- SERVICEID={{.Service.ID}}
- SERVICENAME={{.Service.Name}}
- TASKID={{.Task.ID}}
- TASKNAME={{.Task.Name}}
- TASKREPID={{.Task.Slot}}
mybrowser:
image: hub.swarmlab.io:5480/hybrid-firefox
deploy:
mode: replicated
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
replicas: 2
placement:
max_replicas_per_node: 1
constraints:
- node.labels.group==myapp
ports:
- "8080:80"
- "9443:443"
volumes: <i class="conum" data-value="7"></i><b>(7)</b>
- /PATH_to_FILE/my.conf:/DIR_in_container/my.conf <i class="conum" data-value="3"></i><b>(3)</b>
#- /PATH_to_FILE/public.crt:/etc/nginx/public.crt <i class="conum" data-value="3"></i><b>(3)</b>
#- /PATH_to_FILE/private.key:/etc/nginx/private.key <i class="conum" data-value="3"></i><b>(3)</b>
- /tmp/.X11-unix:/tmp/.X11-unix <i class="conum" data-value="10"></i><b>(10)</b>
networks:
- myapp <i class="conum" data-value="5"></i><b>(5)</b>
#privileged: true
environment:
- DISPLAY=\${DISPLAY} <i class="conum" data-value="10"></i><b>(10)</b>
#cap_add:
# - NET_ADMIN <i class="conum" data-value="11"></i><b>(11)</b>
networks:
myapp: <i class="conum" data-value="5"></i><b>(5)</b>
driver: overlay</code></pre>
</div>
</div>
<div class="colist arabic">
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>Service name</td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td>Image name</td>
</tr>
<tr>
<td><i class="conum" data-value="3"></i><b>3</b></td>
<td>Volume (bind) to Use</td>
</tr>
<tr>
<td><i class="conum" data-value="4"></i><b>4</b></td>
<td>Expose port</td>
</tr>
<tr>
<td><i class="conum" data-value="5"></i><b>5</b></td>
<td>Network to Use</td>
</tr>
<tr>
<td><i class="conum" data-value="6"></i><b>6</b></td>
<td>Node Placement</td>
</tr>
<tr>
<td><i class="conum" data-value="7"></i><b>7</b></td>
<td>Start server</td>
</tr>
<tr>
<td><i class="conum" data-value="8"></i><b>8</b></td>
<td>Resources config</td>
</tr>
<tr>
<td><i class="conum" data-value="9"></i><b>9</b></td>
<td>Restart policy</td>
</tr>
<tr>
<td><i class="conum" data-value="10"></i><b>10</b></td>
<td>X app</td>
</tr>
<tr>
<td><i class="conum" data-value="11"></i><b>11</b></td>
<td>use host net</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_start_service"><a class="anchor" href="#_start_service"></a>start service</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_docker_compose"><a class="anchor" href="#_docker_compose"></a>docker-compose</h3>
<div class="listingblock">
<div class="title">Docker-compose</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">env MYPASSWORD=v9ptvq4dedcrtcrykjcubk28j \
docker-compose -f file.yml up</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_docker_swarm"><a class="anchor" href="#_docker_swarm"></a>docker swarm</h3>
<div class="listingblock">
<div class="title">Docker swarm</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">env PASSWORD=K507R1zQ6Jifc9MAW3 \
docker stack deploy -c file.yml ondemand_os2</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_stop_service"><a class="anchor" href="#_stop_service"></a>stop service</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_docker_compose_2"><a class="anchor" href="#_docker_compose_2"></a>docker-compose</h3>
<div class="listingblock">
<div class="title">Docker-compose</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">docker-compose -f file.yml down</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_docker_swarm_2"><a class="anchor" href="#_docker_swarm_2"></a>docker swarm</h3>
<div class="listingblock">
<div class="title">Docker swarm</div>
<div class="content">
<pre class="highlightjs highlight"><code class="language-bash hljs" data-lang="bash">docker service rm ondemand_os2_myapp
docker service rm ondemand_os2_wyweb</code></pre>
</div>
</div>
</div>
</div>
</div>
</article>
</div>
</main>
</div>
<footer class="footer">
<p>This page was built using the Antora <a href="https://gitlab.com/antora/antora-ui-default" target="antora">default UI</a> </p>
</footer>
<script src="../../_/js/site.js"></script>
<script src="../../_/js/vendor/lunr.js"></script>
<script src="../../_/js/vendor/search.js" id="search-script" data-base-path="../.." data-page-path="/CloudComputing_Lab/docs/docker-compose.html"></script>
<script async src="../../_/../search-index.js"></script>
<script async src="../../_/js/vendor/highlight.js"></script>
</body>
</html>