Thursday, 19 January 2017

Deploying hybris Sample Sites in version 5.6 and greater

Ahhh where have I been??? Sorry for the long run of silence. L I promised so much and all you have heard is empty air.  Well I’ll try (sorry, I’m done promising  :oops:) to get better and to start off on the right foot, I figured I’d start where I originally began, installing hybris locally.
Over the past couple months, I saw numerous comments with people hitting problems with 5.6 and 5.7 version of hybris deployment and trying to access the provided sample sites.  So I thought I would revisit one of my older posts, How to get started… Link to online references and a guide to setup your own environment, to see what is going on.
As mentioned many times before, wiki.hybris.com is your holy grail to hybris, but even hybris themselves have admitted it is difficult to navigate.  As I began my research into hybris 5.7 installation and went straight to my previous trusted source, Quick Installation page. I noticed immediately a very important notification box:

  • Do notuse the quick installation procedure if you’ve already created a working commerce suite configuration. Recipes will not preserve it!
  • The Quick Installation procedure applies to releases 5.1 through 5.5 of the hybris Commerce Suite. As of the hybris Commerce Suite release 5.6, this procedure has been deprecated as sample configurations are no longer provided with the hybris Commerce Suite. To quickly install the hybris Commerce Suite for release 5.6 and later, see Sample Scenarios Installation.

The third bullet is most interesting as this means that my original guide I created for 5.4 is no longer valid, this is the likely reason so many people receive dead pages when trying to access the B2C or B2B accelerator pages. Starting with version 5.6, hybris implemented a new build mechanism called hybris Installer using an open source packaging solution called Gradle. Gradle allows a solution provider to build a template of sorts for their solutions, bundling the copy, move, configure and execution of commands all in a single call to remove chance of user error in more traditional deployments. After a solution provider like hybris has build their template package, vendors can create many “recipes” to deploy new functions or solutions.
To improve the deployment of hybris sample sites, hybris created over 30 recipes to support a variety of scenarios to introduce hybris capabilities.  For summary of the recipes, go here.  In this article, I will not go over them in detail, but I am investigating each one and report back later. In interest of time and the objective of this article, I will use the recipe B2C Accelerator.
Let’s begin:

Step 1: Host Computer Specs
Always good to make sure your host computer is up to snuff to handle hybris before you actually start installing or configuring anything.  Checkout the System Requirements page for requirements of 5.7.
In my case, I am running:
  • CPU: i7
  • Memory: 8GB
  • HD: SSD (lots of room)
  • OS: Windows 10
