SlideShare une entreprise Scribd logo
1  sur  84
Télécharger pour lire hors ligne
ENVIRONMENTS &
VERSION CONTROL
   The Why & How


                   ERIKREAGAN • EECI
WHO IS THIS GUY?
        EE Reactor team member




2                                ERIKREAGAN • EECI
WHO IS THIS GUY?
        Partner & Lead Developer




3                                  ERIKREAGAN • EECI
Survey Submissions




4
    78                   ERIKREAGAN • EECI
SURVEY SUBMISSIONS
                              Web Development Experience




    35   6-10 years




    24   3-5 years




    19   Over 10 years




5                                    ERIKREAGAN • EECI
SURVEY SUBMISSIONS
                           ExpressionEngine Experience



    40    3-4 years


     19   0-2 years


     12   5-7 years


      4   pMachine


      3   None



6                                ERIKREAGAN • EECI
SURVEY SUBMISSIONS
                                    Weekly Responsibilities


    66    HTML/CSS/JS markup


    64    EE site planning


    38    PHP/MySQL development


     21   Add-on development


    20    Content management


     19   Team leader

7                                    ERIKREAGAN • EECI
Caught my Monty Python reference




8
    73%                         ERIKREAGAN • EECI
VERSION CONTROL




9              ERIKREAGAN • EECI
SYNONYMS
     • Version Control
     • Revision Control
     • Source Control



10                        ERIKREAGAN • EECI
COMMON SYSTEMS
     • Git
     • Subversion
     • Mercurial



11                  ERIKREAGAN • EECI
SURVEY STATS



12             ERIKREAGAN • EECI
Devs not currently using a VCS regularly




13
     34%                               ERIKREAGAN • EECI
Devs only using a desktop GUI for VCS




14
     21%                             ERIKREAGAN • EECI
Devs only using command line for VCS




15
     21%                            ERIKREAGAN • EECI
Devs using both CLI and a GUI for VCS




16
     24%                            ERIKREAGAN • EECI
Have used CVS




17
     6%              ERIKREAGAN • EECI
Have used Mercurial




18
     13%                   ERIKREAGAN • EECI
Have used Subversion




19
     54%                ERIKREAGAN • EECI
Have used Git




20
     77%             ERIKREAGAN • EECI
WE USE GIT

     Linux    jQuery   Rails   Android



21                             ERIKREAGAN • EECI
WE USE GIT
              And so do the cool kids


     Linux     jQuery       Rails       Android



21                                      ERIKREAGAN • EECI
WE USE GIT
              And so do the cool kids




     Linux     jQuery       Rails       Android



21                                      ERIKREAGAN • EECI
OLD WAY                                 Single Developer


     1. Duplicate index.html

     2. Test changes

     3. (Maybe save a backup of the previous version)

     4. Save over old version losing previous state



22                                             ERIKREAGAN • EECI
NEW WAY                                      Single Developer


     1. Change and save the file contents
         (Retain history of file for future use)




23                                                  ERIKREAGAN • EECI
OLD WAY                              Development Team


     1. Bob changes part of index.html

     2. Suzie changes a different part of index.html

     3. Bob and Suzie carefully merge changes together

     4. Overwrite old version of index.html



24                                            ERIKREAGAN • EECI
NEW WAY                                      Development Team


     1. Change and save the file contents
         (Retain history of file for future use)




25                                                   ERIKREAGAN • EECI
26   ERIKREAGAN • EECI
26   ERIKREAGAN • EECI
26   ERIKREAGAN • EECI
KEY CONCEPTS
     • Track certain files
     • Ignore certain files
     • Commits (History)
     • Branches
     • Remote branches

27                           ERIKREAGAN • EECI
“WHAT DO I TRACK?”
             VS
     “WHAT DO I IGNORE?”


28                 ERIKREAGAN • EECI
IGNORED FILES
     • Operating System files
     • Caches
     • .htaccess (possibly)
     • Custom uploads from EE
     • Dynamic images (captchas etc)

