Kademi Self Hosting

Blank 7/12/2021 09:22 - 7/12/2021 09:22
Developers

Kademi Self Hosting Instructions

In this article, we are going to see how we can use the docker image to setup Kademi server.

 

Prerequisites:

  1. EC2 Instance with docker installed

  2. Postgresql Database

  3. S3 Bucket

 

Files provided:

You will be provided with a below list of files 

config:

  • addonApps.xml
  • cache.ccf
  • cookie.keys.txt
  • database.xml
  • env.xml
  • log4j.properties
  • log4j.xml
  • mime-types.properties
  • spliffy-env.properties
  • kademi.properties

app_config:

  • email.properties

Docker Image:

  • fetch-docker-image.sh

Docker compose:

  • docker-compose.yml

 

Configurations:

 

The three important files that you need to look at are cookie.keys.txt, kademi.properties and spliffy-env.properties.

 

  1. cookie.keys.txt: This file contains the hashing and encryption key. You can specify your own key for encryption and hashing
  2. kademi.properties: To get the kademi bootstrap process to download required files, you need to update the “distApiKey” property in the kademi.properties file with the provided api key by kademi.
  3. spliffy-env.properties: This file contains the configuration of your postgresql database, elasticsearch and other aws related configurations. Instructions are given inside this file.

If you are using aws (kademi-aws), then pelase update below required properties in spliffy-env.properties file

AWS required properties:

aws.enabled=true
aws.keyid=< your aws key >
aws.secret=< your aws secret for above key >
aws.discovery.bucket=< s3 bucket name for cache discovery
aws.s3.permBlobCacheBucket=
aws.region=< your aws region >
aws.avconv.name=< your aws bucket prefix for aws video conversion >

AWS Simple Email Service

aws.ses.region=
aws.ses.topic=
aws.ses.queue=

Required for AWS Certificate Manager

aws.acm.enabled=true

 

Downloading Docker Image:

Steps to load and run the docker image

You can use the script file “fetch-docker-image.sh” to download the docker image, you need to pass an API key as a parameter to this file. API key will be provided to you by Kademi.

Kademi docker image will be downloaded and loaded into your docker engine.

 

 

Creating Folders:

Below are the important folders that you need to create in your server.

Now you need to create folders in your server home directory. You can use the below linux commands.

mkdir -p config
mkdir -p data/blobs
mkdir -p data/content
mkdir -p server-mon
mkdir -p logs

 

  1. config: Copy all the configuration files provided to this folder. Once the kademi bootstrap process starts, there will be a libs folder created inside this “config” folder. The libs folder contains all the required jar files to run kademi server.

  2. data: This is a folder which contains the blobs and content of the client. This folder can be large in size based on the clients data. 

  3. server-mon: contains details about server usage and its running threads

  4. logs: contains kademi access logs

 

After we get all the above said requirements setup, it's time to run the docker image. We can keep the above folder as volumes to use by our docker container.

Running the docker image:

You can use the provided “docker-compose.yml” file to run the docker image. This will automatically boot the Kademi server and you will be able to access the kademi on port 8080.

Video instrutions for running docker image:

 

Once the docker image starts running, you need to publish marketplace (apps, libs and themes) to your running server. 

For publishing marketplace apps, we need to clone "kademi-dev" repo from github and need to download a "ksync3.jar"

 

Steps to publish marketplace apps:

  1. Download "ksync3.jar" file from https://docs.kademi.co/ksync/ksync3.jar
  2. Clone the repo from https://github.com/Kademi/kademi-dev.git
  3. Now change directory to "~/kademi-dev/src/main/marketplace" and run below commands
  4. java -jar ~/ksync3.jar -command login -url  -user admin
    
    The above command is to login to ksync, it will ask you for a password enter your password or enter a default password, here I am using admin user. if you have different users, you can enter your userid
  5. java -jar ~/ksync3.jar -command publish -url http://13.211.136.17:8080/ -user admin
    
    The above command is to publish apps and libs to your server. 
    when you execute above command, it will ask you for which apps to be published as show in below screenshot
  6. undefinedEnter "*" to publish all the marketplace app


    For more information about KSync, please read https://docs.kademi.co/blogs/docs-kb/developing-with-ksync/ article



 

Enabling admin apps:

After publishing the apps, now you need to enable the admin apps. For this, we are going to use Kademi CLI. 

  • Login (SSH) to your server
  • Check if you can able to access Kademi CLI using below command
    curl -d "cmd=help" -X POST http://localhost:9090/
    
  • You will get below output when executing above command
    undefined

    Now to enable "admin apps" you need use command "enableAdminApps" execute below command
  • curl -d "cmd=enableAdminApps" -d "user=admin" -X POST http://localhost:9090/
    
    It will load all the admin apps and gives you below output
    undefined

    Once you load the apps, you will be able to access your admin account and start working with kademi