-
Notifications
You must be signed in to change notification settings - Fork 32
Docker Setup Guide
Getting started with Octo is quicker with docker.
Install docker as mentioned at Docker installation guide. This should install the docker
and docker-machine
utilities.
We have setup a compose file which will configure octo analytics framework in just few commands. Make sure you have docker and docker-compose installed on your machine. For mac we use docker-machine.
In this guide we will build entire octo stack i.e.: apihandler, apiconsumer, recurring-jobs, dashboard with all its dependencies which is cassandra, kafka & KONG. See the main wiki for more information on version dependency.
We assume that you are running docker in a single host.
Clone the octo.ai repo:
$ git clone git@github.com:octoai/octo.ai.git
Notice we have one central config file config.yml
and kong_config.yml
whcih will be used by docker for building all containers. In case you are running dependency (kafka, cassandra & KONG) on some other docker host/machine, replace their ip's else leave all config as it is.
Run this command:
$ docker-compose up -d
If you are running this for first time it may take some time.
This will bring up all container except Kong. We will setup KONG later.
run the following command
$ docker-compose run apihandler octocore-admin init /apps/config
loading from file: /apps/config/kong_config.yml
loading from file: /apps/config/config.yml
Created keyspace octo_development
$ docker-compose run apihandler octocore-admin migrate /apps/config
loading from file: lib/octocore/config/config.yml
loading from file: lib/octocore/config/search/index/user.yml
loading from file: lib/octocore/config/config/config.yml
loading from file: lib/octocore/config/config/kong_config.yml
loading from file: lib/octocore/config/search/index/user.yml
Synchronized schema for Octo::ContactUs
Synchronized schema for Octo::Enterprise
Synchronized schema for Octo::ApiEvent
Synchronized schema for Octo::ApiHit
Synchronized schema for Octo::ApiTrack
.............................................................
At this point we have successfully launched and configured containers and db.
Launch KONG and link it to either already running cassandra db container(octoai_octo_cassandra_1) or launch a seperate one. In this guide we use only one cassandra db container.
$ docker run -d --name octo_kong -e "DATABASE=cassandra" --link octoai_octo_cassandra_1:cassandra -p 8000:8000 / -p 8001:8001 tushardwivedi/kong:v1
Check in browser with docker-machine's ip:8001
(Mac) or 127.0.0.1:8001
(Linux)
Create KONG config:
$ docker-compose run apihandler /apps/bin/create_kong_config.rb /apps/config
Loading from Config file: /apps/config/kong_config.yml
Loading from Config file: /apps/config/config.yml
I, [2016-08-13T15:49:10.573661 #1] INFO -- Octo: Octo booting up.
I, [2016-08-13T15:49:10.580461 #1] INFO -- Octo: I'm connected now.
I, [2016-08-13T15:49:10.587639 #1] INFO -- Octo: Setting callbacks.
I, [2016-08-13T15:49:10.603813 #1] INFO -- Octo: {"data"=>[], "total"=>0}
I, [2016-08-13T15:49:10.675412 #1] INFO -- Octo: {"upstream_url"=>"http://192.168.99.100:9001/events", "strip_request_path"=>true, "request_path"=>"/events", "id"=>"e23bef14-968f-460c-80f1-2562b9a2e868", "created_at"=>1471103350000, "preserve_host"=>false, "name"=>"events"}
I, [2016-08-13T15:49:10.743031 #1] INFO -- Octo: {"upstream_url"=>"http://192.168.99.100:9001/update_push_token", "strip_request_path"=>true, "request_path"=>"/update_push_token", "id"=>"0c1a6d7d-e514-4c2f-ae3b-09f01c188f98", "created_at"=>1471103350000, "preserve_host"=>false, "name"=>"UpdatePushToken"}
I, [2016-08-13T15:49:10.750406 #1] INFO -- Octo: Attempting to create new enterprise with name: Jaobng......................................