This document discusses WordPress development environments. It recommends setting up separate local, staging, and live environments. The local environment is for development on one's own machine. The staging environment resembles the live site for testing purposes. The live environment is the actual public site. It provides tips for setting up servers, configuring domains and files, syncing databases, and using version control across the different environments.
Lean Drupal Repositories with Composer and DrushPantheon
Composer is the industry-standard PHP dependency manager that is now in use in Drupal 8 core. This session will show the current best practices for using Composer, drupal-composer, drupal-scaffold, Drush, Drupal Console and Drush site-local aliases to streamline your Drupal 7 and Drupal 8 site repositories for optimal use on teams.
Lean Drupal Repositories with Composer and DrushPantheon
Composer is the industry-standard PHP dependency manager that is now in use in Drupal 8 core. This session will show the current best practices for using Composer, drupal-composer, drupal-scaffold, Drush, Drupal Console and Drush site-local aliases to streamline your Drupal 7 and Drupal 8 site repositories for optimal use on teams.
Drupal VM for Drupal 8 Dev - MidCamp 2017Jeff Geerling
These slides were used in my presentation "Developing for Drupal 8 with Drupal VM", given at MidCamp in Chicago, IL on 2017-04-01.
Learn how to build a modern Drupal 8 website using Composer and Drupal VM for local and prod!
An on-going presentation for the Docker workshop on how to integrate docker into Vagrant as a provider. In order to remove the requirement of having a VM, and speedup development environments. It also features Puppet as the configuration management system.
The code can be found in: https://github.com/npoggi/vagrant-docker
Admin Tips In 60 Minutes
In this high speed session I take you through the best admin tips for Domino, Notes, Sametime, Traveler and more. From notes.ini values, to server configuration settings and valuable customisations.
Some tips will be new to v10 and some have been around but rarely used for years.
Whatever your experience there will be something new for you to take away and enjoy.
Presented at Engage.ug in Brussels May 2019
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017Jeff Geerling
Drupal VM is a VM for Drupal development, built with Vagrant and Ansible, or Docker. This presentation was given at Drupal Camp St. Louis 2017 by Jeff Geerling, Senior Technical Architect at Acquia.
CIRCUIT 2015 - AEM Infrastructure Automation with Chef CookbooksICF CIRCUIT
Drew Glass - Hero Digital
Push button deployments can automate AEM infrastructure to reduce costs and defects. Chef is a platform that enables this by transforming infrastructure into code using DevOps practices. AEM Author, Publish and Dispatcher instances can be fully configured and deployed as code with Chef. In this talk we will discuss how the open source AEM Chef Cookbook can be used to automate the deployment of AEM instances with Chef features like recipes, attributes, providers and resources. Out of the box, the AEM Chef Cookbook supports:
- Unattended installation of AEM Author, Publish, and Dispatcher nodes.
- Automatic search for and configuration of AEM cluster members using Chef searches.
- Configuration for replication agents using the replicator provider.
- Configurations for Dispatcher farms with the farm provider.
- Deploying and removing AEM packages with the package provider.
We will also discuss how AEM can be automated to supported different SSO and deployment scenarios like cold standby. Finally, we will cover how to extend the Cookbook to support your project specific needs.
(Click 2nd slide for video) Deploy PHP apps faster in 2017. This talk focuses on how PHP developers can use simple Ansible scripts to rapidly configure new dev and production servers from scratch, and deploy their apps. No more "snowflake servers"!
This is a general introduction to DevOps essentials and Ansible, with a few extras for PHP developers, including some best practice tips and overview of two major Ansible-based PHP projects, Drupal-VM and Trellis (modern WordPress setup).
Ansible is a Configuration Management System that is very simple to use, because of its straightforward and robust model for managing automation and it’s low barrier to entry for ease of use in both development and production.
During OpenStack development, Ansible can be used in conjunction with Vagrant and Devstack to manage complex, multi-node development environments with relative ease.
In this presentation, Juergen Brendel and David Lapsley review Ansible and provide some sample playbooks to get developers up and running quickly. They also describes how to use Ansible, Vagrant, Devstack, and OpenStack to accelerate OpenStack development cycles.
DevOps for Humans - Ansible for Drupal Deployment Victory!Jeff Geerling
Everyone knows it's a Good Idea™ to use a configuration management system (e.g. Puppet, Chef) to manage your Drupal infrastructure. But many people (myself included) have run into a wall of #wtfmoments when trying to learn the vagaries of traditional CM systems and their vendor-specific syntaxes.
In 2012, Ansible was released, enabling normal human beings to manage their servers with an easy, but powerful, CM system that uses YAML (just like Drupal 8!) to define configuration and Jinja2 (very much like Twig!) for templates. Not only that, but Ansible is also an incredibly simple and very flexible Drupal deployment and continuous delivery tool.
Learn how you can use Ansible to manage your infrastructure—including local development environments—and stop letting servers and deployments get in the way of development.
Adobe AEM Maintenance - Customer Care Office HoursAndrew Khoury
This presentation covers how to maintain Adobe Experience Manager 6.x (AEM / CQ / Communiqué) environments.
See the presentation video here:
https://helpx.adobe.com/experience-manager/kt/eseminars/ccoo-aem-Aug-recording.html
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef
This talk is an exploration of how to build Chef Server 12 clusters with Chef Provisioning, including premium features like Chef Reporting and Chef Analytics. I will cover several new capabilities and tools in the Chef ecosystem that makes it easier than ever before to build and manage scalable Chef Server clusters.
https://youtu.be/HUQA1Ikm5Iw
In recent years there has been a tremendous amount of progress and innovation around tools and applications available to web developers that improve the quality, efficiency and speed of our applications, and it is hard to keep up with all of it.
Drupal VM for Drupal 8 Dev - MidCamp 2017Jeff Geerling
These slides were used in my presentation "Developing for Drupal 8 with Drupal VM", given at MidCamp in Chicago, IL on 2017-04-01.
Learn how to build a modern Drupal 8 website using Composer and Drupal VM for local and prod!
An on-going presentation for the Docker workshop on how to integrate docker into Vagrant as a provider. In order to remove the requirement of having a VM, and speedup development environments. It also features Puppet as the configuration management system.
The code can be found in: https://github.com/npoggi/vagrant-docker
Admin Tips In 60 Minutes
In this high speed session I take you through the best admin tips for Domino, Notes, Sametime, Traveler and more. From notes.ini values, to server configuration settings and valuable customisations.
Some tips will be new to v10 and some have been around but rarely used for years.
Whatever your experience there will be something new for you to take away and enjoy.
Presented at Engage.ug in Brussels May 2019
Drupal VM for Drupal 8 Dev - Drupal Camp STL 2017Jeff Geerling
Drupal VM is a VM for Drupal development, built with Vagrant and Ansible, or Docker. This presentation was given at Drupal Camp St. Louis 2017 by Jeff Geerling, Senior Technical Architect at Acquia.
CIRCUIT 2015 - AEM Infrastructure Automation with Chef CookbooksICF CIRCUIT
Drew Glass - Hero Digital
Push button deployments can automate AEM infrastructure to reduce costs and defects. Chef is a platform that enables this by transforming infrastructure into code using DevOps practices. AEM Author, Publish and Dispatcher instances can be fully configured and deployed as code with Chef. In this talk we will discuss how the open source AEM Chef Cookbook can be used to automate the deployment of AEM instances with Chef features like recipes, attributes, providers and resources. Out of the box, the AEM Chef Cookbook supports:
- Unattended installation of AEM Author, Publish, and Dispatcher nodes.
- Automatic search for and configuration of AEM cluster members using Chef searches.
- Configuration for replication agents using the replicator provider.
- Configurations for Dispatcher farms with the farm provider.
- Deploying and removing AEM packages with the package provider.
We will also discuss how AEM can be automated to supported different SSO and deployment scenarios like cold standby. Finally, we will cover how to extend the Cookbook to support your project specific needs.
(Click 2nd slide for video) Deploy PHP apps faster in 2017. This talk focuses on how PHP developers can use simple Ansible scripts to rapidly configure new dev and production servers from scratch, and deploy their apps. No more "snowflake servers"!
This is a general introduction to DevOps essentials and Ansible, with a few extras for PHP developers, including some best practice tips and overview of two major Ansible-based PHP projects, Drupal-VM and Trellis (modern WordPress setup).
Ansible is a Configuration Management System that is very simple to use, because of its straightforward and robust model for managing automation and it’s low barrier to entry for ease of use in both development and production.
During OpenStack development, Ansible can be used in conjunction with Vagrant and Devstack to manage complex, multi-node development environments with relative ease.
In this presentation, Juergen Brendel and David Lapsley review Ansible and provide some sample playbooks to get developers up and running quickly. They also describes how to use Ansible, Vagrant, Devstack, and OpenStack to accelerate OpenStack development cycles.
DevOps for Humans - Ansible for Drupal Deployment Victory!Jeff Geerling
Everyone knows it's a Good Idea™ to use a configuration management system (e.g. Puppet, Chef) to manage your Drupal infrastructure. But many people (myself included) have run into a wall of #wtfmoments when trying to learn the vagaries of traditional CM systems and their vendor-specific syntaxes.
In 2012, Ansible was released, enabling normal human beings to manage their servers with an easy, but powerful, CM system that uses YAML (just like Drupal 8!) to define configuration and Jinja2 (very much like Twig!) for templates. Not only that, but Ansible is also an incredibly simple and very flexible Drupal deployment and continuous delivery tool.
Learn how you can use Ansible to manage your infrastructure—including local development environments—and stop letting servers and deployments get in the way of development.
Adobe AEM Maintenance - Customer Care Office HoursAndrew Khoury
This presentation covers how to maintain Adobe Experience Manager 6.x (AEM / CQ / Communiqué) environments.
See the presentation video here:
https://helpx.adobe.com/experience-manager/kt/eseminars/ccoo-aem-Aug-recording.html
Chef Provisioning a Chef Server Cluster - ChefConf 2015Chef
This talk is an exploration of how to build Chef Server 12 clusters with Chef Provisioning, including premium features like Chef Reporting and Chef Analytics. I will cover several new capabilities and tools in the Chef ecosystem that makes it easier than ever before to build and manage scalable Chef Server clusters.
https://youtu.be/HUQA1Ikm5Iw
In recent years there has been a tremendous amount of progress and innovation around tools and applications available to web developers that improve the quality, efficiency and speed of our applications, and it is hard to keep up with all of it.
Doing PHP, Perl, and Python development made easy with a great tool called MAMP. This session will demonstrate how to install and configure MAMP to speed up web development using the LAMP stack on a Mac and Windows. Additionally, the session will demonstrate how to use several different IDEs with MAMP to perform debugging and testing.
These are the slides from WpCampus 2016 presentation Varying WordPress Development Environment . This is a presentation and demo of what VVV is, how to install and how to use it.
Varying WordPress Development Environment WordCamp Columbus 2016David Brattoli
These are the slides of David Brattoli's WordCamp Columbus 2016 presentation Varying WordPress Development Environment. This presentation covers setting a local web development for WordPress using Varying-Vagrant-Vagrants.
A Docker-based Development Environment Even I Can UnderstandJeremy Gimbel
Jeremy Gimbel of Vector Media Group at ExpressionEngine Conference 2018
For years, I used MAMP and later Vagrant to run my local development environment. With MAMP I constantly was cluttering my computer with additional dependencies and living in fear of what would happen when my code went live on staging and production servers wildly different than my local setup. Vagrant was a slight improvement, but the virtual machines were monolithic and hard to build. Like many, my first few attempts at Docker failed miserably and left me with more questions than I had going in and very few answers. Through much research and the guiding voices of my colleagues, I’ve finally managed to wrangle the beast that is Docker into a development environment that is more flexible than ever before and yet easy to use. In this session I will walk attendees through the basics of Docker, the components of my Docker development environment and help guide them around some of the pitfalls I came across while I set it up.
5/13/13 presentation to Austin DevOps Meetup Group, describing our system for deploying 15 websites and supporting services in multiple languages to bare redhat 6 VMs. All system-wide software is installed using RPMs, and all application software is installed using GIT or Tarball.
Varying WordPress Development Environment WordCamp Cincinnati 2016David Brattoli
The presentation slides of my presentation Varying WordPress Local Development Environment that I gave at WordCamp Cincinnati 2016. This presentation is the step by step tutorial of how to build a local WordPress development environment using Vagrant, VVV and Virtualbox.
Introduction to Infrastructure as Code & Automation / Introduction to ChefNathen Harvey
Your customers expect you to continuously deliver delightful experiences. This means that you’ll need to continuously deliver application and infrastructure updates. Hand-crafted servers lovingly built and maintained by a system administrator are a thing of the past. Golden images are fine for initial provisioning but will quickly fail as your configuration requirements change over time.
It’s time for you to fully automate the provisioning and management of your infrastructure components. Welcome to the world of infrastructure as code! In this new world, you’ll be able to programmatically provision and configure the components of your infrastructure.
Disposable infrastructure whose provisioning, configuration, and on-going maintenance is fully automated allow you to change the way you build and deliver applications. Move your applications and infrastructure towards continuous delivery.
In this talk, we’ll explore the ideas behind “infrastructure as code” and, specifically, look at how Chef allows you to fully automate your infrastructure. If you’re brave enough, we’ll even let you get your hands on some Chef and experience the delight of using Chef to build and deploy some infrastructure components.
Imagine this: You wake up one day in a world without technology – all the computers on the planet just disappeared. First of all, you’d wake up late because your smartphone alarm no longer exists.
3. Who Am I?
• Father and husband.
• Ohad Raz (aka Bainternet).
• WordPress Consultant Developer and Designer
• Plugin developer 18 published plugins with over 132,000 downloads.
• Core Contributor as of 3.5
• Moderator and Editor @ WordPress Answers
And I also fight crime at night
4. What's this about?
• Development Environments.
• Development Environments Workflow.
• Tips and Tricks:
• Server.
• Domain.
• Files.
• Database.
• Some Version Control.
6. Development Environment
Development usually refers to your
local machine where you have your
web server, database, IDE, and
related tools installed.
Its where you actually develop your project.
7. Staging Environment
The Staging Environment is a server the
resembles where the project is actually
going to live and where you upload your
work for testing.
Its mostly used for testing and showing
off your work.
8. Live Environment
The live environment is where the
project is live on the web with real
content and where users actually
interact with your work
It’s the actual site.
9. But why?
All Environments:
• Mistakes and accidents happen.
• You want to be taken seriously
Development:
Staging:
• Work Faster.
• Client approval.
• Freedom to experiment.
• Test on an environment
• Test multiple versions of PHP.
similar to production.
• Teams can work
together (with version
control).
Live: Because Every Site need a Home.
10. Development Environment
Server
WAMP MAMP XAMPP
Windows Mac X any platform
Apache Apache Apache
MySQL MySQL MySQL
PHP PHP PHP
Perl
11. Development Environment
Server
Install WordPress Locally :
1. Download WordPress.
2. Extract the downloaded zip file.
3. Create a database.
4. Configure wp-config.php
5. Run WordPress Setup
Or do it all at once with WordPress Auto Installer
This script will download the latest copy of WordPress,
extract the files to the directory you named, create
a new database and take you straight to where all you
have to do is set you sites name, your username and pass
and you
have a new WordPress Installation ready to roll.
12. Domain Issue
Live: domain.com
Dev: domain.dev
This way you can use a simple Search and Replace on files
and database dump.
Or use real domain name Using the hosts file.
Live & Dev: domain.com
# Point domain.com to your computer
127.0.0.1 domain.com
Windows: C:WINDOWSsystem32driversetchosts
Mac/Linux: /etc/hosts
13. Domain Issue
Create A Virtual Host
<VirtualHost 127.0.0.1>
DocumentRoot "C:/wamp/www/WordCamp/local"
ServerName domain.dev
<Directory "C:/wamp/www/WordCamp/local">
Options FollowSymLinks Indexes MultiViews
AllowOverride All
Order deny,allow
Allow from all
Allow from 127.0.0.1
</Directory>
</VirtualHost>
[wamp] c:wampbinapacheApacheVERSIONconfhttpd.conf
[mamp] /private/etc/apache2/httpd.conf
[xampp] ..apacheconfextrahttpd-vhosts.conf
14. Files Sync
FTP sync Only copy changed files based on size or date
FileZilla - http://filezilla-project.org/
Command line Rsync - http://rsync.samba.org/
Wget - http://www.gnu.org/software/wget/
Capistrano* - http://capistranorb.com/
Version control Git - http://git-scm.com/
SVN - http://subversion.apache.org/
HG - http://mercurial.selenic.com/
15. Files Sync
wp-config.php
One level above the WordPress Root Directory in all environments
and ignored in version control.
Or a separate file per each environment:
//dev-config.php
/* Development Environment */
define('WP_ENV', 'local');
define('WP_DEBUG', true);
define('DB_NAME', 'local_db_name');
define('DB_USER', 'local_db_user');
define('DB_PASSWORD', 'local_db_password');
define('DB_HOST', 'local_db_host');
//stage-config.php
/* Staging Environment */
define('WP_ENV', 'stage');
define('WP_DEBUG', true);
define('DB_NAME', 'stage _db_name');
define('DB_USER', 'stage _db_user');
define('DB_PASSWORD', 'stage _db_password');
define('DB_HOST', 'stage _db_host');
16. Files Sync
wp-config.php
//First we check for development env
if ( file_exists( dirname( __FILE__ ) . '/dev-config.php' ) ) {
include( dirname( __FILE__ ) . '/dev-config.php' );
} elseif ( file_exists( dirname( __FILE__ ) . '/stage-config.php' ) ) {
//then we check for staging env
include( dirname( __FILE__ ) . '/stage-config.php' );
}else {
//if we got here then we are at production env.
define('WP_ENV', 'production');
define('WP_DEBUG', false);
define( 'DB_NAME', 'production_db' );
define( 'DB_USER', 'production_user' );
define( 'DB_PASSWORD', 'production_password' );
define( 'DB_HOST', 'production_db_host' ); }
}
…
17. Database Sync
Native Export Import
It's best to import into Dev then move the database over to
production because when you import it will download all the
new media files from production.
18. Database Sync
Database Management tools:
Export & import the database using PHPMyAdmin or alternative.
Use ”add drop tables” This will delete the old tables when you import.
Use the ”INSERT IGNORE INTO” MySQL command to add the new tables from dev.
or the ”REPLACE” command to overwrite duplicate rows in the same table.
19. Database Sync
Use A plugin:
WP Migrate DB
Which takes care of
serialized data
Ex:
s:9:“domin.dev"
Becomes:
s:11:“domain.info"
20. Database Sync
Use Command line via SSH:
# Export a database to DBdump.sql
mysqldump --add-drop-table -u USERNAME –p DATABASE_NAME> DBdump.sql
# Import a database into MySQL
mysql DATABASE_NAME -u USERNAME -p < DBdump.sql
Remote to local and visa-versa:
# Export remote database directly to local database
ssh user@site.com "mysqldump --add-drop-table -u USERNAME -pPassword DATABASE_NAME" | mysql DATABASE_NAME
# Export local database directly to remote database
mysqldump --add-drop-table DATABASE_NAME | ssh user@site.com "mysql -u USERNAME -pPassword DATABASE_NAME "
21. All Around Solutions
Server / Stack:
Bitnami - simple stack with WordPress bundled in.
Instant WordPress - The easiest and quickest way to install WordPress!
DesktopServer - Another easy way with virtual servers and deploy capability.
Plugins:
BackupBuddy - Back up, restore and move WordPress.
Duplicator – “ability to migrate a site from one location to another location in 3
steps.”
22. Version Control
Version Control - track your files over time.
But Why?
• Easily un-break your code.
Feel free to experiment.
No more of this:
Logo.png
Logo_final.png
Logo_last.png
Logo_last2.png
• Never. Lose. Anything.
If You Ever
Lost a file
Written over a file
Made a change that broke your code
23. Version Control
Some More reasons
• One canonical version.
There is a clear place to go for the primary copy of the code.
• Collaboration
Track changes For teams
See what others have done
Ability to reject / avoid bad changes
Simultaneous editing
Merge
• Deployment!!!
24. Version Control
Methods:
• Version Control the entire WordPress environment
• Version Control only the WP-Content Directory
• Version Control only a specific Theme or Plugin
25. Version Control
Simple git commands:
• git init - initializes a git repository
git init - initializes a git repository in current folder
git init foldername - initializes a git repository in foldername
• git add – tell git to keep track.
git add . - add everything.
git add somefile.php – add somefile.php
• git commit - stage files / stores a version of the current code
git commit -m "commit message“
• git status - allows you to see the current state of your code.
• git pull – pull updates
• git push – push updates
26. Version Control
On Local Host:
• Download and Install WordPress.
• Create a new repository.
• Tell git to ignore wp-config.php
• Add and commit changes.
git init .
touch .gitignore | echo wp-config.php >>.gitignore
git add .
git commit –m”initial WordPress Commit”
27. Version Control
Repository Hosts
GITHUB - web-based hosting service for software development projects
that use the Git revision control system.
BitBucket - web-based hosting service for projects that use either
the Mercurial or Git revision control systems
30. Version Control
On Local Host:
• Add Bitbucket as remote repository
• Push to Bitbucket.
git remote add origin https://bitbucket.org/bainternet/some-wordpress-project.git
git push
31. Version Control
On Stage/Production:
• Clone Bitbucket Repository.
• Run WordPress install once.
git clone https://bitbucket.org/bainternet/some-wordpress-project.git
32. Version Control
Workflow:
On local On Server
git pull git pull
git checkout -b dev
//make some changes
git commit -m "made dev changes"
git checkout master
git merge dev
git commit -m “merged dev changes"
git push
33. Version Control
On local On Server
git pull
git checkout -b feature-x git pull
//make some changes
git commit -m “started feature-x "
git checkout master
git checkout -b bug-y
//fix bug y
git commit -m “Fixed bug y"
git checkout master
git merge bug-y
git commit -m “merged bug y fix"
git push
git checkout feature-x
//finish working on feature x
git commit -m “finished feature-x "
git checkout master
git merge dev
git commit -m “merged dev changes"
git push