How to push to production aproject with 100+ plugins inless than 10 minutesThiago MoreiraSenior Consultant @ Liferay Brazil
Agenda•   Motivation•   About the project•   Script workflow•   Benefits•   Challenges•   References•   Future
Motivation (1/2)Back in 2010 I was working in another consulting project andwe were getting ready to push to production a ...
Motivation (2/2)• Thiago: Hey mike, I have to say that I’m confortable withthe project implementation but I’m a little wor...
About the project (1/5)• 1 ext• 4 layout templates• 121 portlets (21 projects with 1 portlet and 1 project with100 portlet...
About the project (2/5)•   4 Production server in cluster•   1 QA server•   0 Development server•   1 Jenkins server•   1 ...
About the project (3/5)       Tomcat and            Deployment         Liferay           host, deployment         bundles ...
About the project (4/5)• 3 Jenkins jobs were configured to each of the 3 brancheson git.   • Master -> development (every ...
About the project (5/5)                       Production                      Environment           QA                    ...
Script Workflow  Check        Build      BuildEnvironment   Liferay   Application   Clean               Build    Configure...
Script Workflow
Check environment•   It is used to check if the environment is correct    1. It checks if the developer set the target.env...
Script Workflow
Clean1. It is used to clean the main build directory e.g. the target directory.
Script Workflow
Build Tomcat1. Unpack a vanilla Tomcat from the ${basedir}/src/main/bundle directory to ${basedir}/target1. Delete all web...
Script Workflow
Build Liferay1. Unpacks the ${basedir}/src/main/bundles/liferay- version.war to ${tomcat}/webapps/ROOT2. Unpacks the ${bas...
Script Workflow
Build Application (1/2)1. Build and direct-deploy the ext project Ant based2. Call Maven to build the other projects   • T...
Build Application (2/2)                          Avoid Liferay to deploy                          the plugins on startup  ...
Script Workflow
Configure Tomcat (1/2)Worker-Name1. Creates a MANIFEST.MF file with set a properties that identifies the current build    ...
Configure Tomcat (2/2)Worker-Name4. Configure setenv.sh with the proper TOMCAT_HOME and   CATALINA_OPTS
Script Workflow
Deploy to environment (1/2)1. Pack a tgz bundle with everything built2. Shutdown the remote Tomcat3. Remotely remove the o...
Deploy to environment (2/2)
Benefits• We use the same script to build and deploy on developersmachine as well QA and Production boxes. This ensure tha...
Challenges• Upgrade the version of Liferay from 6.0.11 to 6.0.12• Push changes that affects the database• If needed put th...
References• Continuous Delivery: Reliable Software Releases ThroughBuild, Test, And Deployment Automation by Jez Humble an...
Future• Short term  • Add jsp pre-compilation  • Replace the direct-deploy Ant task per a Maven goal  • Use a sudo user to...
Thank you!                 thiago.moreira@liferay.comtmoreira2020 @ facebook | linkedin | plus | slideshare | twitter   Do...
Upcoming SlideShare
Loading in...5
×

How to push to production a project with 100+ plugins in less than 10 minutes

490

Published on

Presentation presented at Liferay Europe symposium 2012.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
490
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Share our experience during a project that Liferay took over with more than 100 pluginsHow we create a process of push to production and was able to do it consistently
  • This talk fired two lines of thought: 1º get ready for wherever happen and 2º repeat as much as possible the process to push to production on similar environments to reduce the issues
  • In the beginning we didn‘t have a Jenkins server or a Development and QA server. The whole process of push to production was manually executedSumming up: chaos!
  • We matched all branches of the project to one Jenkins job
  • Describes what the script (deploy.xml) does.
  • Describes what the script (deploy.xml) does.
  • Describes what the script (deploy.xml) does.
  • Describes what the script (deploy.xml) does.
  • Describes what the script (deploy.xml) does.
  • Describes what the script (deploy.xml) does.
  • Describes what the script (deploy.xml) does.
  • - 3 if Tomcat will run using AJP or HTTP connector and the jvm route name.
  • - Most of the properties are defined in the environment.properties
  • Describes what the script (deploy.xml) does.
  • Every steps in blue runs remotely- The properties from environment.properties are used in the step to connect and access the remote host- You can use a deploy user with limited sudo actions
  • Every steps in blue runs remotely- The properties from environment.properties are used in the step to connect and access the remote host- You can use a deploy user with limited sudo actions
  • - The process of migration the script was smooth because we had the all references to Liferay version as a variable
  • How to push to production a project with 100+ plugins in less than 10 minutes

    1. 1. How to push to production aproject with 100+ plugins inless than 10 minutesThiago MoreiraSenior Consultant @ Liferay Brazil
    2. 2. Agenda• Motivation• About the project• Script workflow• Benefits• Challenges• References• Future
    3. 3. Motivation (1/2)Back in 2010 I was working in another consulting project andwe were getting ready to push to production a new version ofan intranet based on Social Office when I had the followingphone talk with Michael Han
    4. 4. Motivation (2/2)• Thiago: Hey mike, I have to say that I’m confortable withthe project implementation but I’m a little worried about thetask of push to production… (waiting a response like: don’tworry everything will be fine)• Mike: Thiago, something will go wrong! The thing is, youhave to be ready to fix it.• Thiago: Oh man!
    5. 5. About the project (1/5)• 1 ext• 4 layout templates• 121 portlets (21 projects with 1 portlet and 1 project with100 portlets• 12 hooks• 6 themes• 4 webs• Total 148 plugins.
    6. 6. About the project (2/5)• 4 Production server in cluster• 1 QA server• 0 Development server• 1 Jenkins server• 1 Nexus server (shared with Jenkins)• Github as source code server
    7. 7. About the project (3/5) Tomcat and Deployment Liferay host, deployment bundles user, application user, JVM settings, etc Liferay Environment Liferay patches profiles plugins Properties files Main script
    8. 8. About the project (4/5)• 3 Jenkins jobs were configured to each of the 3 brancheson git. • Master -> development (every push to upstream) • QA (homologacao) -> QA (every day at 7:00 am) • Production -> production (push of a button)
    9. 9. About the project (5/5) Production Environment QA Development Environment Jenkins Environment
    10. 10. Script Workflow Check Build BuildEnvironment Liferay Application Clean Build Configure Deploy to Tomcat Tomcat environment
    11. 11. Script Workflow
    12. 12. Check environment• It is used to check if the environment is correct 1. It checks if the developer set the target.environment variable 2. It checks if the environment has the correct Ant version (configurable) 3. It checks if the environment has the correct Maven version (configurable)
    13. 13. Script Workflow
    14. 14. Clean1. It is used to clean the main build directory e.g. the target directory.
    15. 15. Script Workflow
    16. 16. Build Tomcat1. Unpack a vanilla Tomcat from the ${basedir}/src/main/bundle directory to ${basedir}/target1. Delete all webapps’ directory content2. Delete all *.bat files from bin directory3. Set execution permission on *.sh files from bin directory
    17. 17. Script Workflow
    18. 18. Build Liferay1. Unpacks the ${basedir}/src/main/bundles/liferay- version.war to ${tomcat}/webapps/ROOT2. Unpacks the ${basedir}/src/main/bundles/liferay- dependencies-version.zip to ${tomcat}/lib3. Install and configure the patching-tool-4.zip into the right place (liferay home)4. Copy the license to the deploy directory
    19. 19. Script Workflow
    20. 20. Build Application (1/2)1. Build and direct-deploy the ext project Ant based2. Call Maven to build the other projects • The sequence of build is defined at the pom.xml and it is • commons • webs • layouttpl • themes • hooks • portlets
    21. 21. Build Application (2/2) Avoid Liferay to deploy the plugins on startup (cold deploy)3. Call direct-deploy on each of the projects built by Maven4. Copy the patches to the patching-tool home5. Copy plugins (downloaded from liferay.com) to deploy directory
    22. 22. Script Workflow
    23. 23. Configure Tomcat (1/2)Worker-Name1. Creates a MANIFEST.MF file with set a properties that identifies the current build Can be accessed thought www.domain.com/html /environment.txt2. Configure portal-ext.properties with environment properties3. Configure server.xml with environment properties
    24. 24. Configure Tomcat (2/2)Worker-Name4. Configure setenv.sh with the proper TOMCAT_HOME and CATALINA_OPTS
    25. 25. Script Workflow
    26. 26. Deploy to environment (1/2)1. Pack a tgz bundle with everything built2. Shutdown the remote Tomcat3. Remotely remove the old Liferay4. Copy the bundle to the remote machine5. Unpack the bundle6. Change the ownership of liferay home to the application user and group7. Configure *.sh to be runnable8. Apply the patches9. Start the remote Tomcat10. Wait 90 seconds (configurable) until start the next node
    27. 27. Deploy to environment (2/2)
    28. 28. Benefits• We use the same script to build and deploy on developersmachine as well QA and Production boxes. This ensure thatthe script is validated several times before run on production.• The whole process does not take more than 10 minutes tofinish on any environment.• We are able to rollback the version in production within afew minutes
    29. 29. Challenges• Upgrade the version of Liferay from 6.0.11 to 6.0.12• Push changes that affects the database• If needed put the production environment in maintenanceautomatically through script.• Test cluster configuration directly on production
    30. 30. References• Continuous Delivery: Reliable Software Releases ThroughBuild, Test, And Deployment Automation by Jez Humble andDavid Farley
    31. 31. Future• Short term • Add jsp pre-compilation • Replace the direct-deploy Ant task per a Maven goal • Use a sudo user to remote deploy instead of root• Middle term • Move the infra structure to a PaaS (Cloudbees) • Script the process of update and restart the web server when needed• Long term • Create a Maven plugin to replace the Ant script
    32. 32. Thank you! thiago.moreira@liferay.comtmoreira2020 @ facebook | linkedin | plus | slideshare | twitter Don’t forget to rate the presentation on our mobile app!
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×