README file for KDDart deployment using ansible on RedHat 7 based distribution
==============================================================================
This document provides a basic explanation on how to run a Ansible playbook script to deploy KDDart DAL in RedHat 7 based distribution. It also lists the basic requirements to run the Ansible playbook script. This deployment script has been tested on Centos 7 and Scientific Linux 7.

The main Ansible playbook script is kddart_dal_v2_5_0_server_deployment_centos7_from_file.yml in this directory.

Basic Requirements
------------------

1. Number of machines: At least two GNU/Linux machines are required.
 - One staging machine; and
 - One target machine.
 The staging machine is where kddart_dal_v2_5_0_server_deployment_centos7_from_github.yml is run.
 In the YML, there are lot of Ansible instructions and shell commands.
 When the YML is executed by ansible-playbook command, the instructions and shell commands in this YML will be executed in the target machine(s).

2. Staging machine: Requires Ansible version 2.1 or higher.

3. Target machine: Requires:

   * SSH connectivity in which root user in the staging machine ssh to the root user in target machine with password via ssh authorized keys.

   * HTTP access to the Internet to download the required packages and DAL code from github.com.

4. Operating System on target machine: The target machine requires:

   * CentOS 7 or Scientific Linux 7

   * Software package selection: Minimum or Compute Node

Step-by-step Instructions
-------------------------

The following instructions will deploy DAL for testing:

1. Install CentOS 7 or Scientific Linux 7 on the target machine:

   * Turn on network

   * Specify the root password.

2. Make sure there is network connectivity between the staging machine and the target machine.

3. Install Ansible 2.1 or higher on the staging machine.

4. Generate root SSH public/private key on the staging machine.

5. Copy the root public key on the staging machine to the root user in target machine by using ssh-copy-id command.
For example: ssh-copy-id root@target_machine_ip_address.

6. Test the SSH without password from root user on the staging machine to root user on the target machine.

7. In /etc/ansible/hosts file on the staging machine, define:

[kddartserver]
x.x.x.x

and replace x.x.x.x with the IP address of the target machine

8. Run ansible-playbook kddart_dal_v2_5_0_server_deployment_centos7_from_file.yml

9. Login as root to the target machine and execute /root/KDDArT-DAL-v2.5.0/other/run_create_dbs.sh

10. Restart target machine. It must be done before proceeding to the next instruction due SELinux.

11. Check services on the target machine:

    * Check MySQL service command: systemctl status mysqld
    * Check PostgreSQL service command: systemctl status postgresql-9.5
    * Check MonetDB service: ps aux | grep 'monetdbd' if there are two processes matched, MonetDB service is running.

12. As root on the target machine, run:

perl -w /root/KDDArT-DAL-v2.5.0/other/dal_access_test.pl "http://kddart.example.com/dal" admin kddartadmin 0

13. As root on the target machine, run:

    * cd /root/KDDArT-DAL-v2.5.0/other/whitebox_test_cases/TestSuite

    * While in the TestSuite directory, run:
      perl -w kddart_dal_test.pl 2 xml/add_data_no_vcol/test_order_all.txt

14. Deploy KDManage - please follow KDManage ansible deployment instructions in a separate package.

Note: Once all installation has been satisfied, in order to to clean up the data generated by running test cases in the instruction 13 and load a demo database, you need to run:

    * /root/KDDArT-DAL-v2.5.0/other/run_create_demo_dbs.sh