29                                     ERIKREAGAN • EECI
.gitignore


     # Lame OS files
     Thumbs.db
     .DS_Store

     # EE System cache
     /system/expressionengine/cache/*

     # Local dev database file
     /config/config.local.php

     # Custom Upload Directories
     /public_html/uploads/*

     # Captchas
     /public_html/images/captchas

     # Asset minification
     /public_html/min



30                                      ERIKREAGAN • EECI
TRACKED FILES
     • EE System directory
     • Add-ons
     • Template flat files
     • Images, CSS, Javascript & other assets


31                                              ERIKREAGAN • EECI
COMMITS
     Create your history




32                         ERIKREAGAN • EECI
COMMIT TIPS
     • Commit o en (common Git practice)
     • Write detailed commit messages
     • Review commit log when returning to a project a er
      a break of any sort

     • Review commits of development team members

33                                           ERIKREAGAN • EECI
BAD COMMIT MESSAGE
     Updated config file.




34                          ERIKREAGAN • EECI
GOOD COMMIT MESSAGE
     Updated config file with new Minimee cache path
     directory

     This allows our cache path to be dynamicly absolute
     based on the environment out code is in.

     $config[‘minimee_cache_path’] = $base_path . ‘/min’;




35                                            ERIKREAGAN • EECI
BRANCHING
      Keeping things organized




36                               ERIKREAGAN • EECI
BRANCHING
      WORKFLOW
         Do what works best for you




     Just make sure you do it for a reason

37                                    ERIKREAGAN • EECI
REMOTE BRANCHES
     • Destination for your repository / branch
     • “Origin” of your repository / branch
     • Server environment for your site
     • Other team member’s repository / branch



38                                                ERIKREAGAN • EECI
TOPICAL BRANCHING
     • master
     • dev
     • feature/x
     • upgrade/y
     • bugfix/z

39                 ERIKREAGAN • EECI
“It's like not wearing a seatbelt in
       your car because you haven't had
       an accident yet.

       Don't be silly, version your work.”


     Iain Urquhart / @iain




40                                       ERIKREAGAN • EECI
GIT RESOURCES
     • Book: Pragmatic Version Control Using Git
     • peepcode.com/products/git
     • whygitisbetterthanx.com
     • github.com
     • More available with the presentation download

41                                           ERIKREAGAN • EECI
ENVIRONMENTS




42             ERIKREAGAN • EECI
AN ENVIRONMENT IS
      any server running an instance of your site




43                                        ERIKREAGAN • EECI
COMMON
     ENVIRONMENTS
     • Production - the public-facing “live” site
     • Staging - typically used for a final test
     • Development - shared team development
     • Local - each developer’s local instance

44                                                  ERIKREAGAN • EECI
SURVEY STATS



45             ERIKREAGAN • EECI
Devs currently using a Production Environment




100%
46                                       ERIKREAGAN • EECI
Devs currently using a Staging Environment




47
     59%                               ERIKREAGAN • EECI
Devs currently using a Shared Dev Environment




48
     32%                                 ERIKREAGAN • EECI
Devs currently using a Local Dev Environment




49
     77%                                ERIKREAGAN • EECI
Devs who keep using environments post-launch




50
     29%                                ERIKREAGAN • EECI
WHY DO YOU USE
     ENVIRONMENTS?


51              ERIKREAGAN • EECI
“Local development is incredibly
     fast and you don't have to worry
     about setting up crazy conditionals
     and memeber preferences to hide
     what you are working on on the live
     site.”




52                                    ERIKREAGAN • EECI
“Multiple environments allow us to
     build locally without affecting others
     and preview new features to clients -
     without losing the ability to quickly
     apply updates to the current live
     site.”




53                                     ERIKREAGAN • EECI
“Automated deployments and
     multiple environments are essential
     to any agile-oriented developer.
     They save time, reduce errors and
     streamline site maintenance.”




54                                   ERIKREAGAN • EECI
GETTING SET UP
     What is potentially unique to each environment?




55                                        ERIKREAGAN • EECI
GETTING SET UP
                                          What’s Unique?

     • Server paths
     • URL root
     • EE upload paths
     • Debug mode intentions
     • URI support (PATH_INFO)
     • Cache settings


56                                   ERIKREAGAN • EECI
ROBUST CONFIG FILE
        Saves time and adds flexibility




57                                   ERIKREAGAN • EECI
GETTING SET UP
                                    What can be changed?

     ✓ Server paths
     ✓ URL root
     - EE upload paths
     ✓ Debug mode intentions
     ✓ URI support (PATH_INFO)
     ✓Cache settings


58                                   ERIKREAGAN • EECI
GETTING SET UP
                              Directory and file structure



     /config/

        config.env.php

        config.master.php

        config.{ENV}.php

     /public_html/

     /system/

     /tpl/




59                                ERIKREAGAN • EECI
GETTING SET UP
                                                      config.env.php sample

     if ( ! defined('ENV'))
     {
        switch ($_SERVER['HTTP_HOST']) {
           case 'focuslabllc.com' :
              define('ENV', 'prod');
              define('ENV_FULL', 'Production');
              define('ENV_DEBUG', FALSE);
           break;

             case 'ohsnap.focuslabllc.com' :
                define('ENV', 'stage');
                define('ENV_FULL', 'Staging');
                define('ENV_DEBUG', FALSE);
             break;

             default :
                define('ENV', 'local');
                define('ENV_FULL', 'Local');
                define('ENV_DEBUG', TRUE);
             break;
         }
     }



60                                                    ERIKREAGAN • EECI
GETTING SET UP
                                                                     config.dev.php sample

     <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

     /**
      * Development config overrides & db credentials
      *
      * Our database credentials and any environment-specific overrides
      *
      * @package    Focus Lab Master Config
      * @version    1.1
      * @author     Erik Reagan <erik@focuslabllc.com>
      */

     $env_db['hostname']   =   'localhost';
     $env_db['username']   =   '';
     $env_db['password']   =   '';
     $env_db['database']   =   '';

     $config['webmaster_email'] = 'dev@focuslabllc.com';


     /* End of file config.dev.php */
     /* Location: ./config/config.dev.php */



