Skip to content

Setup and run graphspace docker image

Aditya Bharadwaj edited this page Sep 19, 2018 · 6 revisions

Running Docker

The reason we have a docker image is to make it easier for you to run GraphSpace on your local machine. Follow these steps to run the graphspace docker image on your machine:

  1. Clone the GraphSpace repo, branch e#264-docker-diff.
  2. Open docker-compose.yml file and plug in values in command.
    command: bash -c "./docker_command.sh <github username> <github repo url> <github branch name>"
    
  3. Run docker
    sudo docker-compose up
    
    Note: This might show a NoBrokersAvailable kafka error, stop the execution using Ctrl+C and run the command again.
  4. Go to localhost:8000 in your browser to access GraphSpace.

Upgrade Docker

Please do not try this if you do not know what you are doing

Learn more about editing docker images read this.

Installed Packages
  • Python v2.7.13
  • Node
  • Bower
  • Java v8
  • PostgreSQL
  • Elasticsearch v5.5.1
  • Kafka v10.2
  • Redis
  • Supervisord

All the terminal commands can be found in the docker_command.sh file in the docker image. Current content of the file is as follows:

#!/bin/bash
echo "Starting postgres"
service postgresql start

echo "Starting zookeeper"
service zookeeper start

echo "Sleeping for 5 seconds"
sleep 5

echo "Starting kafka"
nohup ~/kafka/bin/kafka-server-start.sh ~/kafka/config/server.properties > ~/kafka/kafka.log 2>&1 &

echo "Sleeping for 2 seconds"
sleep 2

echo "Starting redis"
redis-server /etc/redis/redis.conf

echo "Starting elasticsearch"
su - elasticsearch -c '/elasticsearch/bin/elasticsearch -d'

echo "Removing GraphSpace"
rm -rf GraphSpace

echo "Cloning GraphSpace"
git config --global user.email $1
git clone -b $3 $2

cd /GraphSpace

echo "Creating logs directory"
mkdir logs
> debug.log

echo "Create virtual env"
virtualenv venv

echo "Activate venv"
. venv/bin/activate

echo "Install dependency"
pip install -r requirements.txt
bower install --allow-root

cp graphspace/settings/docker.py graphspace/settings/production.py

cd /
echo "Changing permissions"
chmod -R 777 /GraphSpace

./GraphSpace/docker_command.sh

You can download and install any packages that can run on Ubuntu 16.04. After setting up the package remember to add commands to start the service in the docker_command.sh file (sample given above). You will have to commit the changes you made in the docker container and push it to docker hub. Read on how to do this here.

Clone this wiki locally