SlideShare une entreprise Scribd logo
1  sur  51
A Git Friendly Way to
Handle WP Updates
Hi!
Per André Rønsen, CTO & partner
Foad Yousefi, Developer
Twitter:
@perandre
@frontkom
TL;DW
We built a tool to fetch specific
versions of core, plugins &
themes using a single config file
Better security!
Cleaner repo!
Happy developers!
Some background
Two ways to maintain your WP code
FTP :)
Stuff that happen when
you update a plugin
directly on production
server
Now, imagine auto
update doing this every
other day ...
We want Git.
We want to auto
update (some) plugins
WP Auto Updates has
some config for
versions ++
… but no config for a
Perfect Git Setup™
Plugins to the rescue?
Lets you select which plugins to auto update
(but has no Git support).
How do other CMS-es
solve it?
Drupal: custom plugins separated from contrib
(Raise of hands: How
many use Git?
Terminal? WP-CLI?
Build files?)
“WP-CLI is the
command-line
interface for
WordPress.”
Build file?
Website! Another website!
Build file: a file listing what themes and plugins to download. Version control 1 file – not 1 million.
Introducing: WP-
CLI Build
A command line tool
extending WP-CLI.
https://github.com/front/wp-cli-build
Install it!
~ wp package install
front/wp-cli-build
Get started!
~ wp build-generate
Latest patch within minor version 4.9
Latest available version
Fixed: Stick to this
Latest minor within major version 1
.gitignore: inverted
The old way
such files
very bloat!
not wow
The new way
~ wp build
</theory>
It’s demo time!
Step 1:
Log into server and put
your site into Git with
WP-CLI
Step 2:
Clone the site and run
the build file
Step 3:
Update plugins
Step 4:
Make the build file
run every day
~ crontab -e
Better security!
Cleaner repo!
Happy developers!
[wait for
applause]
THX!
Reach out:
perandre@front.no
twitter.com/perandre
The links!
● WP-CLI Build on Github
● WP-CLI.org
● Codex: Configuring Automatic Background Updates
● Scheduling tasks with cron jobs
● drush.org
● frontkom.no

Contenu connexe

Tendances

Modular development in Node.js
Modular development in Node.jsModular development in Node.js
Modular development in Node.js
Mehdi Valikhani
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae
 

Tendances (20)

Bitbucket and Git
Bitbucket and GitBitbucket and Git
Bitbucket and Git
 
Hackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we MakeHackaton for health 2015 - Sharing the Code we Make
Hackaton for health 2015 - Sharing the Code we Make
 
Modular development in Node.js
Modular development in Node.jsModular development in Node.js
Modular development in Node.js
 
Bitbucket git-bamboo-jira
Bitbucket git-bamboo-jiraBitbucket git-bamboo-jira
Bitbucket git-bamboo-jira
 
Atlassian Bamboo Feature Overview
Atlassian Bamboo Feature OverviewAtlassian Bamboo Feature Overview
Atlassian Bamboo Feature Overview
 
Deployment made easy with Git
Deployment made easy with GitDeployment made easy with Git
Deployment made easy with Git
 
How we use Bitbucket to build Bitbucket
How we use Bitbucket to build BitbucketHow we use Bitbucket to build Bitbucket
How we use Bitbucket to build Bitbucket
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 
Get your Git on GitHub
Get your Git on GitHubGet your Git on GitHub
Get your Git on GitHub
 
C#: Past, Present and Future
C#: Past, Present and FutureC#: Past, Present and Future
C#: Past, Present and Future
 
Bitbucket
BitbucketBitbucket
Bitbucket
 
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
 
Git the easy way
Git the easy wayGit the easy way
Git the easy way
 
Git essentials
Git essentialsGit essentials
Git essentials
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
Using a Private Git Server for Packaging Software
Using a Private Git Server for Packaging SoftwareUsing a Private Git Server for Packaging Software
Using a Private Git Server for Packaging Software
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
Github 101 An Adventurer's Guide To Open Source
Github 101   An Adventurer's Guide To Open SourceGithub 101   An Adventurer's Guide To Open Source
Github 101 An Adventurer's Guide To Open Source
 
