SlideShare uma empresa Scribd logo
1 de 51
Baixar para ler offline
ANSIBLE-PROJECT-DEPLOY
a re-usable Ansible role to deploy projects
ABOUT ME
2
Ramon de la Fuente
Future500 B.V.
@f_u_e_n_t_e
SweetlakePHP
WHY ANSIBLE?
• Easy. Period.
3
“I wrote Ansible because none of the existing tools fit my brain.”
- Michael de Haan
WHY ANSIBLE?
• Easy. Period.
• No unnecessary complexity → No agent!
4
WHY ANSIBLE?
• Easy. Period.
• No unnecessary complexity → No agent!
• Built for re-use and sharing.
5
WHY ANSIBLE?
• Easy. Period.
• No unnecessary complexity → No agent!
• Built for re-use and sharing.
• Extendable in your own language.
6
THE PROBLEM
• Continuous deployment
7
THE PROBLEM
• Continuous deployment
• Easy maintenance of the deploy procedure.
8
THE PROBLEM
• Continuous deployment
• Easy maintenance of the deploy procedure.
• Small learning curve.
9
THE PROBLEM
• Continuous deployment
• Easy maintenance of the deploy procedure.
• Small learning curve.
• Reuse between projects with little effort.
10
WHAT IS A DEPLOY?
Directory structure:
.
!"" releases
| !"" 20140415234508
| #"" 20140415235146
!"" shared
| !"" sessions
| !"" source
| #"" uploads
#"" current -> releases/20140415235146
11
WHAT IS A DEPLOY?
Directory structure:
.
!"" releases
| !"" 20140415234508
| #"" 20140415235146
!"" shared
| !"" sessions
| !"" source
| #"" uploads
#"" current -> releases/20140415235146
12
WHAT IS A DEPLOY?
1. Update the codebase + configuration
13
WHAT IS A DEPLOY?
1. Update the codebase + configuration
2. Install dependencies
14
WHAT IS A DEPLOY?
1. Update the codebase + configuration
2. Install dependencies
3. Preserve shared resources
15
WHAT IS A DEPLOY?
1. Update the codebase + configuration
2. Install dependencies
3. Preserve shared resources
4. Build tasks
16
WHAT IS A DEPLOY?
1. Update the codebase + configuration
2. Install dependencies
3. Preserve shared resources
4. Build tasks
5. Finalize
17
THE ROLE
18
https://galaxy.ansible.com/list#/roles/732
project_deploy
GETTINGTHE ROLE
Installation with ansible-galaxy command:
$ ansible-galaxy install f500.project_deploy,v2.1.0
Optional: create a galaxy file for all roles:
f500.nginx
f500.mariadb55
f500.php
f500.project_deploy,v2.1.0
$ ansible-galaxy install -r ansible/galaxy.txt
19
ROLE WALKTHROUGH
---
- name: Initialize
deploy_helper: "path={{ project_root }} state=present"
20
ROLE WALKTHROUGH
Deploy module variables:
deploy_helper:
project_path
current_path
releases_path
shared_path
previous_release
previous_release_path
new_release
new_release_path
unfinished_filename
21
ROLE WALKTHROUGH
Deploy module variables:
deploy_helper:
project_path: /path/to/project/
current_path: /path/to/project/current
releases_path: /path/to/project/releases
shared_path: /path/to/project/shared
previous_release: 20140415234508
previous_release_path: /path/to/project/releases/20140415234508
new_release: 20140415235146
new_release_path: /path/to/project/releases/20140415235146
unfinished_filename: DEPLOY_UNFINISHED
Used as:
{{ deploy_helper.new_release }}
22
1. UPDATETHE CODEBASE
- name: Clone project files
git: repo={{ project_git_repo }}
dest={{ project_source_path }}
version={{ project_version }}
when: project_deploy_strategy == 'git'
- name: Rsync project files
synchronize: src={{ project_local_path }}
dest={{ project_source_path }}
rsync_timeout={{ project_deploy_synchronize_timeout }}
recursive=yes
when: project_deploy_strategy == 'synchronize'
23
1. UPDATETHE CODEBASE
- name: Clone project files
git: repo={{ project_git_repo }}
dest={{ project_source_path }}
version={{ project_version }}
when: project_deploy_strategy == 'git'
- name: Rsync project files
synchronize: src={{ project_local_path }}
dest={{ project_source_path }}
rsync_timeout={{ project_deploy_synchronize_timeout }}
recursive=yes
when: project_deploy_strategy == 'synchronize'
24
1. UPDATETHE CODEBASE
- name: Clone project files
git: repo={{ project_git_repo }}
dest={{ project_source_path }}
version={{ project_version }}
when: project_deploy_strategy == 'git'
- name: Rsync project files
synchronize: src={{ project_local_path }}
dest={{ project_source_path }}
rsync_timeout={{ project_deploy_synchronize_timeout }}
recursive=yes
when: project_deploy_strategy == 'synchronize'
25
1. UPDATETHE CODEBASE
- name: Write unfinished file
file: path={{ project_source_path }}/{{ deploy_helper.unfinished_filename }}
state=touch
- name: Copy files to new build dir
command: "cp -pr {{project_source_path}} {{deploy_helper.new_release_path}}"
- name: Remove unwanted files/folders from new release
file: path={{ deploy_helper.new_release_path }}/{{ item }} state=absent
with_items: project_unwanted_items
26
1. UPDATETHE CONFIG FILES
- name: Copy project files
copy: src={{ item.src }}
dest={{ deploy_helper.new_release_path }}/{{ item.dest }}
mode={{ item.mode|default('0644') }}
with_items: project_files
- name: Copy project templates
template: src={{ item.src }}
dest={{ deploy_helper.new_release_path }}/{{ item.dest }}
mode={{ item.mode|default('0644') }}
with_items: project_templates
27
2. INSTALL DEPENDENCIES
- name: Do composer install
command: "{{ project_command_for_composer_install }} chdir=…"
environment: project_environment
when: project_has_composer
- name: Do npm install
command: "{{ project_command_for_npm_install }} chdir=…"
environment: project_environment
when: project_has_npm
- name: Do bower install
command: "{{ project_command_for_bower_install }} chdir=…"
environment: project_environment
when: project_has_bower
28
2. INSTALL DEPENDENCIES
- name: Do composer install
command: "{{ project_command_for_composer_install }} chdir=…"
environment: project_environment
when: project_has_composer
- name: Do npm install
command: "{{ project_command_for_npm_install }} chdir=…"
environment: project_environment
when: project_has_npm
- name: Do bower install
command: "{{ project_command_for_bower_install }} chdir=…"
environment: project_environment
when: project_has_bower
29
3. SHARED RESOURCES
- name: Ensure shared sources are present
file: path='{{ deploy_helper.shared_path }}/{{ item.src }}'
state={{ item.type }}
with_items: project_shared_children
- name: Ensure shared paths are absent
file: path='{{ deploy_helper.new_release_path }}/{{ item.path }}'
state=absent
with_items: project_shared_children
- name: Create shared symlinks
file: path='{{ deploy_helper.new_release_path }}/{{ item.path }}'
src='{{ deploy_helper.shared_path }}/{{ item.src }}'
state=link"
with_items: project_shared_children
30
4. BUILD STEPS
- name: Run post_build_commands in the new_release_path
command: "{{ item }} chdir={{ deploy_helper.new_release_path }}"
with_items: project_post_build_commands
environment: project_environment
31
project_post_build_commands:
- "app/console cache:clear"
- "app/console assets:install"
- "app/console assetic:dump"
5. FINALIZE
- name: Finalize the deploy

