SlideShare a Scribd company logo
Learned lessons in a
real world project
Luis Rovirosa
@luisrovirosa
www.codium.team
Agenda
Context
Automate everything
Ensure quality
Domain at heart
Context
2 month project
2 part time developers
Green field project
Context
PHP
Automate everything
Vertical slices
Always working software
Vision
Decoupled code
Automate everything
Automate infrastructure
Public docker images
Our own docker images
Docker-compose
Own docker image
// Dockerfile
FROM php:7.1-apache
# Dependencies
RUN docker-php-ext-install mysqli pdo pdo_mysql
RUN a2enmod rewrite
RUN curl -sS https://getcomposer.org/installer | php && 
mv composer.phar /usr/local/bin/composer
# Configuration
COPY apache.conf
/etc/apache2/sites-available/001-our-project.conf
RUN ln -s /etc/apache2/sites-available/001-our-project.conf
/etc/apache2/sites-enabled/
# Git and unzip to use composer
RUN apt-get update && apt-get install git unzip -y
Docker-compose
version: '3.3'
services:
webserver:
container_name: our_project_webserver
image: our-project-apache
build:
context: .
dockerfile: docker/apache/Dockerfile
volumes:
- .:/var/www/html
- ./vendor:/var/www/html/vendor:delegated
network_mode: "host"
restart: unless-stopped
Local configuration
docker-compose.override.yml
docker-compose.override.yml.dist
Automate test execution
// bitbucket-pipelines.yml
image: composer:latest
pipelines:
branches:
master:
- step:
caches:
- composer
script:
- composer install
- composer tests:unit
definitions:
caches:
composer: vendor
Automate commands
// Composer.json
"scripts": {
"server:code:update":[
"git pull",
"docker exec own-project_webserver
composer local:dependencies:update"
],
"local:dependencies:update":[
"composer install",
"composer local:database:update",
"composer local:cache:clear"
],
Ensure quality
Acceptance tests
Unit testing
Infrastructure tests
Test doubles
TDD Development
Acceptance tests
/** @test */
public function its_possible_to_access_the_counter
_call_unit_when_you_are_log_in()
{
$this->loginAsEmployee();
$this->makeGetRequest('/counter_call_unit');
$this->assertResponseIsSuccessful();
}
Framework tests
/** @test */
public function the_first_value_generated_is_1()
{
$generator = $this->aGenerator();
$nextValue = $generator->next();
$this->assertSame(1, $nextValue);
}
Unit tests
public function retrieve_a_persisted_device_using_its_id()
{
$repository = $this->getRepository();
$message = $this->createNewEmail();
$repository->save($message);
$theMessage = $repository->findById($message->id());
$this->assertEquals($message->id(), $theMessage->id());
}
abstract protected function getRepository();
Infrastructure tests
class InMemoryMessageRepository
implements MessageRepository
{
private $messages = [];
public function save(Message $message): void
{
$this->messages[$message->id()] = $message;
}
public function findById(string $id): Message
{
return $this->messages[$id];
}
}
Fake implementations
class DummyPrinter implements Printer
{
public function printTurn(Turn $turn): void
{
}
}
Dummy implementation
// services_test.yml
services:
MyProjectDomainMessageMessageRepository:
class: MyProjectInfrastructurePersistence
InMemoryInMemoryMessageRepository
MyProjectDomainPrinterPrinter:
class: TestsMyProjectDomainPrinterDummyPrinter
public: true
Test dependencies
Domain at heart
Ubiquitous language
Use Business names
Only 1 word for concept
DDD
Framework
Application
Domain
Infrastructure
// Message.Message.orm.yml
MyProjectDomainMessageMessage:
type: entity
table: message
id:
id:
type: string
fields:
fromUserId:
type: string
toUserId:
type: string
message:
type: string
Database mapping
Learned lessons
Automate
Easy setup/update
Documentation
Double check
Hardware dependent
TDD
High confidence
Allows refactoring
Simplifies the code
DDD
Simplifies the communication
Really decoupled
Increases complexity
Going deeply?
Software
Craftsmanship
Murcia
Thank you
Questions?
Luis Rovirosa
@luisrovirosa
www.codium.team

More Related Content

PDF
Learned lessons in a real world project
PDF
Drone CI/CD Platform
PDF
Drone 1.0 Feature
PDF
GCE 上搭配 Cloud Storage 建置 Drone CI
PPTX
drone continuous Integration
PDF
Run your Appium tests using Docker Android - AppiumConf 2019
PDF
[表示が崩れる場合ダウンロードしてご覧ください] 2018年のDocker・Moby
PPTX
Zero to Continuous Delivery on Google Cloud
Learned lessons in a real world project
Drone CI/CD Platform
Drone 1.0 Feature
GCE 上搭配 Cloud Storage 建置 Drone CI
drone continuous Integration
Run your Appium tests using Docker Android - AppiumConf 2019
[表示が崩れる場合ダウンロードしてご覧ください] 2018年のDocker・Moby
Zero to Continuous Delivery on Google Cloud

What's hot (20)

PPTX
Baking docker using chef
PPTX
Docker orchestration
PDF
DCSF19 Tips and Tricks of the Docker Captains
PPT
Selenium lightning-talk
PDF
Building kubectl plugins with Quarkus | DevNation Tech Talk
PPTX
Cloud Native Okteto Cloud
PPTX
CI-CD WITH GITLAB WORKFLOW
PPTX
Gorush: A push notification server written in Go
PDF
Criando pipelines de entrega contínua multilinguagem com Docker e Jenkins
PPTX
Lando - AddWeb Solution
PPTX
PPTX
PDF
Deployment Automation with Docker
PDF
Continuous Integration/Deployment with Docker and Jenkins
PDF
CI/CD with Docker on AWS
PDF
Google ko: fast Kubernetes microservice development in Go - Sangam Biradar, E...
PPTX
Docker containers on Windows
PPT
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
PPTX
Next-gen DevOps engineering with Docker and Kubernetes by Antons Kranga
Baking docker using chef
Docker orchestration
DCSF19 Tips and Tricks of the Docker Captains
Selenium lightning-talk
Building kubectl plugins with Quarkus | DevNation Tech Talk
Cloud Native Okteto Cloud
CI-CD WITH GITLAB WORKFLOW
Gorush: A push notification server written in Go
Criando pipelines de entrega contínua multilinguagem com Docker e Jenkins
Lando - AddWeb Solution
Deployment Automation with Docker
Continuous Integration/Deployment with Docker and Jenkins
CI/CD with Docker on AWS
Google ko: fast Kubernetes microservice development in Go - Sangam Biradar, E...
Docker containers on Windows
Continuous Integration (CI) and Continuous Delivery (CD) using Jenkins & Docker
Next-gen DevOps engineering with Docker and Kubernetes by Antons Kranga
Ad

Similar to Learned lessons in a real world project (20)

PDF
Docker for developers on mac and windows
PPTX
From Docker to Production - ZendCon 2016
PDF
Ruby microservices with Docker - Sergii Koba
PDF
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
PDF
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
PPTX
Develop with docker 2014 aug
PPT
Docker, a new LINUX container technology based light weight virtualization
PPTX
Environment
PDF
Docker module 1
PDF
Environment isolation with Docker (Alex Medvedev, Alpari)
ODP
Docker engine - Indroduc
PDF
Docker in everyday development
PDF
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
PDF
Developing and Deploying PHP with Docker
PPTX
Docker for Web Developers: A Sneak Peek
PDF
Deploy django apps using docker
PDF
Docker Introduction.pdf
PDF
Super powered Drupal development with docker
PPTX
Docker - Der Wal in der Kiste
Docker for developers on mac and windows
From Docker to Production - ZendCon 2016
Ruby microservices with Docker - Sergii Koba
GDG-ANDROID-ATHENS Meetup: Build in Docker with Jenkins
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
Develop with docker 2014 aug
Docker, a new LINUX container technology based light weight virtualization
Environment
Docker module 1
Environment isolation with Docker (Alex Medvedev, Alpari)
Docker engine - Indroduc
Docker in everyday development
Hands on Docker - Launch your own LEMP or LAMP stack - SunshinePHP
Developing and Deploying PHP with Docker
Docker for Web Developers: A Sneak Peek
Deploy django apps using docker
Docker Introduction.pdf
Super powered Drupal development with docker
Docker - Der Wal in der Kiste
Ad

More from Codium (6)

PDF
Lean code kata en PHPMad
PDF
Desarrollando a velocidad de crucero - CAS 2018
PDF
Kata de TDD by Jordi Anguela
PDF
Learned lessons in real world projects by Jordi Anguela at Mallorca Software ...
PDF
Learned lessons in a real world project by Luis Rovirosa at PHPMad
PDF
Slow life
Lean code kata en PHPMad
Desarrollando a velocidad de crucero - CAS 2018
Kata de TDD by Jordi Anguela
Learned lessons in real world projects by Jordi Anguela at Mallorca Software ...
Learned lessons in a real world project by Luis Rovirosa at PHPMad
Slow life

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
Approach and Philosophy of On baking technology
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Machine learning based COVID-19 study performance prediction
PDF
cuic standard and advanced reporting.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Spectroscopy.pptx food analysis technology
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
Encapsulation theory and applications.pdf
Approach and Philosophy of On baking technology
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Programs and apps: productivity, graphics, security and other tools
Machine learning based COVID-19 study performance prediction
cuic standard and advanced reporting.pdf
MYSQL Presentation for SQL database connectivity
Diabetes mellitus diagnosis method based random forest with bat algorithm
Spectroscopy.pptx food analysis technology
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Per capita expenditure prediction using model stacking based on satellite ima...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Digital-Transformation-Roadmap-for-Companies.pptx

Learned lessons in a real world project