61                                                                  ERIKREAGAN • EECI
GETTING SET UP
                                                        config.master.php sample




    /**
     * Template settings
     *
     * Working locally we want to reference our template files.
     * In staging and production we do not use flat files
 * (for ever-so-slightly better performance)
 * This approach requires that we synchronize templates after
 * each deployment of template changes
 */
$env_config['save_tmpl_files']            = (ENV == 'prod') ? 'n' : 'y';
$env_config['tmpl_file_basepath']         = $base_path . '/../tpl/';
$env_config['hidden_template_indicator'] = '_';




62                                                         ERIKREAGAN • EECI
GETTING SET UP
                                                       config.master.php sample


/**
 * Debugging settings
 *
 * These settings are helpful to have in one place
 * for debugging purposes
 */
$env_config['is_system_on']         = 'y';
$env_config['allow_extensions']     = 'y';
$env_config['email_debug']          = (ENV_DEBUG) ? 'y' : 'n' ;
// Show template debugging if we're not in production
$env_config['template_debugging']   = (ENV_DEBUG) ? 'y' : 'n' ;
/**
 * Set debug to '2' if we're in dev mode, otherwise just '1'
 *
 * 0: no PHP/SQL errors shown
 * 1: Errors shown to Super Admins
 * 2: Errors shown to everyone
 */
$env_config['debug']                = (ENV_DEBUG) ? '2' : '1' ;


63                                                        ERIKREAGAN • EECI
GETTING SET UP
                                                     config.master.php sample




     /**
      * 3rd Party Add-on config items as needed
      */
     $env_config['minimee_cache_path'] = $base_path . '/min';
     $env_config['minimee_cache_url']   = $base_url . '/min';
     $env_config['minimee_remote_mode'] = 'auto';
     $env_config['minimee_debug']       = 'n';
     // Disable minimee in dev but not in staging and production
     $env_config['minimee_disable']     = (ENV == 'local') ? 'y' : 'n' ;

     // Greeny (auto-updating of upload directory paths)
     $env_config['greeny_enabled'] = (ENV == 'prod') ? 'false' :




64                                                     ERIKREAGAN • EECI
FOCUS LAB
     CONFIG SETUP
     github.com/focuslabllc/ee-master-config




65                                   ERIKREAGAN • EECI
MULTI-ENVIRONMENT
        CHALLENGES
       You didn’t think it was that easy, did you?




66                                         ERIKREAGAN • EECI
BACK TO THE
       SURVEY


67            ERIKREAGAN • EECI
100%
68      ERIKREAGAN • EECI
Keeping database changes synced across environments




     100%
68                                          ERIKREAGAN • EECI
72%
69     ERIKREAGAN • EECI
Maintaining custom upload directory paths




     72%
69                                      ERIKREAGAN • EECI
Devs who say the headaches are worth the trouble




 100%                                     ERIKREAGAN • EECI
70
DATABASE ISSUES
     • New custom fields alter the DB schema
     • Installing or updating add-ons can alter the DB
      schema

     • Updating EE can alter the DB schema



