Let's deploy another stack.
This time we'll use Docker stack defined in the Compose file docker-compose-stack.yml
(https://github.com/vfarcic/go-demo/blob/master/docker-compose-stack.yml) located in the vfarcic/go-demo
(https://github.com/vfarcic/go-demo/) repository. It is as follows:
version: '3'
services:
main:
image: vfarcic/go-demo
environment:
-DB=db
networks:
- proxy
- default
deploy:
replicas: 3
labels:
- com.df.notify=true
- com.df.distribute=true
- com.df.servicePath=/demo
- com.df.port=8080
db:
image: mongo
networks:
- default
networks:
default:
external: false
proxy:
external: true
The stack defines two services (main
and db
). They will communicate with each other through the default network that will be created automatically by the stack (no need for docker network create
command). Since the main service is an API, it should be accessible through...