KiGG Deployment Guide Part 1

Related topics

Introduction

This document is concerned with how to deploy KiGG (Clean Installation) on your server or local development machine using SQL Server 2005 or later. Assuming full trust is supported. Before you go further you'll need to download the deployment package for KiGG v2.5 here
Extract the deployment package (not the source code) on your local drive and follow the below sections with steps for initial deployment.
The document will cover the following:
  • Creating the database
  • Configuring KiGG to use Entity Framework or LINQ to SQL
  • Configuring KiGG Connection String
  • Configuring KiGG Default -initial- Users

This part of deployment guide will not go through how to configure external services such as PageGlimpse, twitter, reCaptcha etc... These will be covered on another part.

Attachements: KiGG 2.5 Sample Configuration (web.config, unity.ef.config & unity.l2s.config)

Database installation for SQL Server

This section will show how to create a KiGG database on SQL Server based on KiGG database script available with the deployment package.

Physical database creation

  1. Under "DatabaseScripts\SQLServer" folder you'll find a SQL script file "Create.sql". Open this file with your SQL Server Management Studio. By default this file will create a database with name KiGG. Feel free to change this name by editing the first line on the script "CREATE DATABASE [KiGG]". You'll just need to change "KiGG" to something else e.g. "KiGGCleanInstall"
  2. Run the script by clicking on the execute button.

The above steps simply showed how to create a clean empty KiGG database on SQL Server 2005 or later.

Inserting pre-defined categories

Because we just created an empty database, we will need to initialize it with few mandatory records which are KiGG Categories. KiGG currently dosen't support management Categories. So we will need to create them manually by T-SQL script.
  1. Under DatabaseScripts\SQLServer"" folder open "Data.sql" file. This file contains the pre-defined categories. If you c hanged your database name on the above section, make sure to do that same on this file before your execute it. On first line "Use [KiGG]" you can change it to be "Use [YOUR DATABASE NAME]".
  2. Run the script by clicking execute button.

The above steps showed how to create manually using T-SQL pre-defined categories. Feel free to change the fine according to your needs. This is definitely what everyone would do.

Creating KiGG virtual directory or Web Site under your IIS

Actually I won't go further into this point, I'll assume you create a virtual directory under existing default site of your local IIS or create a special IIS web site for KiGG. Personally while writing this guide I create a special web site with specific port under my local IIS 7.0. Here what exactly I did
  1. Create a root folder under your "Inetpub", call it "KiGGRoot" for example.
  2. Under your deployment package folder, copy the content of "Web" Folder -not the web folder itself- and paste it under the "KiGGRoot" folder we defined in step 1
  3. Open your IIS Manager and create new Web Site, Specify the location of Content Directory to be your "KiGGRoot" folder created in step 1. Specify a port and that is it.

Basic KiGG Configurations

In this section we will see how to configure KiGG to use Entity Framework or LINQ to SQL as well as configuring KiGG databsae connection string name map it to EF or LINQ to SQL unity configuration.

Configuring KiGG to Entity Framework or LINQ to SQL

  1. Open the web.config file and fine unity element.
  2. If you wish to use Entity Framework make sure that the configSource attribute value is "unity.ef.config". But if you wish to go with LINQ to SQL then the value should be "unity.l2s.config".
Unity mapping for Entity Framework unity configuration. For detail deep information about this configuration read KiGG Entity Framework Configuration.
<unity configSource="unity.ef.config"/>
Unity mapping for LINQ to SQL unity configuration
<unity configSource="unity.l2s.config"/>

Configuring Connection String

  1. Open the web.config file and fine connectionStrings element.
  2. You'll find 2 entries under connectionStrings element. On for SQL Server with name "KiGGSqlServer" and the other with name "KiGGMySql". We are now only concerned with SQL Server connection string.
  3. Modify KiGGSqlServer connection string entry value attribute. Your final results should be close to this:
<connectionStrings>
    <clear/>
    <add name="KiGGSqlServer"
         connectionString="Data Source=.;Database=KiGG;uid=YOURDATABASEUSERNAME;password=YOURDATABASEPASSWORD;"
         providerName="System.Data.SqlClient"/>
    <add name="KiGGMySql"
         connectionString="server=localhost;user id=root;password=Pa$$w0rd;persist security info=True;database=KiGG"
         providerName="MySql.Data.MySqlClient"/>
</connectionStrings>

Note: You are free to change your connection string name, but make sure you update your unity configuration to map to the new connection string name. Read KiGG Entity Framework Configuration for more details.

Confirming connection string name in "unity.ef.config" (for entity framework) and "unity.l2s.config" (for LINQ to SQL)

In this section we will review the unity configuration to make sure that our connection string name is correctly mapped. This is to avoid any initial exception because of specifying incorrect connection string name in unity configuration.

We will start with Entity Framework Unity Configuration "unity.ef.config" open this file and do the following:
  1. Search for the following string "<type type="IConnectionString" mapTo="ConnectionString">" this is propably would be line 537 in the attached file to this Guide.
  2. Make sure that the connection string name is specified for parameter "name" of the ConnectionString class. It should be something like the below:
