Deploying PHP apps on

multi node docker swarm

Ike Devolder


@BlackIkeEagle

Web developer @ Studio Emma

Docker swarm

concepts

  • node
  • services
  • task

Choosing the "right" base distribution

supported distributions

Bad

centos debian fedora

Intermediate

fedora slackware ubuntu

Good

arch linux coreos gentoo

Good but not common with big hosters

alpine linux rancher

setup a swarm

system

$ pacman -S docker
$ systemctl enable docker.service
                        

certificates

communication between client and server will be encrypted

client config

to communicate with our server(s) we have to setup some environment variables


export DOCKER_HOST=tcp://192.168.254.41:2375
export DOCKER_CERT_PATH=$(pwd)/client-cert
export DOCKER_TLS_VERIFY=1
                        

setup the swarm

# docker swarm init \
    --advertise-addr=[internal server ip]
# docker swarm join-token \
    -q worker
# docker swarm join \
    --token [worker token] \
    [internal master server ip]
                        

simple check swarm status

$ docker node ls
$ docker service ls
                        

docker service

create/manage a single service within a swarm

overview

  • docker service create
  • docker service inspect
  • docker service logs
  • docker service ls
  • docker service ps
  • docker service rm
  • docker service scale
  • docker service update

docker stack

create/manage an application stack within a swarm

overview

  • docker stack deploy
  • docker stack ls
  • docker stack ps
  • docker stack rm
  • docker stack services

deploying a simple stateless application

demo

challenges encountered

  • create stateless images
  • create swarm configuration
  • registry? self hosted? docker hub?

harder example?

deploying pimcore, there is state, a database, ...

demo

challenges encountered

  • create usable images
  • create swarm configuration
  • registry? self hosted? docker hub?
  • how to handle state
mindblown

Questions?

https://joind.in/talk/cd175

Ike Devolder

joindin qr

@BlackIkeEagle

Webdeveloper - Studio Emma

PHP-WVL / Docker West / Arch Linux Trusted User

studioemma  php-wvl  docker west  arch linux

Thanks.

https://joind.in/talk/cd175

Ike Devolder

joindin qr

@BlackIkeEagle

Webdeveloper - Studio Emma

PHP-WVL / Docker West / Arch Linux Trusted User

studioemma  php-wvl  docker west  arch linux