SlideShare une entreprise Scribd logo
1  sur  12
Télécharger pour lire hors ligne
Deploy easily!
with
Igor Santos
Web developer
● From Rio de Janeiro, Brazil
● PHP Developer for ~6 years
● Ruby and JS Developer for fun
● Playing around with git for ~2 years
slideshare.net/igorsantos07
0. Introduction
● Knows what Git is?
● Have ever used Git in the command line?
● Have ever deployed code?
○ How? SCP? WGet?
● Anyone developing in the production server?
1. Git Basics
● Commit: Saves changes with a description
● Pull: Get commits from a server
● Push: Send commits to a server
● Remotes
○ A remote machine that has a copy of the repository
and accepts your commits
○ In a common centralized organization you usually
have one, but it's possible to have many
○ Example: main repo is BitBucket or Google Code,
mirrored to GitHub
2. Configure your server
igor@local$ ssh santos@bluenose.cs.dal.ca
password: **********
santos@bluenose$ mkdir repos
santos@bluenose$ cd repos
santos@bluenose$ pwd
/users/cs/santos/repos
santos@bluenose$ git clone «repo» myRep --bare
This creates a clone of that repository that works just as
another repository: with all administrative data, but not
useable for development, as the code is not really checked
in - just the Git meta-data.
Take note
igor@local$ cd dev/myCode
igor@local$ git remote add prod
ssh://santos@bluenose.cs.dal.ca:/users/cs/santos/repos/myRep
igor@local$ "Hi there!" > README.mkd
igor@local$ git commit "+ Adding readme"
igor@local$ git push prod
2. Configure your server
Name given to the remote server
Complete repository URL
No line break!
igor@local$ git commit "+ Adding readme"
igor@local$ git push prod
Q: OK, so... where's my README file?
A: In the repository!
Q: I can't see it. «not really a question»
2. Configure your server
3. Git Hooks
● 2 types: client and server hooks
● Client:
○ pre/post-commit
○ [prepare-]commit-msg
○ post-checkout, post-merge
● Server:
○ pre/post-receive Once per push
○ update Once per pushed branch
http://git-scm.com/book/en/Customizing-Git-Git-Hooks
3. Git Hooks
Simple copy
$ cat hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/var/www/mysite git checkout -f
Opposite of git clone --bare: copies the entire repository
code, without git data. By default does that with the master
branch, but you can use other options here as well.
GIT_WORK_TREE tells git where it would copy stuff.
3. Git Hooks
Complete deployment script
https://bitbucket.org/igorsantos07/calen-do/src/3fea92ee46c1/git-hooks/update
4. Advanced ideas
GitHub and other Git online repositories
have options to do HTTP requests with code
information after pushes, similar to post-
receive hooks. This data can be used to
trigger a deployment script in the server.
There's also an online service called
DeployHQ, where you can configure any
repository (SVN/Git/Hg) and many deploy
methods (FTP/SFTP/S3/Rackspace).
It deploys new code using the chosen method.
4. Adv.
ideas
deployhq.com

Contenu connexe

Tendances

A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model abodeltae
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CIOlinData
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-trainingEric Guo
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CIColCh
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabShinu Suresh
 
Docker introduction in Hardware Company
Docker introduction in Hardware CompanyDocker introduction in Hardware Company
Docker introduction in Hardware CompanyEvan Lin
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golangBo-Yi Wu
 
Breaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CIBreaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CIIvan Nemytchenko
 
A painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaA painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaBo-Yi Wu
 
Jenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-PipelinesJenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-PipelinesChristian Münch
 
Git introduction for Beginners
Git introduction for BeginnersGit introduction for Beginners
Git introduction for BeginnersMortezaTaghaddomi
 

Tendances (20)

A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
FOSDEM 2017: GitLab CI
FOSDEM 2017:  GitLab CIFOSDEM 2017:  GitLab CI
FOSDEM 2017: GitLab CI
 
Juc boston2014.pptx
Juc boston2014.pptxJuc boston2014.pptx
Juc boston2014.pptx
 