<type type="IConnectionString" mapTo="ConnectionString">
  <lifetime type="Singleton"/>
  <typeConfig extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
    <constructor>
      <param name="configuration" parameterType="IConfigurationManager">
        <dependency/>
      </param>
      <param name="_name_" parameterType="System.String">
        <value type="System.String" value="KiGGSqlServer"/> <!--Connection string name specified here-->
      </param>
      <param name="edmFilesPath" parameterType="System.String">
        <value type="System.String" value="|DataDirectory|"/>
      </param>
      <param name="ssdlFileName" parameterType="System.String">
        <value type="System.String" value="DomainObjects.SqlServer"/>
      </param>
    </constructor>
  </typeConfig>
</type>

Note: Current deployment package has mistake that the connection string specified in the mapping is KiGGDatabase and not KiGGSqlServer.

Now we will need to do that same for LINQ to SQL Unity Configuration. Just repeat the above steps but with "unity.l2s.config" file.

Note: You might just do the above steps for single configuration (EF or LINQ to SQL). Just the file you are going to use. I documented both for consistency

Configuring KiGG default users

By default once your run KiGG for the very first time, 3 default user will be created for your. The users are admin, support and bee. These users are configurable. And you can add more default users or change existing ones attributes such as username, password, e-mail and role.

To configure default users on both Entity Framework and LINQ to SQL open related configuration file "unity.ef.config" or "unity.l2s.config" and do the following:
  1. Search for "type="DefaultUser"". You'll fine 3 results by default for the 3 defualt users mentioned above
  2. On each result you can change parapertes for UserName, Password, Email and Role. For example to change admin user password you can change Password parameter value. Below is sample configuration for default users
<type name="admin" type="DefaultUser"> <!--Configuration for Admin User -->
  <lifetime type="Singleton"/>
  <typeConfig 
extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
    <property name="UserName" propertyType="System.String"> <!--UserName parameter -->
      <value type="System.String" value="admin"/>
    </property>
    <property name="Password" propertyType="System.String"> <!--Password parameter -->
      <value type="System.String" value="admin"/> <!--Change this value if you wish -->
    </property>
    <property name="Email" propertyType="System.String"> <!--Email parameter -->
      <value type="System.String" value="admin@YOUR-DOMAIN.com"/>
    </property>
    <property name="Role" propertyType="Roles"> <!--Role Parameter -->
      <value type="Roles" value="Administrator"/> <!--Role Possible Values are (Administrator, Moderator, Bot and User) -->
    </property>
  </typeConfig>
</type>
<type name="support" type="DefaultUser">
  <lifetime type="Singleton"/>
  <typeConfig 
extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
    <property name="UserName" propertyType="System.String">
      <value type="System.String" value="support"/>
    </property>
    <property name="Password" propertyType="System.String">
      <value type="System.String" value="support"/>
    </property>
    <property name="Email" propertyType="System.String">
      <value type="System.String" value="support@YOUR-DOMAIN.com"/>
    </property>
    <property name="Role" propertyType="Roles">
      <value type="Roles" value="Moderator"/>
    </property>
  </typeConfig>
</type>
<type name="bee" type="DefaultUser">
  <lifetime type="Singleton"/>
  <typeConfig 
extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
    <property name="UserName" propertyType="System.String">
      <value type="System.String" value="bee"/>
    </property>
    <property name="Password" propertyType="System.String">
      <value type="System.String" value="iambusy"/>
    </property>
    <property name="Email" propertyType="System.String">
      <value type="System.String" value="bee@YOUR-DOMAIN.com"/>
    </property>
    <property name="Role" propertyType="Roles">
      <value type="Roles" value="Bot"/>
    </property>
  </typeConfig>
</type>

If you wish to add new user just copy one of the above type sections, change type element name attribute and parameter values for UserName, Password, Email and Role, as the following
<type name="testUser" type="DefaultUser">
  <lifetime type="Singleton"/>
  <typeConfig 
extensionType="Microsoft.Practices.Unity.Configuration.TypeInjectionElement, Microsoft.Practices.Unity.Configuration">
    <property name="UserName" propertyType="System.String">
      <value type="System.String" value="testUser"/>
    </property>
    <property name="Password" propertyType="System.String">
      <value type="System.String" value="Pa$$w0rd"/>
    </property>
    <property name="Email" propertyType="System.String">
      <value type="System.String" value="testUser@YOUR-DOMAIN.com"/>
    </property>
    <property name="Role" propertyType="Roles">
      <value type="Roles" value="User"/>
    </property>
  </typeConfig>
</type>

Conclusion

Now after you completed this part, you can now run your KiGG application for first time. A sample configuration files are attached for reference feel free to download
them and use them as base for your KiGG v2.5 configuration.
This part covered what is critical to make your KiGG application run. In next parts we will cover how to go further in KiGG settings and how to configure external services such as twitter, PageGlimpse etc... So stay tuned and we appreciate your patience.

Last edited Sep 15, 2009 at 10:45 AM by mosessaur, version 5

Comments

jah May 10, 2010 at 6:05 PM 
I created a web site following the instructions above, but additionally needed to enable anonymous authentication on the site. Without it, when running the application I was getting a “Story does not exists” HttpException looking for login.aspx and a subsequent 404 on http://localhost:8081/login.aspx?ReturnUrl=%2f.