deploy_helper: path={{ project_root }}
release={{ deploy_helper.new_release }}
state=finalize

when: project_finalize

32
33
IT’S NOT COMPLICATED!
• Only 98 lines
• Number of tasks: 22
• Variables to configure: 28
34
MINIMAL PLAYBOOK
1. Set minimum variables
2. Add the role to “roles” section
35
MINIMAL PLAYBOOK
- name: Deploy the application
hosts: production
remote_user: deploy
sudo: no
vars:
project_root: /var/www/my_project
project_git_repo: git@github.com:me/my_project.git
project_deploy_strategy: git
roles:
- f500.project_deploy
36
EXAMPLE PLAYBOOK
- name: Deploy the application
hosts: production
remote_user: "{{ production_deploy_user }}"
sudo: no
vars:
project_root: "{{ sweetlakephp_root }}"
project_git_repo: "{{ sweetlakephp_github_repo }}"
project_deploy_strategy: git
37
EXAMPLE PLAYBOOK
- name: Deploy the application
hosts: production
remote_user: "{{ production_deploy_user }}"
sudo: no
vars:
project_root: "{{ sweetlakephp_root }}"
project_git_repo: "{{ sweetlakephp_github_repo }}"
project_deploy_strategy: git
project_environment:
SYMFONY_ENV: "prod"
38
EXAMPLE PLAYBOOK
project_environment:
SYMFONY_ENV: "prod"
project_shared_children:
- path: "/app/sessions"
src: "sessions"
- path: "/web/uploads"
src: "uploads"
project_templates:
- name: parameters.yml
src: "templates/parameters_prod.yml.j2"
dest: "/app/config/parameters_prod.yml"
39
EXAMPLE PLAYBOOK
project_environment:
SYMFONY_ENV: "prod"
project_shared_children:
- path: "/app/sessions"
src: "sessions"
- path: "/web/uploads"
src: "uploads"
project_templates:
- name: parameters.yml
src: "templates/parameters_prod.yml.j2"
dest: "/app/config/parameters.yml"
40
EXAMPLE PLAYBOOK
project_has_composer: yes
project_post_build_commands:
- "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php”
- "app/console cache:clear"
- "app/console doctrine:migrations:migrate --no-interaction"
- "app/console assets:install"
- "app/console assetic:dump"
roles:
- f500.project_deploy
41
EXAMPLE PLAYBOOK
project_has_composer: yes
project_post_build_commands:
- "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php”
- "app/console cache:clear"
- "app/console doctrine:migrations:migrate --no-interaction"
- "app/console assets:install"
- "app/console assetic:dump"
roles:
- f500.project_deploy
42
EXAMPLE PLAYBOOK
43
project_has_composer: yes
project_post_build_commands:
- "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php”
- "app/console cache:clear"
- "app/console doctrine:migrations:migrate --no-interaction"
- "app/console assets:install"
- "app/console assetic:dump"
roles:
- f500.project_deploy
WHAT DOESN’T IT DO?
44
• Rollbacks (the cake rollback is a lie)
WHAT DOESN’T IT DO?
45
• Rollbacks
• Set maintenance mode
(the cake rollback is a lie)
WHAT DOESN’T IT DO?
46
• Rollbacks
• Set maintenance mode
• DB migrations
(the cake rollback is a lie)
WHAT’S NEXT?
47
• Injecting your own tasks in addition to commands
WHAT’S NEXT?
48
• Injecting your own tasks in addition to commands
• Copy vendor folders from previous release ✓
WHAT’S NEXT?
49
• Injecting your own tasks in addition to commands
• Copy vendor folders from previous release
• Setfacl support
✓
WHAT’S NEXT?
50
• Injecting your own tasks in addition to commands
• Copy vendor folders from previous release
• Setfacl support
• Your ideas?
✓
THANKYOU!
51
Feedback: joind.in 13405
f500/ansible-project_deploy
(But I’m also just a human. You could talk to me and tell me what you think…)
https://github.com/

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Getting Started With Aura
Getting Started With AuraGetting Started With Aura
Getting Started With Aura
 
Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1Laravel Beginners Tutorial 1
Laravel Beginners Tutorial 1
 
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying ConfigurationIBM Drupal Users Group Discussion on Managing and Deploying Configuration
IBM Drupal Users Group Discussion on Managing and Deploying Configuration
 
CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)
 
Writing a Jenkins / Hudson plugin
Writing a Jenkins / Hudson pluginWriting a Jenkins / Hudson plugin
Writing a Jenkins / Hudson plugin
 
Play framework 2 : Peter Hilton
Play framework 2 : Peter HiltonPlay framework 2 : Peter Hilton
Play framework 2 : Peter Hilton
 
Ant vs Phing
Ant vs PhingAnt vs Phing
Ant vs Phing
 
Building and deploying PHP applications with Phing
Building and deploying PHP applications with PhingBuilding and deploying PHP applications with Phing
Building and deploying PHP applications with Phing
 
Dockerize All The Things
Dockerize All The ThingsDockerize All The Things
Dockerize All The Things
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Using Drupal Features in B-Translator
Using Drupal Features in B-TranslatorUsing Drupal Features in B-Translator
Using Drupal Features in B-Translator
 
Deploying PHP applications with Phing
Deploying PHP applications with PhingDeploying PHP applications with Phing
Deploying PHP applications with Phing
 
Development Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP LibrariesDevelopment Workflow Tools for Open-Source PHP Libraries
Development Workflow Tools for Open-Source PHP Libraries
 
Jenkins Shared Libraries
Jenkins Shared LibrariesJenkins Shared Libraries
Jenkins Shared Libraries
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Phing
PhingPhing
Phing
 