Git flow
Git flowGit flow
Git flow
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
Git extension-training
Git extension-trainingGit extension-training
Git extension-training
 
Git best practices 2016
Git best practices 2016Git best practices 2016
Git best practices 2016
 
Git
GitGit
Git
 
Using GitLab CI
Using GitLab CIUsing GitLab CI
Using GitLab CI
 
Git workflows
Git workflowsGit workflows
Git workflows
 
GitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLabGitFlow, SourceTree and GitLab
GitFlow, SourceTree and GitLab
 
Git
GitGit
Git
 
Docker introduction in Hardware Company
Docker introduction in Hardware CompanyDocker introduction in Hardware Company
Docker introduction in Hardware Company
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Breaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CIBreaking Bad Habits with GitLab CI
Breaking Bad Habits with GitLab CI
 
A painless self-hosted Git service: Gitea
A painless self-hosted Git service: GiteaA painless self-hosted Git service: Gitea
A painless self-hosted Git service: Gitea
 
Jenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-PipelinesJenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-Pipelines
 
Git introduction for Beginners
Git introduction for BeginnersGit introduction for Beginners
Git introduction for Beginners
 

En vedette

Introduction to Kaizen by Toby Hunt
Introduction to Kaizen by Toby HuntIntroduction to Kaizen by Toby Hunt
Introduction to Kaizen by Toby Huntpebble {code}
 
Accomplishments-Certifications
Accomplishments-CertificationsAccomplishments-Certifications
Accomplishments-CertificationsMelissa Schaefer
 
Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...
Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...
Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...Dusan Stojnic
 
More Leadership Lessons Workshop Global
More Leadership Lessons Workshop GlobalMore Leadership Lessons Workshop Global
More Leadership Lessons Workshop GlobalJohn Fall
 
Ch 1- Water and Soil, Stone and Metal
Ch 1- Water and Soil, Stone and MetalCh 1- Water and Soil, Stone and Metal
Ch 1- Water and Soil, Stone and MetalCraig Campbell
 
Landskapsreformen i Österbotten - Maakuntauudistus Pohjanmaalla
Landskapsreformen i Österbotten - Maakuntauudistus PohjanmaallaLandskapsreformen i Österbotten - Maakuntauudistus Pohjanmaalla
Landskapsreformen i Österbotten - Maakuntauudistus PohjanmaallaMikaela Jussila
 
Choose Coach Hire Adelaide or Adelaide Coach Hire Services
Choose Coach Hire Adelaide or Adelaide Coach Hire ServicesChoose Coach Hire Adelaide or Adelaide Coach Hire Services
Choose Coach Hire Adelaide or Adelaide Coach Hire ServicesCorstton Coaches
 
PivotReseller_Sales_Profit_by_Country_and_Occupation
PivotReseller_Sales_Profit_by_Country_and_OccupationPivotReseller_Sales_Profit_by_Country_and_Occupation
PivotReseller_Sales_Profit_by_Country_and_OccupationMike Santeramo
 
Huuhedin suvilahgui 1
Huuhedin suvilahgui 1Huuhedin suvilahgui 1
Huuhedin suvilahgui 1oyunubuns
 
Safety Leadership Event 2016 - Leader del miglioramento virale
Safety Leadership Event 2016 - Leader del miglioramento viraleSafety Leadership Event 2016 - Leader del miglioramento virale
Safety Leadership Event 2016 - Leader del miglioramento viraleSebastiano Trapani
 
Comparatividad Entre Piscis Y Acuarius
Comparatividad Entre  Piscis Y  AcuariusComparatividad Entre  Piscis Y  Acuarius
Comparatividad Entre Piscis Y Acuariusguest6942b5
 
Rezultate Eco-Scoala
Rezultate Eco-ScoalaRezultate Eco-Scoala
Rezultate Eco-ScoalaProfesorgeo
 

En vedette (17)

Introduction to Kaizen by Toby Hunt
Introduction to Kaizen by Toby HuntIntroduction to Kaizen by Toby Hunt
Introduction to Kaizen by Toby Hunt
 