71                                            ERIKREAGAN • EECI
DATABASE ISSUES

     • Custom upload directory paths are stored in the DB
      and cannot be dynamically altered

     • Relative upload directory paths work sometimes, but
      not with all add-ons

     • “Content” is very likely changing in the Production
      environment while you build and test in your other
      environments




72                                             ERIKREAGAN • EECI
http://expressionengine.com/forums/viewthread/196480/


73                                           ERIKREAGAN • EECI
QUICK TIPS
     • You need to understand EE’s database
     • Learn about 3rd party add-on’s DB tables
     • Establish a ruleset for your workflow
     • Understand that there will be exceptions


74                                            ERIKREAGAN • EECI
Schema / Structure
flows up stream




75                   ERIKREAGAN • EECI
Content flows
down stream




76             ERIKREAGAN • EECI
FINAL NOTES
     • These practices make you a better developer
     • They help prepare you to work with a team
     • They help your team work more efficiently
     • You can provide a better service to your clients


77                                             ERIKREAGAN • EECI
ERIKREAGAN
     Partner Focus Lab LLC
      FocusLabLLC



78                           ERIKREAGAN • EECI

Contenu connexe

Tendances

Slack Bot: upload NUGET package to Artifactory
Slack Bot: upload NUGET package to ArtifactorySlack Bot: upload NUGET package to Artifactory
Slack Bot: upload NUGET package to ArtifactorySergey Dzyuban
 
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOpsBaruch Sadogursky
 
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...CloudBees
 
Spring Roo Add-On Development & Distribution
Spring Roo Add-On Development & DistributionSpring Roo Add-On Development & Distribution
Spring Roo Add-On Development & DistributionStefan Schmidt
 
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and MaintenanceJUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and MaintenanceCloudBees
 
Repository Management with JFrog Artifactory
Repository Management with JFrog ArtifactoryRepository Management with JFrog Artifactory
Repository Management with JFrog ArtifactoryStephen Chin
 

Tendances (6)

Slack Bot: upload NUGET package to Artifactory
Slack Bot: upload NUGET package to ArtifactorySlack Bot: upload NUGET package to Artifactory
Slack Bot: upload NUGET package to Artifactory
 
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
[Webinar] The Frog And The Butler: CI Pipelines For Modern DevOps
 
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
JUC Europe 2015: Jenkins-Based Continuous Integration for Heterogeneous Hardw...
 
Spring Roo Add-On Development & Distribution
Spring Roo Add-On Development & DistributionSpring Roo Add-On Development & Distribution
Spring Roo Add-On Development & Distribution
 
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and MaintenanceJUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
JUC Europe 2015: Scaling of Jenkins Pipeline Creation and Maintenance
 
Repository Management with JFrog Artifactory
Repository Management with JFrog ArtifactoryRepository Management with JFrog Artifactory
Repository Management with JFrog Artifactory
 

Similaire à Environments and Version Control in EE - The Why and How

FooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptxFooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptxGrace Jansen
 
Jfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptxJfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptxGrace Jansen
 
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...Paul Withers
 
Taming iOS Testing at Square -- JUC West 2015
Taming iOS Testing at Square -- JUC West 2015Taming iOS Testing at Square -- JUC West 2015
Taming iOS Testing at Square -- JUC West 2015Michael Tauraso
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchHoward Greenberg
 
General introduction to intellij idea
General introduction to intellij ideaGeneral introduction to intellij idea
General introduction to intellij ideaYusup
 
Docs as Code: Publishing Processes for API Experiences
Docs as Code: Publishing Processes for API ExperiencesDocs as Code: Publishing Processes for API Experiences
Docs as Code: Publishing Processes for API ExperiencesAnne Gentle
 
Jenkins User Meetup - eXo usages of Jenkins
Jenkins User Meetup - eXo usages of JenkinsJenkins User Meetup - eXo usages of Jenkins
Jenkins User Meetup - eXo usages of JenkinsArnaud Héritier
 
Build Your First EE2 Site
Build Your First EE2 SiteBuild Your First EE2 Site
Build Your First EE2 SiteRuthie BenDor
 
Circuit 2015 Keynote - Carsten Ziegeler
Circuit 2015 Keynote -  Carsten ZiegelerCircuit 2015 Keynote -  Carsten Ziegeler
Circuit 2015 Keynote - Carsten ZiegelerICF CIRCUIT
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...E. Camden Fisher
 
