SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
Web development
automatisation
for fun and profit
Artem Daniliants / LumoSpark
Automatisation = secret weapon
Git rocks!
Git hooks rock!
Save WP database with each commit
Pre-commit hook
#!/bin/sh
mkdir -p _db_snapshot
./vendor/bin/wp db export _db_snapshot/database.sql
git add _db_snapshot/database.sql
Check PHP syntax errors before commit
Pre-commit hook
git diff --cached --name-only | while read FILE; do
if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then
# Courtesy of swytsh from the comments below.
if [[ -f $FILE ]]; then
php -l "$FILE" 1> /dev/null
if [ $? -ne 0 ]; then
echo -e "e[1;31mtAborting commit due to files with syntax errors.e[0m" >&2
exit 1
fi
fi
fi
done || exit $?
Spellchecking commit messages
Pre-commit hook
ASPELL=$(which aspell)
if [ $? -ne 0 ]; then
echo "Aspell not installed - unable to check spelling" >&2
exit
else
WORDS=$($ASPELL list < "$1")
fi
if [ -n "$WORDS" ]; then
echo -e "e[1;33mtPossible spelling errors found in commit message.
Use git commit --amend to change the message.
ntPossible mispelled words: " $WORDS ".e[0m" >&2
fi
Dependancy management ftw (composer)
Video: YouTube link
Useful composer comands
composer init # To create a new composer.json file in a project
composer show # display all project packages
composer search some_package # search for a package
composer suggests # suggests packages based on installed ones
composer require somepackage/somepackage:someversion # install a dependancy
composer update # update required packages
composer remove package/name # remove package
composer dump-autoload --optimize # optimize autoloader for production
Using private repositories with composer
{
"type": "package",
"package": {
"name": "advancedcustomfields/repeater-field",
"type": "wordpress-plugin",
"version": "3.1.7",
"dist": {
"url": "http://[YOUR_USERNAME]:[YOUR_PASSWORD]@codelight.eu/private/wordpress/plugins/acf-repeater.zip",
"type": "zip"
}
}
}
PHP Debug bar
// Output a message
$debugbar["messages"]->addMessage("hello world!");
// Measure execution time
$debugbar['time']->measure('My long operation', function() {
sleep(2);
});
Automatisation with Grunt
Automatic image optimisation
var mozjpeg = require('imagemin-mozjpeg');
grunt.initConfig({
imagemin: { // Task
static: { // Target
options: { // Target options
optimizationLevel: 3,
svgoPlugins: [{ removeViewBox: false }],
use: [mozjpeg()]
},
files: { // Dictionary of files
'dist/img.png': 'src/img.png', // 'destination': 'source'
'dist/img.jpg': 'src/img.jpg',
'dist/img.gif': 'src/img.gif'
}
},
dynamic: { // Another target
files: [{
expand: true, // Enable dynamic expansion
cwd: 'src/', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif}'], // Actual patterns to match
dest: 'dist/' // Destination path prefix
}]
}
}
});
grunt.loadNpmTasks('grunt-contrib-imagemin');
grunt.registerTask('default', ['imagemin']);
Automatisation with Grunt
Run mobile and desktop performance tests for your deployed site
pagespeed: {
options: {
nokey: true,
url: "https://developers.google.com"
},
prod: {
options: {
url: "https://developers.google.com/speed/docs/insights/v1/getting_started",
locale: "en_GB",
strategy: "desktop",
threshold: 80
}
},
paths: {
options: {
paths: ["/speed/docs/insights/v1/getting_started", "/speed/docs/about"],
locale: "en_GB",
strategy: "desktop",
threshold: 80
}
}
}
Automating site testing with Sellenium
Video: YouTube Link
Fun with Slack
Pushing commits to Slack channel
Fun with Slack
Notification when sites go down with UptimeRobot
Fun with Slack
Custom notifications with Slack API
$client = new MaknzSlackClient('http://your.slack.endpoint');
$settings = [
'username' => 'Bot',
'channel' => '#general',
'link_names' => true
];
$client = new MaknzSlackClient('http://your.slack.endpoint', $settings);
$client->send('Hello world!');
WP-Cli = WP command line interface
wp db export database.sql # Backup database
wp core update # update core of WP
wp plugin status # see installed plugins
wp plugin update plugin-name # update plugin
wp plugin uninstall plugin_name # uninstall plugin
wp theme update --all # update themes
wp post create --post_type=page
--post_status=publish --post_title='My test post'
--post_content='This is a test post' # create post
# change wp site url
wp option update home https://newdomain.com
wp option update siteurl https://newdomain.com
Custom WP theme updates
using GitHub Updater
/*
Theme Name: Test
Theme URI: http://thefragens.net/
Version: 0.1.0
Description: Child theme of TwentyTwelve.
Author: Andy Fragen
Template: twentytwelve
Template Version: 1.0.0
GitHub Theme URI: https://github.com/afragen/test-child
GitHub Branch: master
*/
Free developer hosting with Heroku
Video: YouTube Link
Free SSL with Let's encrypt
Speed with mod_pagespeed
CloudFlare magic
Website speed optimisation
→ AutoMinify
→ Cache header optimisation
→ JavaScript bundling
→ Browser optimisation
→ Aggressive GZIP
→ Asynchronous resource loading
→ Local storage caching
→ Email Address Obfuscation
Free CDN
Free security protection
IP Geolocation
if ($_SERVER["HTTP_CF_IPCOUNTRY"]=="FR"){
header("Location: /country/france",TRUE,307);
}
Page rules
Deployment automatisation with Docker
Setting up docker-compose.yml
version: '2'
services:
db:
image: mysql:5.7
volumes:
- "./.data/db:/var/lib/mysql"
restart: always
environment:
MYSQL_ROOT_PASSWORD: wordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
wordpress:
depends_on:
- db
image: wordpress:latest
links:
- db
ports:
- "8000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_PASSWORD: wordpress
Auto deploy your Wordpress container with Docker Cloud
Thank you!Contact me
Email: artem@lumospark.com
Twitter: twitter.com/artemd
LinkedIn: fi.linkedin.com/in/artemdaniliants