Accomplishments-Certifications
Accomplishments-CertificationsAccomplishments-Certifications
Accomplishments-Certifications
 
Boquita deluna
Boquita delunaBoquita deluna
Boquita deluna
 
Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...
Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...
Potocnik et al - Efekti i optimizacija rada višefunkcionalne mašine u slučaju...
 
The euro
The euroThe euro
The euro
 
More Leadership Lessons Workshop Global
More Leadership Lessons Workshop GlobalMore Leadership Lessons Workshop Global
More Leadership Lessons Workshop Global
 
HEAT TRANSFER
HEAT TRANSFERHEAT TRANSFER
HEAT TRANSFER
 
Ch 1- Water and Soil, Stone and Metal
Ch 1- Water and Soil, Stone and MetalCh 1- Water and Soil, Stone and Metal
Ch 1- Water and Soil, Stone and Metal
 
Landskapsreformen i Österbotten - Maakuntauudistus Pohjanmaalla
Landskapsreformen i Österbotten - Maakuntauudistus PohjanmaallaLandskapsreformen i Österbotten - Maakuntauudistus Pohjanmaalla
Landskapsreformen i Österbotten - Maakuntauudistus Pohjanmaalla
 
Choose Coach Hire Adelaide or Adelaide Coach Hire Services
Choose Coach Hire Adelaide or Adelaide Coach Hire ServicesChoose Coach Hire Adelaide or Adelaide Coach Hire Services
Choose Coach Hire Adelaide or Adelaide Coach Hire Services
 
Patientencommunicatie
PatientencommunicatiePatientencommunicatie
Patientencommunicatie
 
PivotReseller_Sales_Profit_by_Country_and_Occupation
PivotReseller_Sales_Profit_by_Country_and_OccupationPivotReseller_Sales_Profit_by_Country_and_Occupation
PivotReseller_Sales_Profit_by_Country_and_Occupation
 
Huuhedin suvilahgui 1
Huuhedin suvilahgui 1Huuhedin suvilahgui 1
Huuhedin suvilahgui 1
 
Unit 2
Unit 2Unit 2
Unit 2
 
Safety Leadership Event 2016 - Leader del miglioramento virale
Safety Leadership Event 2016 - Leader del miglioramento viraleSafety Leadership Event 2016 - Leader del miglioramento virale
Safety Leadership Event 2016 - Leader del miglioramento virale
 
Comparatividad Entre Piscis Y Acuarius
Comparatividad Entre  Piscis Y  AcuariusComparatividad Entre  Piscis Y  Acuarius
Comparatividad Entre Piscis Y Acuarius
 
Rezultate Eco-Scoala
Rezultate Eco-ScoalaRezultate Eco-Scoala
Rezultate Eco-Scoala
 

Similaire à Deployment made easy with Git

Getting started with git
Getting started with gitGetting started with git
Getting started with gitPawan Kumar.v
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneVEXXHOST Private Cloud
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How tolanhuonga3
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and GithubWycliff1
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git TutorialSage Sharp
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developersmpvanwinkle
 
GIT workshop at Selenium Conference 2018
GIT workshop at Selenium Conference 2018GIT workshop at Selenium Conference 2018
GIT workshop at Selenium Conference 2018Pooja Shah
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17siva ram
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configurationKishor Kumar
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsLee Hanxue
 
You're doing it wrong! Git it right!
You're doing it wrong! Git it right!You're doing it wrong! Git it right!
You're doing it wrong! Git it right!Cory Webb
 

Similaire à Deployment made easy with Git (20)

Getting started with git
Getting started with gitGetting started with git
Getting started with git
 
Github basics
Github basicsGithub basics
Github basics
 
3 Git
3 Git3 Git
3 Git
 
How To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub CloneHow To Install GitLab As Your Private GitHub Clone
How To Install GitLab As Your Private GitHub Clone
 
