Set up EPiServer CMS + Commerce in 11 steps

Believe or not, it’s super easy to set up an empty CMS site with Commerce package in version 9. Thanks for the EPi team awesome work.

Prerequisites

  • Visual Studio 2013/2015
  • Windows 8 above (At least, you will need to have localdb installed.)
  • EPiServer CMS VSIX. (You can install within Visual Studio Extension Manager or download from here)

Let’s start

CMS

  1. Use EPiServer VSIX template to set up an empty CMS project.
    12
  2. Install package “EPiServer.Commerce.UI.ManagerIntegration”  via nuget package console.
  3. UPDATE ALL EPiServer packages.
  4. Install package “EPiServer.Commerce”
  5. Run cmdlet “update-epidatabase”  via nuget package console.
  6. Change local database location – Move database to db folders.
    In this demo, I placed the db out side of the CMS directory, and put it in the solution root directory.

    static EPiServerApplication()
    {
    System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + @"\..\db\");
    AppDomain.CurrentDomain.SetData("DataDirectory", dir.FullName);
    }
  7. Login to CMS administrative interface with default username : admin and password : store, then “execute all remaining steps” to run the migration

Commerce

  1. Create an empty Mvc application with Visual Studio (Framework > 4.5.2)
  2. Install the nuget package “Episerver.CommerceManager”.
  3. Run cmdlet update-epidatabase
  4. Show all files and include App_Data,App_GlobalResources,Apps, NotificationTemplates folders and Default,Global.asax files.
  5. Make sure “CommerceManagerLink” in CMS is pointing to commerce manager url.
    <add key="CommerceManagerLink" value="http://localhost:{port}/" />

It’s the end, and that’s all you need to do for the setup. Enjoy your EPi development.

Advertisements

Uploading files will fail after ~7MB when using Windows 2008, over SSL, via a load balancer

One of the client recently encountered this issue with EPiServer CMS.

It’s very frastructing issue, my workmates spent lots of time looking from the EPiServer side, this is our perception as EPiServer had more bugs than Microsoft. However, this time we are wrong 🙂

Thanks for all my workmates hard work.

Hot-fix can be downloaded from here : https://support.microsoft.com/en-us/kb/2634328

CQ5.6.1 (Author + Publish) Docker file – CentOS

FROM centos
MAINTAINER vincent

#Install and set java home
RUN mkdir -p /export/apps/jdk
ADD jdk1.7.0_79 /export/apps/jdk/JDK-1_7_0_79
ENV JAVA_HOME /export/apps/jdk/JDK-1_7_0_79
ENV PATH $PATH:$JAVA_HOME/bin

#Install CQ Author
RUN mkdir -p /export/apps/aem/author
WORKDIR /export/apps/aem/author
ADD cq5-author-p4502.jar /export/apps/aem/author/cq5-author-p4502.jar
ADD license.properties /export/apps/aem/author/license.properties
RUN java -jar cq5-author-p4502.jar -unpack -v

#Now start Publish Instance
RUN mkdir -p /export/apps/aem/publish
WORKDIR /export/apps/aem/publish
ADD cq5-author-p4502.jar /export/apps/aem/publish/cq5-publish-p4503.jar
ADD license.properties /export/apps/aem/publish/license.properties
RUN java -jar cq5-publish-p4503.jar -unpack -v

#Set up all CQ ENV
ENV CQ_FOREGROUND y
ENV CQ_VERBOSE y
ENV CQ_NOBROWSER y
ENV CQ_RUNMODE “author,publish”
ENV CQ_JVM_OPTS “-server -Xmx1524M -Xms512M -XX:MaxPermSize=512M”

RUN yum install -y epel-release && \
yum install -y supervisor && \
yum clean all
EXPOSE 80 443 4502 4503
# supervisor is needed to run multiple process in same docker image
RUN echo “[supervisord]” > /etc/supervisord.conf && \
echo “nodaemon=true” >> /etc/supervisord.conf && \
echo “” >> /etc/supervisord.conf && \
echo “[program:aem_author]” >> /etc/supervisord.conf && \
echo “startsecs = 0” >> /etc/supervisord.conf && \
echo “autorestart = false” >> /etc/supervisord.conf && \
echo “command=/export/apps/aem/author/crx-quickstart/bin/start” >> /etc/supervisord.conf && \
echo “” >> /etc/supervisord.conf && \
echo “[program:aem_publish]” >> /etc/supervisord.conf && \
echo “startsecs = 0” >> /etc/supervisord.conf && \
echo “autorestart = false” >> /etc/supervisord.conf && \
echo “command=/export/apps/aem/publish/crx-quickstart/bin/start” >> /etc/supervisord.conf
CMD [“/usr/bin/supervisord”]

Docker useful command list

# check docker process is running

docker ps
# List all container

docker ps -a

# stop docker running process

docker stop <containerid>

# delete container

docker rm <containerid>

# delete image
docker rmi <imageid>
# build image
docker build –tag=”cq:5.6″ .

# run docker container
docker run -d -t -i -p 4502:4502 -p 4503:4503 cq:5.6

# shell into the vm
docker exec -i -t <containerid> bash
# get docker external ip address
boot2docker cfg

======================================================================================================================================================
/usr/bin/./supervisord -c /etc/supervisord.conf

# search error from error.log file, ignore case
grep ‘error’ error.log -i
#
netstat -anp tcp | grep 3000

Mongo DB Shell Command – Create Database

  1. Connect to shell by running mongo
  2. To create a database, enter “Use <database_name>”  command in the shell. (The command will create a new database, if it doesn’t exist, otherwise it will return the existing database)
  3. You need to insert at least one document to make it display in the db list command. Enter “db.<document_name>.insert({name:”test”})” command to create the first document.

Ref:

http://www.tutorialspoint.com/mongodb/mongodb_create_database.htm

CQ Clientlibs debug tips

Clientlibs

Debug clientlibs

Append ?debugClientLibs=true to write out single file and CTRL+SHIFT+U gives you tim­ing info.

Where are the gen­er­ated files stored in CQ?

They are in /var/clientlibs

When devel­op­ing I want to have sin­gle file ref­er­ences in my HTML

Enable the debug-option in the HTML Library Manager

How can I use cache-busting and clientlibs?

You can enable the hash­ing of the url via ‘ver­sioned clientlibs’.

To see a “final View” of your test page without to publish: wcmmode=disabled

http://localhost:4502/cf#/content/geometrixx/folder/test.html?wcmmode=disabled