Más contenido relacionado

La actualidad más candente

Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
andymccurdy
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
Jason Grimes
 

La actualidad más candente (20)

Remote Control WordPress
Remote Control WordPressRemote Control WordPress
Remote Control WordPress
 
IOS 11 setup with appium latest
IOS 11 setup with appium  latestIOS 11 setup with appium  latest
IOS 11 setup with appium latest
 
Contributing to WordPress Core - Peter Wilson
Contributing to WordPress Core - Peter WilsonContributing to WordPress Core - Peter Wilson
Contributing to WordPress Core - Peter Wilson
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC Framework
 
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90mins
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done right
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabric
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp Hamilton
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Deploying WP Multisite to Heroku
Deploying WP Multisite to HerokuDeploying WP Multisite to Heroku
Deploying WP Multisite to Heroku
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentation
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansible
 
Quick flask an intro to flask
Quick flask   an intro to flaskQuick flask   an intro to flask
Quick flask an intro to flask
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)
 
Python Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CIPython Flask app deployed to OPenShift using Wercker CI
Python Flask app deployed to OPenShift using Wercker CI
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with Composer
 
Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015Ansible is the simplest way to automate. MoldCamp, 2015
Ansible is the simplest way to automate. MoldCamp, 2015
 
Ansible - Crash course
Ansible - Crash courseAnsible - Crash course
Ansible - Crash course
 

Similar a Web development automatisation for fun and profit (Artem Daniliants)

Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
Ortus Solutions, Corp
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
andymccurdy
 
Ops for everyone - John Britton
Ops for everyone - John BrittonOps for everyone - John Britton
Ops for everyone - John Britton
Devopsdays
 
John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...
John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...
John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...
DEVCON
 

Similar a Web development automatisation for fun and profit (Artem Daniliants) (20)

Introduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command lineIntroduction to WP-CLI: Manage WordPress from the command line
Introduction to WP-CLI: Manage WordPress from the command line
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwalten
 
Take Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLITake Command of WordPress With WP-CLI
Take Command of WordPress With WP-CLI
 
Manage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cliManage WordPress with Awesome using wp cli
Manage WordPress with Awesome using wp cli
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.cat
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作
 