Building and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phingBuilding and Deploying PHP Apps Using phing
Building and Deploying PHP Apps Using phing
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
 
11 tools for your PHP devops stack
11 tools for your PHP devops stack11 tools for your PHP devops stack
11 tools for your PHP devops stack
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 

Destaque

Cuestionario en la investigación
Cuestionario en la investigaciónCuestionario en la investigación
Cuestionario en la investigación
jhoel terrel
 
Ecommerce comportamiento del consumidor
Ecommerce comportamiento del consumidorEcommerce comportamiento del consumidor
Ecommerce comportamiento del consumidor
babuhernandez
 
Comportamiento al consumidor
Comportamiento al consumidorComportamiento al consumidor
Comportamiento al consumidor
Marta Copello
 
Comportamiento de compra del consumidor
Comportamiento de compra del consumidorComportamiento de compra del consumidor
Comportamiento de compra del consumidor
miligatix
 
Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...
Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...
Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...
CCIYAP
 

Destaque (20)

El comportamiento de los consumidores panameños
El comportamiento de los consumidores panameñosEl comportamiento de los consumidores panameños
El comportamiento de los consumidores panameños
 
F.e.p.a
F.e.p.aF.e.p.a
F.e.p.a
 
Cuestionario en la investigación
Cuestionario en la investigaciónCuestionario en la investigación
Cuestionario en la investigación
 
Comportamiento de compra del consumidor
Comportamiento de compra del  consumidorComportamiento de compra del  consumidor
Comportamiento de compra del consumidor
 
Comportamiento de compra del consumidor
Comportamiento de compra del consumidorComportamiento de compra del consumidor
Comportamiento de compra del consumidor
 
Presentación adm
Presentación admPresentación adm
Presentación adm
 
Universidad de panama
Universidad de panamaUniversidad de panama
Universidad de panama
 
Ecommerce comportamiento del consumidor
Ecommerce comportamiento del consumidorEcommerce comportamiento del consumidor
Ecommerce comportamiento del consumidor
 
Expectativas de Panamá frente a la crisis financiera y económica mundial
Expectativas de Panamá frente a la crisis financiera y económica mundialExpectativas de Panamá frente a la crisis financiera y económica mundial
Expectativas de Panamá frente a la crisis financiera y económica mundial
 
Comportamiento al consumidor
Comportamiento al consumidorComportamiento al consumidor
Comportamiento al consumidor
 
Comportamiento de compra del consumidor
Comportamiento de compra del consumidorComportamiento de compra del consumidor
Comportamiento de compra del consumidor
 
Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...
Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...
Mediciones enero 2011 - Índice de confianza de los consumidores panameños mar...
 
Comportamiento del consumidor
Comportamiento del consumidor Comportamiento del consumidor
Comportamiento del consumidor
 
Balance Económico de Panamá 2015 y Perspectivas 2016 - Foro de Capital Financ...
Balance Económico de Panamá 2015 y Perspectivas 2016 - Foro de Capital Financ...Balance Económico de Panamá 2015 y Perspectivas 2016 - Foro de Capital Financ...
Balance Económico de Panamá 2015 y Perspectivas 2016 - Foro de Capital Financ...
 
