SlideShare a Scribd company logo
1 of 46
Download to read offline
Docker for Development
by Robert Lemke
Robert Lemke
Flownative Managing Partner

Neos Project Founder



robert@flownative.com

@robertlemke
Some
Blue
Slide
Goals for my
Local Development
Environment
Goals for my local development
environment
No compromise on
tooling
fastfastfast
Easy to setup
Easy to switch
Development
software versions should
match
production
Additional software
like Redis or Elasticsearch

should be set up
easily & match
production
Composer
must use the correct
production
environment
Options without
Docker
Install multiple
PHP, MariaDB, Apache, Redis,
Elasticsearch, Nginx, Solr …
versions
Use a clever combination of
dnsmasq
resolv
hosts
and how’s your current setup?
Options with
Docker
Docker Compose with Nginx,
PHP-FPM, MySQL
Mounted Volumes
Problem #1
Cumbersome setup
create
templates & scripts
introduce a standardized
docker-compose.yml 
take advantage of

.env files
maybe even create

a cascade
Problem #2
Port management
Problem #3
Slow file access
Why are mounted volumes
so slow *


* on Mac and Windows
option #1:
don't mount the volume but work with
Git inside the container
option #2:
using cached and delegated

as volume options
examples:

consistent, cached,
delegated
Source: https://blog.docker.com/2017/05/user-guided-caching-in-docker-for-mac/
consistent
Container and host views are always
synchronized
cached
Host’s view of file system is authoritative.
Writes performed on host may take time until
they appear in within containers.
delegated
Provides weakest set of guarantees.


Container’s view of file system is authoritative.
option #3:
mount certain directories,

use rsync for others
Problem #4
SSH access
Problem #5
Sync data from or to
production
Problem #6
Using Composer in the
right environment
Local Beach
https://flownative.com/localbeach
Demo
version: '3'
networks:
local_beach:
external:
name: local_beach
services:
webserver:
image: ${BEACH_WEBSERVER_IMAGE:-flownative/beach-nginx}:${BEACH_WEBSERVER_IMAGE_VERSION:-latest}
container_name: ${BEACH_PROJECT_NAME:?Please specify a Beach project name as BEACH_PROJECT_NAME}_webserver
networks:
- local_beach
ports:
- "80"
volumes:
- .:/application:delegated
environment:
- VIRTUAL_HOST=${BEACH_PROJECT_NAME}.localbeach.net
- BEACH_PHP_FPM_HOST=${BEACH_PROJECT_NAME:?Please specify a Beach project name as BEACH_PROJECT_NAME}_php.local_beach
- BEACH_FLOW_BASE_CONTEXT=${BEACH_FLOW_BASE_CONTEXT:-Development}
- BEACH_FLOW_SUB_CONTEXT=${BEACH_FLOW_SUB_CONTEXT:-Instance}
- BEACH_PHP_MEMORY_LIMIT=${BEACH_PHP_MEMORY_LIMIT:-750M}
php:
image: ${BEACH_PHP_IMAGE:-flownative/beach-phpfpm}:${BEACH_PHP_IMAGE_VERSION:-latest}
container_name: ${BEACH_PROJECT_NAME:?Please specify a Beach project name as BEACH_PROJECT_NAME}_php
networks:
- local_beach
ports:
- "${BEACH_SSH_PORT:-2222}:22"
depends_on:
- webserver
- redis
volumes:
- ./Data/Persistent:/application/Data/Persistent:delegated
- ./Data/Logs:/application/Data/Logs:delegated
- ./Data/DoctrineMigrations:/application/Data/DoctrineMigrations
- .:/application-on-host:delegated
- ./.LocalBeach/secrets:/secrets
- ./.LocalBeach/home:/home/beach
- ./Web:/application/Web:delegated
environment:
- BEACH_PHP_FPM_ENABLE=true
.localbeach.docker-compose.yaml
#
# Environment variables for the Local Beach Docker Compose setup
#
BEACH_PROJECT_NAME=neos-demo
# Change the PHP version to the branch you use in your Beach instances.
# Examples: 7.3 for PHP 7.3.x
BEACH_PHP_IMAGE_VERSION=7.3
# If you are running multiple Local Beach projects on your computer,
# set the following port to a value which is not used by other projects
# or applications yet:
BEACH_SSH_PORT=2122
.localbeach.dist.env
Docker in Production
docker-compose
Kubernetes
Flownative Beach
robert@flownative.com
www.flownative.com
@robert@flownative.social
#!/bin/bash
######### Configuration #########
## Whether to enable verbosity. If enabled, change events are output.
if [ -z "${INOTIFY_VERBOSE}" ]; then
INOTIFY_VERBOSE=0
fi
##################################
inotifywait -m -q -r -e CREATE -e DELETE -e MODIFY -e MOVED_FROM -e MOVED_TO --exclude '(.git/|.idea/|
.Docker/|.syncd.conf|Data/|Web/|___jb_)' --format '%e %w%f' /application-on-host | while read EVENT FILE
do
case ${EVENT} in
'DELETE'|'MOVED_FROM')
COMMAND="rm -f '${FILE//application-on-host///application/}'"
;;
'DELETE,ISDIR'|'MOVED_FROM,ISDIR')
COMMAND="rm -rf '${FILE//application-on-host///application/}'"
;;
'CREATE,ISDIR'|'MOVED_TO,ISDIR'|'MODIFY,ISDIR')
COMMAND="[ -d "${FILE}" ] && cp -rpLf '${FILE}' '$(dirname ${FILE//application-on-host///
application/})'"
;;
'CREATE'|'MOVED_TO'|'MODIFY')
COMMAND="[ -f "${FILE}" ] && cp -pLf '${FILE}' '${FILE//application-on-host///application/}'"
;;
*)
COMMAND='# "Unhandled event ${EVENT}"'
;;
esac
if [ ${INOTIFY_VERBOSE} -ne 0 ]; then
echo "[${EVENT}] ${FILE}"
echo " ${COMMAND}"
fi
eval ${COMMAND}
done
#!/bin/bash
#------------------------------------------------------------
# based on https://github.com/drunomics/syncd
# initd script for running services without start-stop-daemon
# (c) Wolfgang Ziegler, nuppla@zites.net, drunomics GmbH
#------------------------------------------------------------
CONF_FILE=/application-on-host/.syncd.conf
PIDFILE="/var/run/syncd.pid"
LOGFILE="/var/log/syncd.log"
INOTIFY_VERBOSE=0
if [ -e ${CONF_FILE} ]; then
. ${CONF_FILE}
fi
SCRIPT=`readlink -f $0`
DAEMON_NAME=syncd
LINK=`readlink -f $0`
SCRIPT_DIR=`dirname ${LINK}`
case $1 in
start)
if [ -e ${PIDFILE} ] && ( ps -p `cat ${PIDFILE}` > /dev/null ); then
echo "$DAEMON_NAME is already running."
exit 1;
fi
export INOTIFY_VERBOSE
${SCRIPT_DIR}/watch.sh >> ${LOGFILE} &
echo "$!" > ${PIDFILE}
echo "Starting $DAEMON_NAME..."
;;
stop)
if [ ! -e ${PIDFILE} ] || ( ! ps -p `cat ${PIDFILE}` > /dev/null ); then
echo "$DAEMON_NAME is not running."
exit 1;
fi

