Swarmlab docs

Application development in a distributed system

Development of Distributed Systems from Design to Application


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.

76 lines
1.5 KiB

3 years ago
= Deploy
== Create Yaml file
.docker-compose
[source,yaml]
----
services:
3 years ago
myapp: //<1>
image: node:8.2.1-alpine //<2>
hostname: myapp
3 years ago
volumes:
3 years ago
- /PATH_to_app/app.js:/code/app.js //<3>
- /PATH_to_app/index.html:/code/index.html //<3>
3 years ago
ports:
3 years ago
- "8000:8000" //<4>
3 years ago
networks:
3 years ago
- mynet //<5>
3 years ago
deploy:
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
placement:
constraints:
3 years ago
- node.labels.myapp==true //<6>
3 years ago
3 years ago
mybrowser:
3 years ago
image: nginx:1.17.9-alpine
deploy:
mode: replicated
restart_policy:
delay: 10s
max_attempts: 10
window: 60s
replicas: 2
placement:
max_replicas_per_node: 1
constraints:
3 years ago
- node.labels.group==myapp //<14>
3 years ago
ports:
- "8080:80"
- "9443:443"
volumes: //<15>
3 years ago
- /PATH_to_FILE/my.conf:/DIR_in_container/my.conf //<16>
#- /PATH_to_FILE/public.crt:/etc/nginx/public.crt //<17>
#- /PATH_to_FILE/private.key:/etc/nginx/private.key //<17>
3 years ago
networks:
3 years ago
- myapp //<5>
3 years ago
networks:
3 years ago
myapp: //<5>
3 years ago
driver: overlay
----
<1> Service name
<2> Image name
3 years ago
<3> Volume (bind) to Use
3 years ago
<4> Expose port
<5> Network to Use
<6> Node Placement
<7> Start server
<10> *NEW* Service name
<11> *NEW* Volume
<12> *NEW* Port
<13> *NEW* Label
<14> Node Placement (Proxy)
<15> Bind mount config files
<16> Nginx config file
<17> ssl keys