Burn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websitesBurn down the silos! Helping dev and ops gel on high availability websites
Burn down the silos! Helping dev and ops gel on high availability websites
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Composer for busy developers - DPC13
Composer for busy developers - DPC13Composer for busy developers - DPC13
Composer for busy developers - DPC13
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabric
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment Tactics
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year later
 
Ops for everyone - John Britton
Ops for everyone - John BrittonOps for everyone - John Britton
Ops for everyone - John Britton
 
John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...
John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...
John Britton of GitHub on Ops for Everyone at DevCon Summit 2013 #MobileDevNB...
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 

Más de LumoSpark

ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
LumoSpark
 

Más de LumoSpark (9)

Getting started with HTTPS | LumoSpark webinar
Getting started with HTTPS | LumoSpark webinar Getting started with HTTPS | LumoSpark webinar
Getting started with HTTPS | LumoSpark webinar
 
How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...
How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...
How to turn any dynamic website into a static site | 24.01.2018 | Artem Danil...
 
Разработка статических сайтов | Artem Daniliants | LumoSpark
Разработка статических сайтов | Artem Daniliants | LumoSparkРазработка статических сайтов | Artem Daniliants | LumoSpark
Разработка статических сайтов | Artem Daniliants | LumoSpark
 
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
 
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьере
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьереArtem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьере
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьере
 
Going back to static html sites / Artem Daniliants / LumoSpark
Going back to static html sites / Artem Daniliants / LumoSparkGoing back to static html sites / Artem Daniliants / LumoSpark
Going back to static html sites / Artem Daniliants / LumoSpark
 
Marketing automatisation (Artem Daniliants)
Marketing automatisation (Artem Daniliants)Marketing automatisation (Artem Daniliants)
Marketing automatisation (Artem Daniliants)
 
Good front end - bad front-end (Vladimir Gutorov)
Good front end -  bad  front-end (Vladimir Gutorov)Good front end -  bad  front-end (Vladimir Gutorov)
Good front end - bad front-end (Vladimir Gutorov)
 
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
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
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
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
 
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
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 