Step 2: Setting up JAVA
Since hybris is JAVA based application, you will need to have JAVA deployed to your host computer. It is strongly recommended that you install JAVA JDK, you can download it here. NOTE: if you are running the sample recipe provided by hybris, and not receiving a package already “compiled” or built by them, you MUST install JAVA JDK. In other words, it is safer to just go ahead with JDK version of JAVA
Now if you are an amateur like me and have little technical experience with JAVA and this is the first time you installed it, there is an extra step you need to perform and that is setting JAVA_Home variable. Below are instructions for Windows, for Unix/linux, see here (windows details are here too  below is also based on Windows 10 OS
  1. click on Cortana for search and search for Edit the system environment variables
    Environment variable
  2. In the Advanced tab of System Properties click on Environment Variables… button
    systemproperties
  3. In System Variables section, verify that there is not an existing variable called JAVA_HOME.
    CheckJAVAHome
  4. If does not exist, click New button below the list box, or if does exist, select it and click Edit.
  5. In Variable field, enter JAVA_HOME.  For Value enter the path of your JDK folder.  In my computer, the path is: C:\Program Files\Java\jdk1.8.0_66
    NOTE: as a best practice, it is good NOT to include spaces in your Environmental Variables. If you installed JAVA  using default directory, you can replace C:\Program Files with %PROGRAMFILES%
    CreateJAVAHOMEAs an additional recommendation, you should add a User variable that points directly to the Bin folder of your JDK. TO do this, create a User Variable entry with the following details:
    userVariableentry
  6. After configuring all settings above close all Command Windows if any are open for changes to take effect.
Step 3: Download hybris Commerce Suite
To download hybris Commerce Suite go hereREMINDER, hybris installation comes with a built-in 30-day trial period. After 30 days, you will have to reinitialize your deployment, meaning everything you did is lost. If you want a permanent license contact your channel manager.  For more details, see URGENT NOTICE: Licensing limitation in your local environment
Now that you downloaded the massive zip file, time to extract contents. The hybris folder structure is VERY deep, this causes great limitations in how you can unzip and where. To unzip, you must use WinRar or 7-zip, built-in windows extractor will fail.  Next, there is many root directories in the zip. To help keep it all contained, I created a folder in my C:\ and called it hybris. This WILL create a duplicate in your paths though as when you build your hybris recipe, it will be deployed to a subfolder called hybris, resulting in your path being C:\hybris\hybris…. but it just keeps everything clean in my drive.
Step 4: Time to install and initialize
We spoke about early a new package deployment called hybris Installer and Recipes. After we have selected the recipe of interest, we
  1. Open Command Prompt as Administrator.
  2. Change directory to the location of the installer directory that was found in the original hybris Commerce Suite zip. In my case, CD C:\hybris\installer
  3. We now execute the recipe using the command: install.bat -r in my caseinstall.bat -r b2c_acc
    1. The installer automatically executes. In the event that you see the error:
      JAVASetupErrorThis is not serious, but to remove this message, this means you did not add a PATH variable to your User Variables we mentioned in Step 2 above. Make sure after adding variable you close all command prompts before trying again.
    2. A successful build is shown as follows:
      Successbuild
  4. After successful build, we need to initialize the package. Initialization is the actual configuration and deployment of content. NOTE: this will take a long time to complete, be patient. This is where the new installer is very handy. In an older version of hybris, we had to perform many steps using HAC (Hybris Administration Console) but the installer recipe replaces these steps with a single call. To initialize, run the command install.bat -r initialize, in my case:install.bat -r b2c_acc initialize
    1. During the process, you will see a prompt of a firewall exception, make sure you select Allow.
      JAVAallow
    2. Notice that Building always show as 0%
      Building0Per
    3. A success is shown as
      initialize success
  5. Now it is time to Start your hybris implementation. First we need to answer a question. Are you planning to STOP the server in same computer session, or leave live until host computer shutdown or restarts? Reason we ask this question is because an issue has been discovered where if you want to STOP the server within a computer session, you cannot if you use the Installer Step feature, but a workaround is available. I will discuss this issue in a future blog.
    1. Leave hybris running until host computer restarts
      1. In the command prompt, type: install.bat -r start, in my case:install.bat -r b2c_acc start
      2. When you see the below image, you have successfully started your hybris deployment.
        Successfulstartnotregister
      3. notice that although the server is started, the command prompt still says Building 0% and you cannot complete any additional action.
    2. Shutdown hybris anytime
      1. in the command prompt, type CD C:\hybris\hybris\bin\platform this will change directory.
      2. then enter hybrisserver.bat
      3. You might be prompted by firewall again to allow connection
        javaprompt2
      4. successful start is shown as follows:
        StartSuccess
      5. To stop the server hit Ctrl+C and when you see the prompt Terminate batch job enter Y
Step 5: Update Hosts File
If you are running Windows, it is strongly recommended you update your HOSTS file for optimal experience. To do so
  1. Open Cortana and search for Notepad. Right click on Notepad and select Run As Administrator
    NotePadAdministrator
  2. In Notepad, go to File-> Open and go to the directory C:\Windows\System32\drivers\etc set file types to All Files and then select hosts
    Hostslocation
  3. Add the following line to the bottom of the file:127.0.0.1   apparel-uk.local apparel-de.local electronics.local powertools.local hsotsexample
To access your storefront pages, use:
To access the cockpits, go to mcc (multi-channel commerce) found at http://localhost:9001/mcc, built in admin login is username Admin, password nimda
Stay tuned for more tips and details!

Anonymous

Author & Editor

A technology enthusiast and addictive blogger who likes to hacking tricks and wish to be the best White Hacket Hacker of the World.

1 comments:

  1. I really like your blog with respective content, Thanks for sharing for your information about Devops Online Course Hyderabad

    ReplyDelete

Note: only a member of this blog may post a comment.