MyHeritage - QA Automations in a Continuous Deployment environment
MyHeritage -  QA Automations in a Continuous Deployment environmentMyHeritage -  QA Automations in a Continuous Deployment environment
MyHeritage - QA Automations in a Continuous Deployment environmentMatanGoren
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkinsAbe Diaz
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsOSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsNETWAYS
 
The Five Stages of Enterprise Jupyter Deployment
The Five Stages of Enterprise Jupyter DeploymentThe Five Stages of Enterprise Jupyter Deployment
The Five Stages of Enterprise Jupyter DeploymentFrederick Reiss
 
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ BrnoJenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ BrnoVaclav Tunka
 
Preparing your dockerised application for production deployment
Preparing your dockerised application for production deploymentPreparing your dockerised application for production deployment
Preparing your dockerised application for production deploymentDave Ward
 
Get your Project back in Shape!
Get your Project back in Shape!Get your Project back in Shape!
Get your Project back in Shape!Joachim Tuchel
 

Similaire à Environments and Version Control in EE - The Why and How (20)

FooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptxFooConf23_Bringing the cloud back down to earth.pptx
FooConf23_Bringing the cloud back down to earth.pptx
 
Jfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptxJfokus_Bringing the cloud back down to earth.pptx
Jfokus_Bringing the cloud back down to earth.pptx
 
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
From XPages Hero to OSGi Guru: Taking the Scary out of Building Extension Lib...
 
Taming iOS Testing at Square -- JUC West 2015
Taming iOS Testing at Square -- JUC West 2015Taming iOS Testing at Square -- JUC West 2015
Taming iOS Testing at Square -- JUC West 2015
 
Core Principles Of Ci
Core Principles Of CiCore Principles Of Ci
Core Principles Of Ci
 
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's WorkbenchAugust Webinar - Water Cooler Talks: A Look into a Developer's Workbench
August Webinar - Water Cooler Talks: A Look into a Developer's Workbench
 
General introduction to intellij idea
General introduction to intellij ideaGeneral introduction to intellij idea
General introduction to intellij idea
 
Docs as Code: Publishing Processes for API Experiences
Docs as Code: Publishing Processes for API ExperiencesDocs as Code: Publishing Processes for API Experiences
Docs as Code: Publishing Processes for API Experiences
 
Jenkins User Meetup - eXo usages of Jenkins
Jenkins User Meetup - eXo usages of JenkinsJenkins User Meetup - eXo usages of Jenkins
Jenkins User Meetup - eXo usages of Jenkins
 
Build Your First EE2 Site
Build Your First EE2 SiteBuild Your First EE2 Site
Build Your First EE2 Site
 
Circuit 2015 Keynote - Carsten Ziegeler
Circuit 2015 Keynote -  Carsten ZiegelerCircuit 2015 Keynote -  Carsten Ziegeler
Circuit 2015 Keynote - Carsten Ziegeler
 
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
CT Software Developers Meetup: Using Docker and Vagrant Within A GitHub Pull ...
 
MyHeritage - QA Automations in a Continuous Deployment environment
MyHeritage -  QA Automations in a Continuous Deployment environmentMyHeritage -  QA Automations in a Continuous Deployment environment
MyHeritage - QA Automations in a Continuous Deployment environment
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
OSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy HawkinsOSDC 2013 | Introduction into Chef by Andy Hawkins
OSDC 2013 | Introduction into Chef by Andy Hawkins
 
The Five Stages of Enterprise Jupyter Deployment
The Five Stages of Enterprise Jupyter DeploymentThe Five Stages of Enterprise Jupyter Deployment
The Five Stages of Enterprise Jupyter Deployment
 
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ BrnoJenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
Jenkins-Koji plugin presentation on Python & Ruby devel group @ Brno
 
Preparing your dockerised application for production deployment
Preparing your dockerised application for production deploymentPreparing your dockerised application for production deployment
Preparing your dockerised application for production deployment
 
Lrug
LrugLrug
Lrug
 
Get your Project back in Shape!
Get your Project back in Shape!Get your Project back in Shape!
Get your Project back in Shape!
 

Dernier

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 

Dernier (20)

Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 