Using the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to BitbucketUsing the GitHub App to Connect to Bitbucket
Using the GitHub App to Connect to Bitbucket
 
A prentation on github
A prentation on githubA prentation on github
A prentation on github
 

Similaire à A git friendly way to handle wp updates

An Introduction To Linux Development Environment
An Introduction To Linux Development EnvironmentAn Introduction To Linux Development Environment
An Introduction To Linux Development Environment
S. M. Hossein Hamidi
 
Eminence team
Eminence teamEminence team
Eminence team
Vivin NL
 
Volunteering atyouseeforit services
Volunteering atyouseeforit servicesVolunteering atyouseeforit services
Volunteering atyouseeforit services
YouSee
 

Similaire à A git friendly way to handle wp updates (20)

BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
An Introduction To Linux Development Environment
An Introduction To Linux Development EnvironmentAn Introduction To Linux Development Environment
An Introduction To Linux Development Environment
 
Eminence team
Eminence teamEminence team
Eminence team
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdf
 
Fun with Jenkins & Salesforce
Fun with Jenkins & SalesforceFun with Jenkins & Salesforce
Fun with Jenkins & Salesforce
 
Volunteering atyouseeforit services
Volunteering atyouseeforit servicesVolunteering atyouseeforit services
Volunteering atyouseeforit services
 
August OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub ExplainedAugust OpenNTF Webinar - Git and GitHub Explained
August OpenNTF Webinar - Git and GitHub Explained
 
create_patch_file_v3a.pdf
create_patch_file_v3a.pdfcreate_patch_file_v3a.pdf
create_patch_file_v3a.pdf
 
Git session 1
Git session 1Git session 1
Git session 1
 
Git for joomla! development #JAB14
Git for joomla! development #JAB14Git for joomla! development #JAB14
Git for joomla! development #JAB14
 
Git.pptx
Git.pptxGit.pptx
Git.pptx
 
Introduction to Git for Network Engineers (Lab Guide)
Introduction to Git for Network Engineers (Lab Guide)Introduction to Git for Network Engineers (Lab Guide)
Introduction to Git for Network Engineers (Lab Guide)
 
Managing Plone Projects with Perl and Subversion
Managing Plone Projects with Perl and SubversionManaging Plone Projects with Perl and Subversion
Managing Plone Projects with Perl and Subversion
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Programming In Linux Presentation
Programming In Linux PresentationProgramming In Linux Presentation
Programming In Linux Presentation
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
WordPress modern development
WordPress modern developmentWordPress modern development
WordPress modern development
 
Azure DevOps - Version Controlling with Git
Azure DevOps - Version Controlling with GitAzure DevOps - Version Controlling with Git
Azure DevOps - Version Controlling with Git
 
Gerrit linuxtag2011
Gerrit linuxtag2011Gerrit linuxtag2011
Gerrit linuxtag2011
 

Dernier

+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@
 

Dernier (20)

Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
+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...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
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
 
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
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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...
 
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
 
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
 

A git friendly way to handle wp updates