Web development automatisation for fun and profit (Artem Daniliants)

  • 1. Web development automatisation for fun and profit Artem Daniliants / LumoSpark
  • 5. Save WP database with each commit Pre-commit hook #!/bin/sh mkdir -p _db_snapshot ./vendor/bin/wp db export _db_snapshot/database.sql git add _db_snapshot/database.sql
  • 6. Check PHP syntax errors before commit Pre-commit hook git diff --cached --name-only | while read FILE; do if [[ "$FILE" =~ ^.+(php|inc|module|install|test)$ ]]; then # Courtesy of swytsh from the comments below. if [[ -f $FILE ]]; then php -l "$FILE" 1> /dev/null if [ $? -ne 0 ]; then echo -e "e[1;31mtAborting commit due to files with syntax errors.e[0m" >&2 exit 1 fi fi fi done || exit $?
  • 7. Spellchecking commit messages Pre-commit hook ASPELL=$(which aspell) if [ $? -ne 0 ]; then echo "Aspell not installed - unable to check spelling" >&2 exit else WORDS=$($ASPELL list < "$1") fi if [ -n "$WORDS" ]; then echo -e "e[1;33mtPossible spelling errors found in commit message. Use git commit --amend to change the message. ntPossible mispelled words: " $WORDS ".e[0m" >&2 fi
  • 8. Dependancy management ftw (composer) Video: YouTube link
  • 9. Useful composer comands composer init # To create a new composer.json file in a project composer show # display all project packages composer search some_package # search for a package composer suggests # suggests packages based on installed ones composer require somepackage/somepackage:someversion # install a dependancy composer update # update required packages composer remove package/name # remove package composer dump-autoload --optimize # optimize autoloader for production
  • 10. Using private repositories with composer { "type": "package", "package": { "name": "advancedcustomfields/repeater-field", "type": "wordpress-plugin", "version": "3.1.7", "dist": { "url": "http://[YOUR_USERNAME]:[YOUR_PASSWORD]@codelight.eu/private/wordpress/plugins/acf-repeater.zip", "type": "zip" } } }
  • 11. PHP Debug bar // Output a message $debugbar["messages"]->addMessage("hello world!"); // Measure execution time $debugbar['time']->measure('My long operation', function() { sleep(2); });
  • 12. Automatisation with Grunt Automatic image optimisation var mozjpeg = require('imagemin-mozjpeg'); grunt.initConfig({ imagemin: { // Task static: { // Target options: { // Target options optimizationLevel: 3, svgoPlugins: [{ removeViewBox: false }], use: [mozjpeg()] }, files: { // Dictionary of files 'dist/img.png': 'src/img.png', // 'destination': 'source' 'dist/img.jpg': 'src/img.jpg', 'dist/img.gif': 'src/img.gif' } }, dynamic: { // Another target files: [{ expand: true, // Enable dynamic expansion cwd: 'src/', // Src matches are relative to this path src: ['**/*.{png,jpg,gif}'], // Actual patterns to match dest: 'dist/' // Destination path prefix }] } } }); grunt.loadNpmTasks('grunt-contrib-imagemin'); grunt.registerTask('default', ['imagemin']);
  • 13. Automatisation with Grunt Run mobile and desktop performance tests for your deployed site pagespeed: { options: { nokey: true, url: "https://developers.google.com" }, prod: { options: { url: "https://developers.google.com/speed/docs/insights/v1/getting_started", locale: "en_GB", strategy: "desktop", threshold: 80 } }, paths: { options: { paths: ["/speed/docs/insights/v1/getting_started", "/speed/docs/about"], locale: "en_GB", strategy: "desktop", threshold: 80 } } }
  • 14. Automating site testing with Sellenium Video: YouTube Link
  • 15. Fun with Slack Pushing commits to Slack channel
  • 16. Fun with Slack Notification when sites go down with UptimeRobot
  • 17. Fun with Slack Custom notifications with Slack API $client = new MaknzSlackClient('http://your.slack.endpoint'); $settings = [ 'username' => 'Bot', 'channel' => '#general', 'link_names' => true ]; $client = new MaknzSlackClient('http://your.slack.endpoint', $settings); $client->send('Hello world!');
  • 18. WP-Cli = WP command line interface wp db export database.sql # Backup database wp core update # update core of WP wp plugin status # see installed plugins wp plugin update plugin-name # update plugin wp plugin uninstall plugin_name # uninstall plugin wp theme update --all # update themes wp post create --post_type=page --post_status=publish --post_title='My test post' --post_content='This is a test post' # create post # change wp site url wp option update home https://newdomain.com wp option update siteurl https://newdomain.com
  • 19. Custom WP theme updates using GitHub Updater /* Theme Name: Test Theme URI: http://thefragens.net/ Version: 0.1.0 Description: Child theme of TwentyTwelve. Author: Andy Fragen Template: twentytwelve Template Version: 1.0.0 GitHub Theme URI: https://github.com/afragen/test-child GitHub Branch: master */
  • 20. Free developer hosting with Heroku Video: YouTube Link
  • 21. Free SSL with Let's encrypt
  • 24. Website speed optimisation → AutoMinify → Cache header optimisation → JavaScript bundling → Browser optimisation → Aggressive GZIP → Asynchronous resource loading → Local storage caching → Email Address Obfuscation
  • 29. Deployment automatisation with Docker Setting up docker-compose.yml version: '2' services: db: image: mysql:5.7 volumes: - "./.data/db:/var/lib/mysql" restart: always environment: MYSQL_ROOT_PASSWORD: wordpress MYSQL_DATABASE: wordpress MYSQL_USER: wordpress MYSQL_PASSWORD: wordpress wordpress: depends_on: - db image: wordpress:latest links: - db ports: - "8000:80" restart: always environment: WORDPRESS_DB_HOST: db:3306 WORDPRESS_DB_PASSWORD: wordpress
  • 30. Auto deploy your Wordpress container with Docker Cloud
  • 31. Thank you!Contact me Email: artem@lumospark.com Twitter: twitter.com/artemd LinkedIn: fi.linkedin.com/in/artemdaniliants