Table of Contents

Server API Installation

Introduction

The first step to install MibServerApi is to prepare the database that will be used by the server. This can be easily done through the MibMigrator tool currently available inside the MibDlls folder.

Then one just need to extract the MibServerApi package into IIS “www” folder, convert its folder to an app through IIS manager and add various config files and options. The following sessions will explain this procedure in depth.

Prerequisites

  1. IIS installed with MVC .NET support
  2. Knowledge about MibConfigs
  3. MibPackages and MibDlls downloaded
  4. Database available to bootstrap
  5. Running instance of MibAuthorizationServer

Migration: Generating Database

Every migration can be run through a neat utility provided by MIB, the MibMigrator which is available in the MibDlls package. All possible migrations are also provided in the same package to ease its use.

Three different configuration files are required:

  1. MibLogConfig
  2. MibDatabaseConfig
  3. MibConfigurableObjectConfig

Where the third one can just be a dummy configuration file as no mapping is required. Configuration files samples can be seen in the appendix.

It is necessary to bootstrap every database used by MIB projects by running at least the MibClient2 migration before the main migration. Here is a sample CLI command with parameters to do just that (change paths for your environment):

> C:\MibDlls\MibMigrator\Migrator\mibmigrator.exe -assembly="C:\MibDlls\MibMigrator\MibClient2Migrations\MibClient2.MibDatabaseMigrations.dll" -configPath="C:\TestData\auth_migration\config"

After this migration, MibServerApi migration must be run with the same configuration files, and a sample command can be seen here:

> C:\MibDlls\MibMigrator\Migrator\mibmigrator.exe -assembly="C:\MibDlls\MibMigrator\MibServerApiMigrations\MibServer2.Api.MibDatabaseMigrations.dll" -⁠configPath="C:\TestData\api_migration\config"

There are also two other optional migrations that can be run, MibServerObjects.MibDatabaseMigrations and MibContentCriteria.MibDatabaseMigrations. The first migration create tables related to media files, images and others, while the second migration create tables related to ContentCriteria. More information can be seen in the document “Mib Migration Guide”.

Installing and enabling MibServerApi

After Migration:

  1. If not downloaded, download MibPackages as we need the package file MibServer2Api.zip
  2. Extract it to “C:\inetpub\wwwroot%NAME%”, where %NAME can be any chosen name, such as MibApi. In the remainder of this documentation %NAME% will be assumed as MibApi.
  3. Open “IIS Manager”, search for the folder in which the package was extracted, right click it and the chose “Convert to app”.

Before effectively being able to use the server, it must be configured by creating a “config” folder inside “C:\inetpub\wwwroot\MibApi”, in which the configuration files will reside. Sample files can be seen in the appendix.

Minimally required configuration files (depends on your requirements):

  1. MibLogConfig
  2. MibAuthorizationClientConfig
  3. MibDatabaseConfig

Additional recommended configuration files:

  1. MibServerMediaConfig

It is also important to correctly configure MibAuthorizationServer to correctly accept the ServerApi that we are enabling. For each ServerApi that uses the authorization server one should add a new row to MibAuthorization’s API_CLIENTS table:

INSERT INTO API_CLIENTS (NAME, OWNER, ACTIVE, ALLOWS_REFRESH_TOKEN, ALLOWED_ORIGINS, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET, OAUTH_CLIENT_TYPE, CONFIGURABLE_PERMISSIONS_URL) VALUES ('NewClient', 1, 1, 1, 1, 'newClient','mY53Cr37aCc3s5K3y', 3, 'http://api/server/url/configurablepermissions') 

Appendix: Sample configuration files

Most important fields are marked in bold.

MinAuthorizationClientConfig.mibconfig

<?xml version="1.0" encoding="utf-8" ?>
<mibConfig>
  <default>
    <serverUrl>http://mibauthorizationserver/url/</serverUrl>
   <clientId>newClient</clientId>
  </default>
</mibConfig>

MibDatabaseConfig.mibconfig

<?xml version="1.0" encoding="utf-8" ?>
<mibConfig>
  <default>
    <type>serverType</type>
    <server>serverAddress</server>
    <database>databaseName</database>
    <username>databaseUsername</username>
    <password>databasePassword</password>
  </default>
</mibConfig>

MibServerMediaConfig.mibconfig

<?xml version="1.0" encoding="utf-8" ?>
<mibConfig>
  <storageArea0>
    <active>true</active>
    <path>C:\Path\Sample\Uploads</path
    <storageType></storageType> *the supported values are: amazon,azure,smb or disk  
    <awsRegion></awsRegion> *only if storage type is AWS  
    <isAwsPublic></isAwsPublic> *only if storage type is AWS  
    <subfolder></subfolder> *only if storage type is AWS or AZURE, and in the Mib 6.0 version  
  </storageArea0>
  <temp>
    <active>true</active>
    <path>C:\Path\Sample\Uploads\Temp</path>
  </temp>
</mibConfig>

MibLogConfig.mibconfig

<?xml version="1.0" encoding="utf-8" ?>
<mibConfig>
  <default>
    <mibTrace>true</mibTrace>
    <fileLogTag>MibLog</fileLogTag>
    <fileLogPath>logFilePath</fileLogPath>
    <eventViewerLog>Application</eventViewerLog>
    <eventViewerSource>applicationName</eventViewerSource>
    <databaseAlias>default</databaseAlias>
    <databaseTable>MibLogs</databaseTable>
    <databaseField>Message</databaseField>
  </default>
  <verbose>
    <mibTrace>true</mibTrace>
    <trace>true</trace>
    <file>true</file>
    <database>false</database>
    <eventViewer>false</eventViewer>
    <custom>false</custom>
  </verbose>
  <log>
    <mibTrace>true</mibTrace>
    <trace>true</trace>
    <file>true</file>
    <database>false</database>
    <eventViewer>false</eventViewer>
    <custom>false</custom>
  </log>
  <errorLog>
    <mibTrace>true</mibTrace>
    <trace>true</trace>
    <file>true</file>
    <database>false</database>
    <eventViewer>false</eventViewer>
    <custom>false</custom>
  </errorLog>
  <exception>
    <mibTrace>true</mibTrace>
    <trace>true</trace>
    <file>true</file>
    <database>false</database>
    <eventViewer>false</eventViewer>
    <custom>false</custom>
  </exception>
</mibConfig>

MibFileManagementMicroServiceClientConfig

only from version MIB 6.0

For more details check click here