SlideShare a Scribd company logo
1 of 31
Download to read offline
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

More Related Content

What's hot

Remote Control WordPress
Remote Control WordPressRemote Control WordPress
Remote Control WordPressEdmund Turbin
 
Contributing to WordPress Core - Peter Wilson
Contributing to WordPress Core - Peter WilsonContributing to WordPress Core - Peter Wilson
Contributing to WordPress Core - Peter WilsonWordCamp Sydney
 
CodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkCodeIgniter PHP MVC Framework
CodeIgniter PHP MVC FrameworkBo-Yi Wu
 
Learn flask in 90mins
Learn flask in 90minsLearn flask in 90mins
Learn flask in 90minsLarry Cai
 
Ansible roles done right
Ansible roles done rightAnsible roles done right
Ansible roles done rightDan Vaida
 
Deployment with Fabric
Deployment with FabricDeployment with Fabric
Deployment with Fabricandymccurdy
 
Vagrant WordCamp Hamilton
Vagrant  WordCamp HamiltonVagrant  WordCamp Hamilton
Vagrant WordCamp HamiltonPaul Bearne
 
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-CLIDiana Thompson
 
Deploying WP Multisite to Heroku
Deploying WP Multisite to HerokuDeploying WP Multisite to Heroku
Deploying WP Multisite to HerokuJussi Kinnula
 
Ansible presentation
Ansible presentationAnsible presentation
Ansible presentationKumar Y
 
Automation and Ansible
Automation and AnsibleAutomation and Ansible
Automation and Ansiblejtyr
 
Quick flask an intro to flask
Quick flask   an intro to flaskQuick flask   an intro to flask
Quick flask an intro to flaskjuzten
 
Ansible for beginners ...?
Ansible for beginners ...?Ansible for beginners ...?
Ansible for beginners ...?shirou wakayama
 
Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Fabric workshop(1) - (MOSG)
Fabric workshop(1) - (MOSG)Soshi Nemoto
 
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 CIBruno Rocha
 
Dependency management with Composer
Dependency management with ComposerDependency management with Composer
Dependency management with ComposerJason Grimes
 
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, 2015Alex S
 

What's hot (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 to Web development automatisation for fun and profit (Artem Daniliants)

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 lineBehzod Saidov
 
WordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWordPress mit Composer und Git verwalten
WordPress mit Composer und Git verwaltenWalter Ebert
 
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-CLIDiana Thompson
 
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 cliGetSource
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
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 dockerOrtus Solutions, Corp
 
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 2018Ortus Solutions, Corp
 
Deploying Symfony | symfony.cat
Deploying Symfony | symfony.catDeploying Symfony | symfony.cat
Deploying Symfony | symfony.catPablo Godel
 
桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作桃園市教育局Docker技術入門與實作
桃園市教育局Docker技術入門與實作Philip Zheng
 
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 websitesLindsay Holmwood
 
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 2014biicode
 
Composer for busy developers - DPC13
Composer for busy developers - DPC13Composer for busy developers - DPC13
Composer for busy developers - DPC13Rafael Dohms
 
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-)Bastian Feder
 
Python Deployment with Fabric
Python Deployment with FabricPython Deployment with Fabric
Python Deployment with Fabricandymccurdy
 
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)Ben Hall
 
Deployment Tactics
Deployment TacticsDeployment Tactics
Deployment TacticsIan Barber
 
Infrastructure = code - 1 year later
Infrastructure = code - 1 year laterInfrastructure = code - 1 year later
Infrastructure = code - 1 year laterChristian Ortner
 
Ops for everyone - John Britton
Ops for everyone - John BrittonOps for everyone - John Britton
Ops for everyone - John BrittonDevopsdays
 
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
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on DockerDaniel Ku
 

Similar to 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
 

More from LumoSpark

Getting started with HTTPS | LumoSpark webinar
Getting started with HTTPS | LumoSpark webinar Getting started with HTTPS | LumoSpark webinar
Getting started with HTTPS | LumoSpark webinar LumoSpark
 
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...LumoSpark
 
Разработка статических сайтов | Artem Daniliants | LumoSpark
Разработка статических сайтов | Artem Daniliants | LumoSparkРазработка статических сайтов | Artem Daniliants | LumoSpark
Разработка статических сайтов | Artem Daniliants | LumoSparkLumoSpark
 
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"
ValoStartup Meetup #9 "Как шаг за шагом написать чат-бот для Telegram на Python"LumoSpark
 
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьере
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьереArtem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьере
Artem Daniliants / Банкротство - это лучшее что произошло в моей бизнес-карьереLumoSpark
 
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 / LumoSparkLumoSpark
 
Marketing automatisation (Artem Daniliants)
Marketing automatisation (Artem Daniliants)Marketing automatisation (Artem Daniliants)
Marketing automatisation (Artem Daniliants)LumoSpark
 
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)LumoSpark
 
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)
Принципы эффективного веб-дизайна 2.0 (Artur Galustyan)LumoSpark
 

More from 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)
 

Recently uploaded

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 

Recently uploaded (20)

TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 

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