Balance Económico de Panamá del 2015 y Perspectiva del 2016
Balance Económico de Panamá del 2015 y Perspectiva del 2016Balance Económico de Panamá del 2015 y Perspectiva del 2016
Balance Económico de Panamá del 2015 y Perspectiva del 2016
 
Comportamiento del consumidor (20 sesiones)
Comportamiento del consumidor (20 sesiones)Comportamiento del consumidor (20 sesiones)
Comportamiento del consumidor (20 sesiones)
 
Capital structure
Capital structureCapital structure
Capital structure
 
Costos
CostosCostos
Costos
 
Выбор подрядчиков для интернет рекламы и продвижения
Выбор подрядчиков для интернет рекламы и продвиженияВыбор подрядчиков для интернет рекламы и продвижения
Выбор подрядчиков для интернет рекламы и продвижения
 
Pp 101 tahun_2000
Pp 101 tahun_2000Pp 101 tahun_2000
Pp 101 tahun_2000
 

Semelhante a Ansible Project Deploy (phpbenelux 2015)

Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
LeanDog
 

Semelhante a Ansible Project Deploy (phpbenelux 2015) (20)

The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
The Tale of a Docker-based Continuous Delivery Pipeline by Rafe Colton (ModCl...
 
Dockercon EU 2014
Dockercon EU 2014Dockercon EU 2014
Dockercon EU 2014
 
Host any project in che with stacks & chefiles
Host any project in che with stacks & chefilesHost any project in che with stacks & chefiles
Host any project in che with stacks & chefiles
 
Jenkins Pipelines
Jenkins PipelinesJenkins Pipelines
Jenkins Pipelines
 
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins PipelinesAn Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
An Open-Source Chef Cookbook CI/CD Implementation Using Jenkins Pipelines
 
(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines(Declarative) Jenkins Pipelines
(Declarative) Jenkins Pipelines
 
Code in the cloud with Eclipse Che and Docker
Code in the cloud with Eclipse Che and DockerCode in the cloud with Eclipse Che and Docker
Code in the cloud with Eclipse Che and Docker
 
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides:  Let's build macOS CLI Utilities using SwiftMobileConf 2021 Slides:  Let's build macOS CLI Utilities using Swift
MobileConf 2021 Slides: Let's build macOS CLI Utilities using Swift
 
Job DSL Plugin for Jenkins
Job DSL Plugin for JenkinsJob DSL Plugin for Jenkins
Job DSL Plugin for Jenkins
 
(Re)-Introduction to Maven
(Re)-Introduction to Maven(Re)-Introduction to Maven
(Re)-Introduction to Maven
 
Practical introduction to dev ops with chef
Practical introduction to dev ops with chefPractical introduction to dev ops with chef
Practical introduction to dev ops with chef
 
Continuous Integration and DevOps with Open Build Service(OBS)
Continuous Integration and DevOps with Open Build Service(OBS)Continuous Integration and DevOps with Open Build Service(OBS)
Continuous Integration and DevOps with Open Build Service(OBS)
 
Docker 102 - Immutable Infrastructure
Docker 102 - Immutable InfrastructureDocker 102 - Immutable Infrastructure
Docker 102 - Immutable Infrastructure
 
An introduction to maven gradle and sbt
An introduction to maven gradle and sbtAn introduction to maven gradle and sbt
An introduction to maven gradle and sbt
 
Using Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelinesUsing Prometheus to monitor your build pipelines
Using Prometheus to monitor your build pipelines
 
Automate DBA Tasks With Ansible
Automate DBA Tasks With AnsibleAutomate DBA Tasks With Ansible
Automate DBA Tasks With Ansible
 
Knative build for open whisk runtimes phase 1 - 2018-02-20
Knative build for open whisk runtimes   phase 1 - 2018-02-20Knative build for open whisk runtimes   phase 1 - 2018-02-20
Knative build for open whisk runtimes phase 1 - 2018-02-20
 
Python Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part IPython Programming for ArcGIS: Part I
Python Programming for ArcGIS: Part I
 
ASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & dockerASP.NET 5 auf Raspberry PI & docker
ASP.NET 5 auf Raspberry PI & docker
 
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment PipelinesSymfonyCon Berlin 2016 Jenkins Deployment Pipelines
SymfonyCon Berlin 2016 Jenkins Deployment Pipelines
 

Último

₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
Diya Sharma
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
@Chandigarh #call #Girls 9053900678 @Call #Girls in @Punjab 9053900678
 

Último (20)

Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
Wagholi & High Class Call Girls Pune Neha 8005736733 | 100% Gennuine High Cla...
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Daund ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...Russian Call Girls Pune  (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
Russian Call Girls Pune (Adult Only) 8005736733 Escort Service 24x7 Cash Pay...
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...Pune Airport ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready...
Pune Airport ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
(INDIRA) Call Girl Pune Call Now 8250077686 Pune Escorts 24x7
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
Call Girls Sangvi Call Me 7737669865 Budget Friendly No Advance BookingCall G...
 
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
6.High Profile Call Girls In Punjab +919053900678 Punjab Call GirlHigh Profil...
 
Al Barsha Night Partner +0567686026 Call Girls Dubai
Al Barsha Night Partner +0567686026 Call Girls  DubaiAl Barsha Night Partner +0567686026 Call Girls  Dubai
Al Barsha Night Partner +0567686026 Call Girls Dubai
 
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Rani Bagh Escort Service Delhi N.C.R.
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 

Ansible Project Deploy (phpbenelux 2015)

  • 2. ABOUT ME 2 Ramon de la Fuente Future500 B.V. @f_u_e_n_t_e SweetlakePHP
  • 3. WHY ANSIBLE? • Easy. Period. 3 “I wrote Ansible because none of the existing tools fit my brain.” - Michael de Haan
  • 4. WHY ANSIBLE? • Easy. Period. • No unnecessary complexity → No agent! 4
  • 5. WHY ANSIBLE? • Easy. Period. • No unnecessary complexity → No agent! • Built for re-use and sharing. 5
  • 6. WHY ANSIBLE? • Easy. Period. • No unnecessary complexity → No agent! • Built for re-use and sharing. • Extendable in your own language. 6
  • 8. THE PROBLEM • Continuous deployment • Easy maintenance of the deploy procedure. 8
  • 9. THE PROBLEM • Continuous deployment • Easy maintenance of the deploy procedure. • Small learning curve. 9
  • 10. THE PROBLEM • Continuous deployment • Easy maintenance of the deploy procedure. • Small learning curve. • Reuse between projects with little effort. 10
  • 11. WHAT IS A DEPLOY? Directory structure: . !"" releases | !"" 20140415234508 | #"" 20140415235146 !"" shared | !"" sessions | !"" source | #"" uploads #"" current -> releases/20140415235146 11
  • 12. WHAT IS A DEPLOY? Directory structure: . !"" releases | !"" 20140415234508 | #"" 20140415235146 !"" shared | !"" sessions | !"" source | #"" uploads #"" current -> releases/20140415235146 12
  • 13. WHAT IS A DEPLOY? 1. Update the codebase + configuration 13
  • 14. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 14
  • 15. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 3. Preserve shared resources 15
  • 16. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 3. Preserve shared resources 4. Build tasks 16
  • 17. WHAT IS A DEPLOY? 1. Update the codebase + configuration 2. Install dependencies 3. Preserve shared resources 4. Build tasks 5. Finalize 17
  • 19. GETTINGTHE ROLE Installation with ansible-galaxy command: $ ansible-galaxy install f500.project_deploy,v2.1.0 Optional: create a galaxy file for all roles: f500.nginx f500.mariadb55 f500.php f500.project_deploy,v2.1.0 $ ansible-galaxy install -r ansible/galaxy.txt 19
  • 20. ROLE WALKTHROUGH --- - name: Initialize deploy_helper: "path={{ project_root }} state=present" 20
  • 21. ROLE WALKTHROUGH Deploy module variables: deploy_helper: project_path current_path releases_path shared_path previous_release previous_release_path new_release new_release_path unfinished_filename 21
  • 22. ROLE WALKTHROUGH Deploy module variables: deploy_helper: project_path: /path/to/project/ current_path: /path/to/project/current releases_path: /path/to/project/releases shared_path: /path/to/project/shared previous_release: 20140415234508 previous_release_path: /path/to/project/releases/20140415234508 new_release: 20140415235146 new_release_path: /path/to/project/releases/20140415235146 unfinished_filename: DEPLOY_UNFINISHED Used as: {{ deploy_helper.new_release }} 22
  • 23. 1. UPDATETHE CODEBASE - name: Clone project files git: repo={{ project_git_repo }} dest={{ project_source_path }} version={{ project_version }} when: project_deploy_strategy == 'git' - name: Rsync project files synchronize: src={{ project_local_path }} dest={{ project_source_path }} rsync_timeout={{ project_deploy_synchronize_timeout }} recursive=yes when: project_deploy_strategy == 'synchronize' 23
  • 24. 1. UPDATETHE CODEBASE - name: Clone project files git: repo={{ project_git_repo }} dest={{ project_source_path }} version={{ project_version }} when: project_deploy_strategy == 'git' - name: Rsync project files synchronize: src={{ project_local_path }} dest={{ project_source_path }} rsync_timeout={{ project_deploy_synchronize_timeout }} recursive=yes when: project_deploy_strategy == 'synchronize' 24
  • 25. 1. UPDATETHE CODEBASE - name: Clone project files git: repo={{ project_git_repo }} dest={{ project_source_path }} version={{ project_version }} when: project_deploy_strategy == 'git' - name: Rsync project files synchronize: src={{ project_local_path }} dest={{ project_source_path }} rsync_timeout={{ project_deploy_synchronize_timeout }} recursive=yes when: project_deploy_strategy == 'synchronize' 25
  • 26. 1. UPDATETHE CODEBASE - name: Write unfinished file file: path={{ project_source_path }}/{{ deploy_helper.unfinished_filename }} state=touch - name: Copy files to new build dir command: "cp -pr {{project_source_path}} {{deploy_helper.new_release_path}}" - name: Remove unwanted files/folders from new release file: path={{ deploy_helper.new_release_path }}/{{ item }} state=absent with_items: project_unwanted_items 26
  • 27. 1. UPDATETHE CONFIG FILES - name: Copy project files copy: src={{ item.src }} dest={{ deploy_helper.new_release_path }}/{{ item.dest }} mode={{ item.mode|default('0644') }} with_items: project_files - name: Copy project templates template: src={{ item.src }} dest={{ deploy_helper.new_release_path }}/{{ item.dest }} mode={{ item.mode|default('0644') }} with_items: project_templates 27
  • 28. 2. INSTALL DEPENDENCIES - name: Do composer install command: "{{ project_command_for_composer_install }} chdir=…" environment: project_environment when: project_has_composer - name: Do npm install command: "{{ project_command_for_npm_install }} chdir=…" environment: project_environment when: project_has_npm - name: Do bower install command: "{{ project_command_for_bower_install }} chdir=…" environment: project_environment when: project_has_bower 28
  • 29. 2. INSTALL DEPENDENCIES - name: Do composer install command: "{{ project_command_for_composer_install }} chdir=…" environment: project_environment when: project_has_composer - name: Do npm install command: "{{ project_command_for_npm_install }} chdir=…" environment: project_environment when: project_has_npm - name: Do bower install command: "{{ project_command_for_bower_install }} chdir=…" environment: project_environment when: project_has_bower 29
  • 30. 3. SHARED RESOURCES - name: Ensure shared sources are present file: path='{{ deploy_helper.shared_path }}/{{ item.src }}' state={{ item.type }} with_items: project_shared_children - name: Ensure shared paths are absent file: path='{{ deploy_helper.new_release_path }}/{{ item.path }}' state=absent with_items: project_shared_children - name: Create shared symlinks file: path='{{ deploy_helper.new_release_path }}/{{ item.path }}' src='{{ deploy_helper.shared_path }}/{{ item.src }}' state=link" with_items: project_shared_children 30
  • 31. 4. BUILD STEPS - name: Run post_build_commands in the new_release_path command: "{{ item }} chdir={{ deploy_helper.new_release_path }}" with_items: project_post_build_commands environment: project_environment 31 project_post_build_commands: - "app/console cache:clear" - "app/console assets:install" - "app/console assetic:dump"
  • 32. 5. FINALIZE - name: Finalize the deploy
 deploy_helper: path={{ project_root }} release={{ deploy_helper.new_release }} state=finalize
 when: project_finalize
 32
  • 33. 33
  • 34. IT’S NOT COMPLICATED! • Only 98 lines • Number of tasks: 22 • Variables to configure: 28 34
  • 35. MINIMAL PLAYBOOK 1. Set minimum variables 2. Add the role to “roles” section 35
  • 36. MINIMAL PLAYBOOK - name: Deploy the application hosts: production remote_user: deploy sudo: no vars: project_root: /var/www/my_project project_git_repo: git@github.com:me/my_project.git project_deploy_strategy: git roles: - f500.project_deploy 36
  • 37. EXAMPLE PLAYBOOK - name: Deploy the application hosts: production remote_user: "{{ production_deploy_user }}" sudo: no vars: project_root: "{{ sweetlakephp_root }}" project_git_repo: "{{ sweetlakephp_github_repo }}" project_deploy_strategy: git 37
  • 38. EXAMPLE PLAYBOOK - name: Deploy the application hosts: production remote_user: "{{ production_deploy_user }}" sudo: no vars: project_root: "{{ sweetlakephp_root }}" project_git_repo: "{{ sweetlakephp_github_repo }}" project_deploy_strategy: git project_environment: SYMFONY_ENV: "prod" 38
  • 39. EXAMPLE PLAYBOOK project_environment: SYMFONY_ENV: "prod" project_shared_children: - path: "/app/sessions" src: "sessions" - path: "/web/uploads" src: "uploads" project_templates: - name: parameters.yml src: "templates/parameters_prod.yml.j2" dest: "/app/config/parameters_prod.yml" 39
  • 40. EXAMPLE PLAYBOOK project_environment: SYMFONY_ENV: "prod" project_shared_children: - path: "/app/sessions" src: "sessions" - path: "/web/uploads" src: "uploads" project_templates: - name: parameters.yml src: "templates/parameters_prod.yml.j2" dest: "/app/config/parameters.yml" 40
  • 41. EXAMPLE PLAYBOOK project_has_composer: yes project_post_build_commands: - "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php” - "app/console cache:clear" - "app/console doctrine:migrations:migrate --no-interaction" - "app/console assets:install" - "app/console assetic:dump" roles: - f500.project_deploy 41
  • 42. EXAMPLE PLAYBOOK project_has_composer: yes project_post_build_commands: - "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php” - "app/console cache:clear" - "app/console doctrine:migrations:migrate --no-interaction" - "app/console assets:install" - "app/console assetic:dump" roles: - f500.project_deploy 42
  • 43. EXAMPLE PLAYBOOK 43 project_has_composer: yes project_post_build_commands: - "php vendor/sensio/…/DistributionBundle/…/bin/build_bootstrap.php” - "app/console cache:clear" - "app/console doctrine:migrations:migrate --no-interaction" - "app/console assets:install" - "app/console assetic:dump" roles: - f500.project_deploy
  • 44. WHAT DOESN’T IT DO? 44 • Rollbacks (the cake rollback is a lie)
  • 45. WHAT DOESN’T IT DO? 45 • Rollbacks • Set maintenance mode (the cake rollback is a lie)
  • 46. WHAT DOESN’T IT DO? 46 • Rollbacks • Set maintenance mode • DB migrations (the cake rollback is a lie)
  • 47. WHAT’S NEXT? 47 • Injecting your own tasks in addition to commands
  • 48. WHAT’S NEXT? 48 • Injecting your own tasks in addition to commands • Copy vendor folders from previous release ✓
  • 49. WHAT’S NEXT? 49 • Injecting your own tasks in addition to commands • Copy vendor folders from previous release • Setfacl support ✓
  • 50. WHAT’S NEXT? 50 • Injecting your own tasks in addition to commands • Copy vendor folders from previous release • Setfacl support • Your ideas? ✓
  • 51. THANKYOU! 51 Feedback: joind.in 13405 f500/ansible-project_deploy (But I’m also just a human. You could talk to me and tell me what you think…) https://github.com/