Environments and Version Control in EE - The Why and How

  • 1. ENVIRONMENTS & VERSION CONTROL The Why & How ERIKREAGAN • EECI
  • 2. WHO IS THIS GUY? EE Reactor team member 2 ERIKREAGAN • EECI
  • 3. WHO IS THIS GUY? Partner & Lead Developer 3 ERIKREAGAN • EECI
  • 4. Survey Submissions 4 78 ERIKREAGAN • EECI
  • 5. SURVEY SUBMISSIONS Web Development Experience 35 6-10 years 24 3-5 years 19 Over 10 years 5 ERIKREAGAN • EECI
  • 6. SURVEY SUBMISSIONS ExpressionEngine Experience 40 3-4 years 19 0-2 years 12 5-7 years 4 pMachine 3 None 6 ERIKREAGAN • EECI
  • 7. SURVEY SUBMISSIONS Weekly Responsibilities 66 HTML/CSS/JS markup 64 EE site planning 38 PHP/MySQL development 21 Add-on development 20 Content management 19 Team leader 7 ERIKREAGAN • EECI
  • 8. Caught my Monty Python reference 8 73% ERIKREAGAN • EECI
  • 9. VERSION CONTROL 9 ERIKREAGAN • EECI
  • 10. SYNONYMS • Version Control • Revision Control • Source Control 10 ERIKREAGAN • EECI
  • 11. COMMON SYSTEMS • Git • Subversion • Mercurial 11 ERIKREAGAN • EECI
  • 12. SURVEY STATS 12 ERIKREAGAN • EECI
  • 13. Devs not currently using a VCS regularly 13 34% ERIKREAGAN • EECI
  • 14. Devs only using a desktop GUI for VCS 14 21% ERIKREAGAN • EECI
  • 15. Devs only using command line for VCS 15 21% ERIKREAGAN • EECI
  • 16. Devs using both CLI and a GUI for VCS 16 24% ERIKREAGAN • EECI
  • 17. Have used CVS 17 6% ERIKREAGAN • EECI
  • 18. Have used Mercurial 18 13% ERIKREAGAN • EECI
  • 19. Have used Subversion 19 54% ERIKREAGAN • EECI
  • 20. Have used Git 20 77% ERIKREAGAN • EECI
  • 21. WE USE GIT Linux jQuery Rails Android 21 ERIKREAGAN • EECI
  • 22. WE USE GIT And so do the cool kids Linux jQuery Rails Android 21 ERIKREAGAN • EECI
  • 23. WE USE GIT And so do the cool kids Linux jQuery Rails Android 21 ERIKREAGAN • EECI
  • 24. OLD WAY Single Developer 1. Duplicate index.html 2. Test changes 3. (Maybe save a backup of the previous version) 4. Save over old version losing previous state 22 ERIKREAGAN • EECI
  • 25. NEW WAY Single Developer 1. Change and save the file contents (Retain history of file for future use) 23 ERIKREAGAN • EECI
  • 26. OLD WAY Development Team 1. Bob changes part of index.html 2. Suzie changes a different part of index.html 3. Bob and Suzie carefully merge changes together 4. Overwrite old version of index.html 24 ERIKREAGAN • EECI
  • 27. NEW WAY Development Team 1. Change and save the file contents (Retain history of file for future use) 25 ERIKREAGAN • EECI
  • 28. 26 ERIKREAGAN • EECI
  • 29. 26 ERIKREAGAN • EECI
  • 30. 26 ERIKREAGAN • EECI
  • 31. KEY CONCEPTS • Track certain files • Ignore certain files • Commits (History) • Branches • Remote branches 27 ERIKREAGAN • EECI
  • 32. “WHAT DO I TRACK?” VS “WHAT DO I IGNORE?” 28 ERIKREAGAN • EECI
  • 33. IGNORED FILES • Operating System files • Caches • .htaccess (possibly) • Custom uploads from EE • Dynamic images (captchas etc) 29 ERIKREAGAN • EECI
  • 34. .gitignore # Lame OS files Thumbs.db .DS_Store # EE System cache /system/expressionengine/cache/* # Local dev database file /config/config.local.php # Custom Upload Directories /public_html/uploads/* # Captchas /public_html/images/captchas # Asset minification /public_html/min 30 ERIKREAGAN • EECI
  • 35. TRACKED FILES • EE System directory • Add-ons • Template flat files • Images, CSS, Javascript & other assets 31 ERIKREAGAN • EECI
  • 36. COMMITS Create your history 32 ERIKREAGAN • EECI
  • 37. COMMIT TIPS • Commit o en (common Git practice) • Write detailed commit messages • Review commit log when returning to a project a er a break of any sort • Review commits of development team members 33 ERIKREAGAN • EECI
  • 38. BAD COMMIT MESSAGE Updated config file. 34 ERIKREAGAN • EECI
  • 39. GOOD COMMIT MESSAGE Updated config file with new Minimee cache path directory This allows our cache path to be dynamicly absolute based on the environment out code is in. $config[‘minimee_cache_path’] = $base_path . ‘/min’; 35 ERIKREAGAN • EECI
  • 40. BRANCHING Keeping things organized 36 ERIKREAGAN • EECI
  • 41. BRANCHING WORKFLOW Do what works best for you Just make sure you do it for a reason 37 ERIKREAGAN • EECI
  • 42. REMOTE BRANCHES • Destination for your repository / branch • “Origin” of your repository / branch • Server environment for your site • Other team member’s repository / branch 38 ERIKREAGAN • EECI
  • 43. TOPICAL BRANCHING • master • dev • feature/x • upgrade/y • bugfix/z 39 ERIKREAGAN • EECI
  • 44. “It's like not wearing a seatbelt in your car because you haven't had an accident yet. Don't be silly, version your work.” Iain Urquhart / @iain 40 ERIKREAGAN • EECI
  • 45. GIT RESOURCES • Book: Pragmatic Version Control Using Git • peepcode.com/products/git • whygitisbetterthanx.com • github.com • More available with the presentation download 41 ERIKREAGAN • EECI
  • 46. ENVIRONMENTS 42 ERIKREAGAN • EECI
  • 47. AN ENVIRONMENT IS any server running an instance of your site 43 ERIKREAGAN • EECI
  • 48. COMMON ENVIRONMENTS • Production - the public-facing “live” site • Staging - typically used for a final test • Development - shared team development • Local - each developer’s local instance 44 ERIKREAGAN • EECI
  • 49. SURVEY STATS 45 ERIKREAGAN • EECI
  • 50. Devs currently using a Production Environment 100% 46 ERIKREAGAN • EECI
  • 51. Devs currently using a Staging Environment 47 59% ERIKREAGAN • EECI
  • 52. Devs currently using a Shared Dev Environment 48 32% ERIKREAGAN • EECI
  • 53. Devs currently using a Local Dev Environment 49 77% ERIKREAGAN • EECI
  • 54. Devs who keep using environments post-launch 50 29% ERIKREAGAN • EECI
  • 55. WHY DO YOU USE ENVIRONMENTS? 51 ERIKREAGAN • EECI
  • 56. “Local development is incredibly fast and you don't have to worry about setting up crazy conditionals and memeber preferences to hide what you are working on on the live site.” 52 ERIKREAGAN • EECI
  • 57. “Multiple environments allow us to build locally without affecting others and preview new features to clients - without losing the ability to quickly apply updates to the current live site.” 53 ERIKREAGAN • EECI
  • 58. “Automated deployments and multiple environments are essential to any agile-oriented developer. They save time, reduce errors and streamline site maintenance.” 54 ERIKREAGAN • EECI
  • 59. GETTING SET UP What is potentially unique to each environment? 55 ERIKREAGAN • EECI
  • 60. GETTING SET UP What’s Unique? • Server paths • URL root • EE upload paths • Debug mode intentions • URI support (PATH_INFO) • Cache settings 56 ERIKREAGAN • EECI
  • 61. ROBUST CONFIG FILE Saves time and adds flexibility 57 ERIKREAGAN • EECI
  • 62. GETTING SET UP What can be changed? ✓ Server paths ✓ URL root - EE upload paths ✓ Debug mode intentions ✓ URI support (PATH_INFO) ✓Cache settings 58 ERIKREAGAN • EECI
  • 63. GETTING SET UP Directory and file structure /config/ config.env.php config.master.php config.{ENV}.php /public_html/ /system/ /tpl/ 59 ERIKREAGAN • EECI
  • 64. GETTING SET UP config.env.php sample if ( ! defined('ENV')) { switch ($_SERVER['HTTP_HOST']) { case 'focuslabllc.com' : define('ENV', 'prod'); define('ENV_FULL', 'Production'); define('ENV_DEBUG', FALSE); break; case 'ohsnap.focuslabllc.com' : define('ENV', 'stage'); define('ENV_FULL', 'Staging'); define('ENV_DEBUG', FALSE); break; default : define('ENV', 'local'); define('ENV_FULL', 'Local'); define('ENV_DEBUG', TRUE); break; } } 60 ERIKREAGAN • EECI
  • 65. GETTING SET UP config.dev.php sample <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * Development config overrides & db credentials * * Our database credentials and any environment-specific overrides * * @package Focus Lab Master Config * @version 1.1 * @author Erik Reagan <erik@focuslabllc.com> */ $env_db['hostname'] = 'localhost'; $env_db['username'] = ''; $env_db['password'] = ''; $env_db['database'] = ''; $config['webmaster_email'] = 'dev@focuslabllc.com'; /* End of file config.dev.php */ /* Location: ./config/config.dev.php */ 61 ERIKREAGAN • EECI
  • 66. GETTING SET UP config.master.php sample /** * Template settings * * Working locally we want to reference our template files. * In staging and production we do not use flat files * (for ever-so-slightly better performance) * This approach requires that we synchronize templates after * each deployment of template changes */ $env_config['save_tmpl_files'] = (ENV == 'prod') ? 'n' : 'y'; $env_config['tmpl_file_basepath'] = $base_path . '/../tpl/'; $env_config['hidden_template_indicator'] = '_'; 62 ERIKREAGAN • EECI
  • 67. GETTING SET UP config.master.php sample /** * Debugging settings * * These settings are helpful to have in one place * for debugging purposes */ $env_config['is_system_on'] = 'y'; $env_config['allow_extensions'] = 'y'; $env_config['email_debug'] = (ENV_DEBUG) ? 'y' : 'n' ; // Show template debugging if we're not in production $env_config['template_debugging'] = (ENV_DEBUG) ? 'y' : 'n' ; /** * Set debug to '2' if we're in dev mode, otherwise just '1' * * 0: no PHP/SQL errors shown * 1: Errors shown to Super Admins * 2: Errors shown to everyone */ $env_config['debug'] = (ENV_DEBUG) ? '2' : '1' ; 63 ERIKREAGAN • EECI
  • 68. GETTING SET UP config.master.php sample /** * 3rd Party Add-on config items as needed */ $env_config['minimee_cache_path'] = $base_path . '/min'; $env_config['minimee_cache_url'] = $base_url . '/min'; $env_config['minimee_remote_mode'] = 'auto'; $env_config['minimee_debug'] = 'n'; // Disable minimee in dev but not in staging and production $env_config['minimee_disable'] = (ENV == 'local') ? 'y' : 'n' ; // Greeny (auto-updating of upload directory paths) $env_config['greeny_enabled'] = (ENV == 'prod') ? 'false' : 64 ERIKREAGAN • EECI
  • 69. FOCUS LAB CONFIG SETUP github.com/focuslabllc/ee-master-config 65 ERIKREAGAN • EECI
  • 70. MULTI-ENVIRONMENT CHALLENGES You didn’t think it was that easy, did you? 66 ERIKREAGAN • EECI
  • 71. BACK TO THE SURVEY 67 ERIKREAGAN • EECI
  • 72. 100% 68 ERIKREAGAN • EECI
  • 73. Keeping database changes synced across environments 100% 68 ERIKREAGAN • EECI
  • 74. 72% 69 ERIKREAGAN • EECI
  • 75. Maintaining custom upload directory paths 72% 69 ERIKREAGAN • EECI
  • 76. Devs who say the headaches are worth the trouble 100% ERIKREAGAN • EECI 70
  • 77. DATABASE ISSUES • New custom fields alter the DB schema • Installing or updating add-ons can alter the DB schema • Updating EE can alter the DB schema 71 ERIKREAGAN • EECI
  • 78. DATABASE ISSUES • Custom upload directory paths are stored in the DB and cannot be dynamically altered • Relative upload directory paths work sometimes, but not with all add-ons • “Content” is very likely changing in the Production environment while you build and test in your other environments 72 ERIKREAGAN • EECI
  • 80. QUICK TIPS • You need to understand EE’s database • Learn about 3rd party add-on’s DB tables • Establish a ruleset for your workflow • Understand that there will be exceptions 74 ERIKREAGAN • EECI
  • 81. Schema / Structure flows up stream 75 ERIKREAGAN • EECI
  • 82. Content flows down stream 76 ERIKREAGAN • EECI
  • 83. FINAL NOTES • These practices make you a better developer • They help prepare you to work with a team • They help your team work more efficiently • You can provide a better service to your clients 77 ERIKREAGAN • EECI
  • 84. ERIKREAGAN Partner Focus Lab LLC FocusLabLLC 78 ERIKREAGAN • EECI