Archives

Archives / 2017
  • sitecore - one click publish for web projects

    With the Helix application structure of sitecore projects there are a lot of web projects. If you follow the Habitat tooling there is a set of convenient gulp tasks for publishing changes like the "do it all" gulp default task. In most cases publishing the web project you made your changes in is enough. In most cases this is a feature or foundation project. You can do this by right-clicking on the web project, select Publish..., and press the Publish button in the resulting screen. A faster way is to enable the Views > Toolbars > Web One Click Publish option so you get a button on your toolbar for fast publication.

  • sitecore Habitat - TypeError: Cannot read property '0' of undefined

    When you get the error TypeError: Cannot read property '0' of undefined in the Gulp task '05-Sync-Unicorn' you probably don't have a SharedSecret configured in the file C:\Projects\Habitat\src\Project\Habitat\code\App_Config\Include\Unicorn\Unicorn.UI.config.

    In my project the SharedSecret wat commented out, i.e.:

    <!--<SharedSecret></SharedSecret> Uncomment this line and provide a strong randomized shared secret here. At least 64 characters is recommended, for example https://www.grc.com/passwords.htm -->

    I followed the instructions, uncommented it, grabbed a 64 characters password from  https://www.grc.com/passwords.htm so my line read:

    <SharedSecret>06A3203AA36C84D499D9BF6F79852B61EF2992465C2160FE09263E1AB5B882E2</SharedSecret>

    I did run gulp 05-Sync-Unicorn again, but still the same error. 

    After adding a line to the script C:\Projects\Habitat\scripts\unicorn.js:

    console.log("Reading Unicorn configuration file " + unicornConfigFile);
    var data = fs.readFileSync(unicornConfigFile);
    I saw my problem:
    The script is reading from the deployed website location ( C:\websites\Habitat.dev.local\Website/App_config/Include/Unicorn/Unicorn.UI.config), not the project location (C:\Projects\Habitat\src\Project\Habitat\code\App_Config\Include\Unicorn\Unicorn.UI.config). 
    I could run the complete gulp default task again, but doing a Publish... on the Sitecore.Habitat.Website project (right-click on the project) does the job much quicker.
    After publishing, re-execute step 5 again: gulp 05-Sync-Unicorn
    Hint for the sitecore team: reading a configuration setting using the line:
    secret = result.configuration.sitecore[0].unicorn[0].authenticationProvider[0].SharedSecret[0];
    from a configuration file where this setting is commented out will lead to issues that take people a lot of time to find out, especially because I couldn't find anything on this on the Wiki documentation of the Habitat project.
  • sitecore SIM - backup installation as restore point

    After doing a fresh install of a sitecore site through the sitecore instance manager (SIM) including packages like Sitecore PowerShell Extensions and other stuff you want to have installed you can make a backup (right-click on your site > Backup) as a fresh restore point in case things get terribly wrong. 

    Note that the backups are made in the folder C:\websites\mysite.dev.local\Backups.

    Install the latest version of SIM from http://dl.sitecore.net/updater/sim/.

  • sitecore SIM - succesful install but no databases

    I was busy with an installation of sitecore through the sitecore instance manager (SIM), asnd everything seemed to be ok, but I had no databases.

    I gave Network Service read/write access on my c:\websites folder, but when I looked the SIM logs (Home > Bundled tools > SIM logs) I saw the error:

    System.Data.SqlClient.SqlException (0x80131904): Unable to open the physical file "C:\websites\mysite.dev.local\Databases\Sitecore.core.mdf". Operating system error 5: "5(Access denied.)".

    When I gave Network Service full control on the folder c:\websites it worked.

    Install the latest version of SIM from http://dl.sitecore.net/updater/sim/.

  • Wappalyzer + PageXray Chrome plugins combined change PUT to GET

    I installed at home two Chrome plugins on my Mac to analyze technology used on websites: Wappalyzer and PageXray. When I got on my work this morning and turned on my Windows PC  I started using the application we are developing, but it behaved weird. After a lot of debugging I found that an Ajax PUT request was changed into a GET request! Then I remembered that I installed some plugins at home, and that on startup of Chrome these plugins were installed at work as well! When I disable one of the plugins it started working again as expected. So beware of this deadly combination!!

  • Zipkin with docker startup script

    In a project we use http://zipkin.io/ for distributed tracing. During development is is very handy to trace to Zipkin running in a Docker image. The following PowerShell script will help with (re)starting the Docker image on WIndows and open Zipkin in Chrome when it is running.

    $runningZipkin = & docker ps -q --filter ancestor=openzipkin/zipkin
    if ($runningZipkin) {
    "Running Zipkin with id $runningZipkin - will be killed"
    & docker stop $runningZipkin
    }
    "Starting Zipkin docker image"
    & docker run -d -p 9411:9411 openzipkin/zipkin

    $ErrorActionPreference = "SilentlyContinue" # We don't want to see failing requests
    do {
    Start-Sleep -Seconds 1
    "Waiting for starting of Zipkin..."
    $up = Invoke-WebRequest -Uri http://localhost:9411
    } while (!$up)

    & "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" http://localhost:9411