# Introduction

Treelets is an application for dependency-based extraction and exploration of phraseology.

# Learning Outcomes

By the end of this tutorial you will

- Have a configured local Treelets web application on one machine
- Learned how to understand and configure Treelets Docker configuration including api, database, angular, nginx etc.
- Search Indexed data in Your application

Any issues with this tutorial should be reported to the contact[at]pelcra.pl list.

# Table of Contents

- 1 Introduction
- 2 Learning Outcomes
- 3 Table of Contents
- 4 Requirements
- 5 Install Treelets on Ubuntu
  - 5.1 Install Docker
  - 5.2 Setup Treelets from a binary distribution
  - 5.3 Run Docker
- 6 Install Treelets on Windows 10 Home
  - 6.1 Install Docker Toolbox
  - 6.2 Setup Treelets from a binary distribution
  - 6.3 Run Docker
- 8 Verify your Treelets installation
- 8 Docker useful commands

# Requirements

- Unix environment, Windows 10 Home or Professional, Mac OS environment
- Docker Desktop for Windows 10 Professional or Mac OS
- Docker Toolbox on Windows 10 Home

# Install Treelets on Ubuntu

## Install Docker on Ubuntu

- # run in Linux bash install commands:

    sudo apt install docker
    sudo apt install docker-compose
    sudo apt install postgresql-client-common

- # check docker version commands:

    sudo docker -v
    sudo docker-compose -v

## Setup Treelets from a binary distribution

- Download treelets-docker application for Ubuntu Link to Treelets Docker application for Ubuntu!
- Unzip
- Run bash and go inside treelets-docker catalog

## Run Docker

- # run in Linux bash commands:

    # Build
    sudo docker-compose build

    # Running
    sudo docker-compose up -d

    # View instances
    sudo docker-compose ps

# Install Treelets on Windows 10 Home

## Install Docker Toolbox

- Install the application using the tutorial: Docker Toolbox on Windows

## Setup Treelets from a binary distribution

- Download treelets-docker application for Windows 10 Home Link to Treelets Docker application for Windows 10 Home!
- Unzip
- Run Docker Quickstart Terminal from Desktop and go inside treelets-docker catalog

## Run Docker

- # run in Docker Quickstart Terminal command and note ip, it will be used to open application

    # get default ip for application
    docker-machine ip default

- # using windows explorer go to the file treelets-docker\app\webapp\assets\config\api.json

    # change webSocketHost address to docker-machine ip default eg.
    "webSocketHost": "ws://192.168.99.100:4221/notifications"

- # run install commands:

    # create a volume
    docker volume create postgres_database

    # check volumes
    docker volume ls

    # Build
    docker-compose build

    # Running
    docker-compose up -d

    # View instances
    docker-compose ps

# Verify your Treelets installation

- Open Your Favourite Browser and type: http://localhost:8080
- On Windows 10 Home will be on ip default: http://{docker-machine ip default}:8080 eg. http://192.168.99.100:8080

# Docker useful commands

    # View instances with container id
    sudo docker ps

    # Logs
    sudo docker-compose logs

    # Monitoring
    sudo docker stats

    # Connect sql command
    sudo docker exec -it {container_id} sh
    psql -U treelets treelets
    select * from info.config;
    select version();
    \q
    exit

    # Stop
    sudo docker-compose stop

    # Remove
    sudo docker-compose down