More Related Content

More from Robert Lemke

More from Robert Lemke (20)

Neos Conference 2018 Welcome Keynote
Neos Conference 2018 Welcome KeynoteNeos Conference 2018 Welcome Keynote
Neos Conference 2018 Welcome Keynote
 
A practical introduction to Event Sourcing and CQRS
A practical introduction to Event Sourcing and CQRSA practical introduction to Event Sourcing and CQRS
A practical introduction to Event Sourcing and CQRS
 
Neos Conference 2017 Welcome Keynote
Neos Conference 2017 Welcome KeynoteNeos Conference 2017 Welcome Keynote
Neos Conference 2017 Welcome Keynote
 
IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes IPC16: A Practical Introduction to Kubernetes
IPC16: A Practical Introduction to Kubernetes
 
IPC 2016: Content Strategy for Developers
IPC 2016: Content Strategy for DevelopersIPC 2016: Content Strategy for Developers
IPC 2016: Content Strategy for Developers
 
Docker in Production - IPC 2016
Docker in Production - IPC 2016Docker in Production - IPC 2016
Docker in Production - IPC 2016
 
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
Is this Open Source Thing Really Worth it? (IPC 2016 Berlin)
 
The Neos Brand (Inspiring Conference 2016)
The Neos Brand (Inspiring Conference 2016)The Neos Brand (Inspiring Conference 2016)
The Neos Brand (Inspiring Conference 2016)
 
Neos - past, present, future (Inspiring Conference 2016)
Neos - past, present, future (Inspiring Conference 2016)Neos - past, present, future (Inspiring Conference 2016)
Neos - past, present, future (Inspiring Conference 2016)
 
Meet Neos Nürnberg 2016: Ja ich will!
Meet Neos Nürnberg 2016: Ja ich will!Meet Neos Nürnberg 2016: Ja ich will!
Meet Neos Nürnberg 2016: Ja ich will!
 
Meet Neos Nürnberg 2016: Hallo Neos!
Meet Neos Nürnberg 2016: Hallo Neos!Meet Neos Nürnberg 2016: Hallo Neos!
Meet Neos Nürnberg 2016: Hallo Neos!
 
Turning Neos inside out / React.js HH
Turning Neos inside out / React.js HHTurning Neos inside out / React.js HH
Turning Neos inside out / React.js HH
 
Docker in Production - IPC 15 München
Docker in Production - IPC 15 MünchenDocker in Production - IPC 15 München
Docker in Production - IPC 15 München
 
Two Stack CMS - code.talks 2015
Two Stack CMS - code.talks 2015Two Stack CMS - code.talks 2015
Two Stack CMS - code.talks 2015
 
Two Stack CMS – code.talks Hamburg 2015
Two Stack CMS – code.talks Hamburg 2015Two Stack CMS – code.talks Hamburg 2015
Two Stack CMS – code.talks Hamburg 2015
 
Neos: Assets in the Cloud - Inspiring Conference 2015
Neos: Assets in the Cloud - Inspiring Conference 2015Neos: Assets in the Cloud - Inspiring Conference 2015
Neos: Assets in the Cloud - Inspiring Conference 2015
 
Neos – Past, Present, Future – Keynote Inspiring Conference 2015
Neos – Past, Present, Future – Keynote Inspiring Conference 2015Neos – Past, Present, Future – Keynote Inspiring Conference 2015
Neos – Past, Present, Future – Keynote Inspiring Conference 2015
 
SPHERE.IO & Neos (eCommerce Camp Jena)
SPHERE.IO & Neos (eCommerce Camp Jena)SPHERE.IO & Neos (eCommerce Camp Jena)
SPHERE.IO & Neos (eCommerce Camp Jena)
 
Multi Language Websites with TYPO3 Neos
Multi Language Websites with TYPO3 NeosMulti Language Websites with TYPO3 Neos
Multi Language Websites with TYPO3 Neos
 
Seamless Integration Architecture for Content Commerce Websites
Seamless Integration Architecture for Content Commerce WebsitesSeamless Integration Architecture for Content Commerce Websites
Seamless Integration Architecture for Content Commerce Websites
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 

Neos Conference 2019: Docker for Development