Git: Why And How to
Git: Why And How toGit: Why And How to
Git: Why And How to
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Git & github
Git & githubGit & github
Git & github
 
Git Basics
Git BasicsGit Basics
Git Basics
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
.Git for WordPress Developers
.Git for WordPress Developers.Git for WordPress Developers
.Git for WordPress Developers
 
GIT workshop at Selenium Conference 2018
GIT workshop at Selenium Conference 2018GIT workshop at Selenium Conference 2018
GIT workshop at Selenium Conference 2018
 
Git 1
Git 1Git 1
Git 1
 
GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17GIT_GITHUB_2016_06_17
GIT_GITHUB_2016_06_17
 
Git basics
Git basicsGit basics
Git basics
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
 
Git basics
Git basicsGit basics
Git basics
 
GitHub Event.pptx
GitHub Event.pptxGitHub Event.pptx
GitHub Event.pptx
 
You're doing it wrong! Git it right!
You're doing it wrong! Git it right!You're doing it wrong! Git it right!
You're doing it wrong! Git it right!
 

Dernier

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 

Dernier (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
+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...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Deployment made easy with Git

  • 2. Igor Santos Web developer ● From Rio de Janeiro, Brazil ● PHP Developer for ~6 years ● Ruby and JS Developer for fun ● Playing around with git for ~2 years slideshare.net/igorsantos07
  • 3. 0. Introduction ● Knows what Git is? ● Have ever used Git in the command line? ● Have ever deployed code? ○ How? SCP? WGet? ● Anyone developing in the production server?
  • 4. 1. Git Basics ● Commit: Saves changes with a description ● Pull: Get commits from a server ● Push: Send commits to a server ● Remotes ○ A remote machine that has a copy of the repository and accepts your commits ○ In a common centralized organization you usually have one, but it's possible to have many ○ Example: main repo is BitBucket or Google Code, mirrored to GitHub
  • 5. 2. Configure your server igor@local$ ssh santos@bluenose.cs.dal.ca password: ********** santos@bluenose$ mkdir repos santos@bluenose$ cd repos santos@bluenose$ pwd /users/cs/santos/repos santos@bluenose$ git clone «repo» myRep --bare This creates a clone of that repository that works just as another repository: with all administrative data, but not useable for development, as the code is not really checked in - just the Git meta-data. Take note
  • 6. igor@local$ cd dev/myCode igor@local$ git remote add prod ssh://santos@bluenose.cs.dal.ca:/users/cs/santos/repos/myRep igor@local$ "Hi there!" > README.mkd igor@local$ git commit "+ Adding readme" igor@local$ git push prod 2. Configure your server Name given to the remote server Complete repository URL No line break!
  • 7. igor@local$ git commit "+ Adding readme" igor@local$ git push prod Q: OK, so... where's my README file? A: In the repository! Q: I can't see it. «not really a question» 2. Configure your server
  • 8. 3. Git Hooks ● 2 types: client and server hooks ● Client: ○ pre/post-commit ○ [prepare-]commit-msg ○ post-checkout, post-merge ● Server: ○ pre/post-receive Once per push ○ update Once per pushed branch http://git-scm.com/book/en/Customizing-Git-Git-Hooks
  • 9. 3. Git Hooks Simple copy $ cat hooks/post-receive #!/bin/sh GIT_WORK_TREE=/var/www/mysite git checkout -f Opposite of git clone --bare: copies the entire repository code, without git data. By default does that with the master branch, but you can use other options here as well. GIT_WORK_TREE tells git where it would copy stuff.
  • 10. 3. Git Hooks Complete deployment script https://bitbucket.org/igorsantos07/calen-do/src/3fea92ee46c1/git-hooks/update
  • 11. 4. Advanced ideas GitHub and other Git online repositories have options to do HTTP requests with code information after pushes, similar to post- receive hooks. This data can be used to trigger a deployment script in the server. There's also an online service called DeployHQ, where you can configure any repository (SVN/Git/Hg) and many deploy methods (FTP/SFTP/S3/Rackspace). It deploys new code using the chosen method.