Notes de l'éditeur

  1. Thanks! Welcome to our session:
  2. My name Frontkom Digital agency And with me: Foad
  3. This gives you:
  4. Two ways! Custom code? Git is mandatory. Control: code’s history Onboard other developers. Test updates => roll back
  5. Git: All WP WordPress core Free plugins Premium plugins Custom theme and custom plugins … ignore Media Uploads and config code changes locally, push to you remote repo pull on prod
  6. Break git Impossible to fetch new code Force you to commit your files from server. No more testing locally before commiting to Git. Suddenly, Git makes your life harder, not easier.
  7. Let’s mess up the Git repository on a regular basis! Not cool Most devs decide: Not use auto updates even for security bug fixes Never click the admin panel Update button on server
  8. We’ve used Git for all projects for 10 years. Not auto updates. But: WP is so widely used, that hackers attack Fast security updates is crucial.
  9. We tried to create an automated setup using the WP core auto update options.
  10. But it didn’t play well with our Git setup :(
  11. Also tested some plugins
  12. Easy Updates Manager: select which plugins to auto update. But: It has no Git support. We actually reached out with a Pull Request, but they decided to not go with it.
  13. In Drupal, custom code is separated from contrib code This means you can add one folder to Git, and ignore the other.
  14. Also, Drupal has a shell – DRUSH. Dev tool for the terminal, just like WP-CLI. Drush provides functionality to update your site using a single configuration file.
  15. Before we continue:
  16. It’s really nice.
  17. What is a build file?
  18. Often used by web apps. Complex dependencies. Or: it can help you maintain WP.
  19. We created something similar, and we call it WP-CLI Build. Open source package by Frontkom. Name is not sexy. Not your wife – it’s a wp tool.
  20. It’s a tool developers use with WP-CLI.
  21. It’s on Github, so anyone can start using it today. LIke it? Star it?
  22. How do we get started, Foad?
  23. Foad: Well this tool is extending WP-CLI, so first you need to install wp-cli. If you haven’t, go install WP CLI locally and on your server
  24. Then run the package install command
  25. Let’s look at what it can do for us.
  26. Our tool has two main commands. The first: build-generate In the root of an existing WP website, run this command. It will generate your build file and a very special .gitignore file. What the files will look like, depends on your active plugins, theme and custom code.
  27. Thanks to the “build-generate” command, it will list all active plugins and theme with their current version numbers. Then you can edit the version in the build file. Ask yourself how likely it is that an update will break the site, and proceed with one of four choices: Latest version Latest patch within minor version Latest minor within major version 1 Fixed version – you rely on this version for critical API-stuff And oh: it supports both Yaml and JSON formats, so you can use the format your are most comfortable with.
  28. Another important file: .gitignore. We wanted to : use the UI to quickly update plugins on server without messing up the Git repo. I even wanted to automate it. The WP plugins folder is shared between custom plugins, premium plugins and free plugins. How do you tell WP to ignore the free plugins and just Git index the custom ones? That is really hard, so we found a simpler solution: Let’s create a negative .gitignore file that ignores absolutely everything.
  29. build-generate creates a file with lots of rules. The slash asterisk rule tells Git to literally ignore everything. Index nothing! Then it carefully adds back in: your active custom plugins and custom theme. You don’t need to remember this; it’s added automatically on build-generate. If a .gitignore already exists, it will simply add this block above whatever is there.
  30. Makes your Git repository pretty. Before: A million files that are already maintained on wordpress.org.
  31. Now: Much fewer files: easy overview and maintenance. Central to goal of Git friendly auto updates.
  32. The second command is: build This will take your build file and download whatever it finds there. it builds your site and brings it all together.
  33. Enough theory: Demo time! Show us how this helps us in real life, Foad.
  34. Here we have an existing website deployed using FTP, we want to bring it to GIT
  35. Let’s go into the root directory where WP website lives, run the command: build-generate and take the code to Github [play video]
  36. The other use case is to install an instance on local machine or staging server or maybe deploy to production server.
  37. First we clone GIT repository Then run wp build command Need to mention I’ve imported the database
  38. Some of plugins are potential to have breaking changes, so they should be updated manually.
  39. Here there is updates available for Timber Library I’m updating it via WP command Then test website if everything works and make sure don’t have any errors in our error log
  40. Foad: It is time to automate the update process.
  41. First we configure build.json file. Then on the server, we create a shell command to run ‘wp build’. Don’t forget to give it correct permission. In this case, 755. Then set up cron job using crontab command.
  42. PA: To quote myself: This way of handling updates gives you:
  43. Thank you!
  44. Thank you!