DEVOP-LESS DEPLOY
WITH DOCKER
Davide Fantuzzi - Data Engineer
5 Maggio 2021 - Più Docker per tutti
#pugRomagna
Slide 2
Slide 2 text
WELCOME
Davide Fantuzzi
Data Engineer @ LARUS Business Automation
● Currently Scala, Neo4j, Apache Spark.
● Previously PHP, MySQL and another one.
● utnaf on GitHub, Twitter, etc...
● Music, Drums, Inter
Slide 3
Slide 3 text
ABOUT LARUS
Founded in 2004
HQ: Venice
Offices: Pescara, Rome
Global services
International projects
Data Engineer, Data
Architect, Data Scientist, Big
Data certified experts team
We help companies to
become insight-driven
organizations
Leader in development of
data-driven application
based on NoSQL & Event
Streaming Technologies.
Slide 4
Slide 4 text
LARUS: OUR SPECIALTIES
Big Data Platform Design &
Development (Java, Scala,
Python, Javascript)
Data Engineering
Graph Data Visualization
Data Science
Strategic Advisoring for
Data-Driven Transformation
Projects
Machine Learning and AI
graph based technology
Slide 5
Slide 5 text
LARUS: OUR PARTNERS
Slide 6
Slide 6 text
WE ARE HIRING!
Slide 7
Slide 7 text
7
AGENDA
● Problem
● Solution
● Hands on
Slide 8
Slide 8 text
SCENARIO
● Awesome (PoC / Demo / In-Progress)App
● Need it online
● Need it online NOW!
● Need it done in the proper way
○ No git repository on the server
○ No publish our local environment
○ No FTP please!
Slide 9
Slide 9 text
9
Need for speed
Slide 10
Slide 10 text
SCENARIO (part 2)
● Don’t know how to AWS / Azure / Name it
● Don’t even know how to spell kuberneetses
● Money-Less Deploy approach
: (
Slide 11
Slide 11 text
11
Need for speed
HE
Slide 12
Slide 12 text
No content
Slide 13
Slide 13 text
Step 1
Ask Devops team to make a simple deploy pipeline, please.
Slide 14
Slide 14 text
No.
Devops answering any request for the
first time.
Slide 15
Slide 15 text
Step 2
Bring Devops team coffee and ask them to make a deploy pipeline by tomorrow, please.
Slide 16
Slide 16 text
Step 3
Slide 17
Slide 17 text
Step 4
Ping Devops for heads-up.
Slide 18
Slide 18 text
Step 5
Slide 19
Slide 19 text
Step 6
Ping again Devops for heads-up. PLEASE!!
Slide 20
Slide 20 text
Step 7
Slide 21
Slide 21 text
Step 8
Slide 22
Slide 22 text
22
Let’s prepare our own pipeline
Slide 23
Slide 23 text
Ingredients
● 1 Symfony WebApp
● 1 Remote Server with Docker and SSH
● 1 Dockerfile
● 1 DockerHub account
Preparation time: 20~ minutes
Cooking time: no cooking needed
Slide 24
Slide 24 text
http://localhost:8000 http://awesome-app.prod
GOAL
Less manual step as possible
Slide 25
Slide 25 text
HOW
● Create Docker image for our PHP application
● Put Docker image somewhere*
● Allow the remote server to reach the image
● Run the image on the server
● Easy to update
● Configurable
● Not-volatile
OUR AWESOME RECIPE
● Build the image
● Push it to DockerHub
● Access our server
● Create a simple docker-compose.yml
○ Our app image
○ Other images (MySQL, etc…)
○ Connect them with a network
○ Set up volumes for persistence
● Automate some operations with a script (migrations, cache clean, etc…)
● Execute the script from your dev environment
Slide 30
Slide 30 text
OUR AWESOME APP
● Symfony 5 App
● MySQL Database on docker-compose
● Dockerfile
● Makefile for laziness
Slide 31
Slide 31 text
OUR AWESOME DOCKERFILE
FROM php:8.0
WORKDIR /var/www
# Install PHP Stuff
RUN apt-get update \
&& apt-get install -y zip libzip-dev # ...and some more
# Create `var` directory and add writing permissions
RUN mkdir var \
&& chmod 755 -R var \
&& chown www-data:www-data -R var
COPY . .
COPY --from=composer /usr/bin/composer /usr/bin/composer
RUN composer install --no-dev --optimize-autoloader --no-scripts
EXPOSE 8000
CMD php -S 0.0.0.0:8000 -t public
Slide 32
Slide 32 text
32
Let’s do this!
Slide 33
Slide 33 text
33
Recap
Slide 34
Slide 34 text
OUR SOLUTION IS
● (Relatively) simple to implement
● Fast
● Easy to maintain
● Can be extended
● Dev friendly
● Devops friendly
Code available https://github.com/utnaf/devopless-deploy
Slide 35
Slide 35 text
Questions?
Slide 36
Slide 36 text
THANKS FOR YOUR ATTENTION
Davide Fantuzzi
Data Engineer
twitter.com/utnaf