Skip to content
Shubhendu edited this page Aug 30, 2016 · 58 revisions

Development Setup

#####PREREQUISITES#

  • Fedora 22+ (or latest RHEL)
  • golang
  • MongoDB
  • OpenLDAP
  • Saltstack
  • git, hg
  • python, python-devel, python-cpopen

#####Setup #

######Disable firewalld and reboot the system #

systemctl stop firewalld    
systemctl disable firewalld   
reboot

This is required, since the open ports required to run the necessary services are not yet finalized and documented. Once it's done, this section will change to debrief & list necessary open ports per services.

######Install Dependencies #

This script should resolve all the required dependencies to set up the environment. Please report if something is missing:

dnf install python python-devel python-cpopen golang git hg salt-master openldap-devel mongodb mongodb-server

######Set the environment variables #

GOPATH The GOPATH environment variable specifies the location of your workspace. Set the GOPATH to the root of the GO source code directory. For more information checkout the below links:

export GOPATH=$HOME/<workspace directory name>  

GOROOT You need to set this only if you've custom installed Go tools/binaries to a different location (default is /usr/lib/golang and the environment is preset when installed with package manager).

export GOROOT=/usr/lib/golang  

PATH For convenience, add the workspace's bin subdirectory to your PATH

export PATH=$PATH:$GOPATH/bin  

######Start salt master #

systemctl enable salt-master  
systemctl start salt-master

######Configure MongoDB #

Enable and start MongoDB:

systemctl enable mongod   
systemctl start mongod  

Connect to MongoDB:

mongo

Execute the below commands on the 'mongo' shell:

// Create DB
use skyring

// Create User:  
db.createUser({
  "user" : "admin",
  "pwd": "admin",
  "roles" : [ "readWrite", "dbAdmin", "userAdmin" ]
})

######Get the source # Create the directory to download the source code:

mkdir -p $GOPATH/src/github.com/skyrings  
cd $GOPATH/src/github.com/skyrings

#######Download from GerritHub # You need to have a GerritHub account. Use either of the following commands after replacing the username with your username:

  • Over SSH: git clone ssh://[email protected]:29418/skyrings/skyring
  • Over HTTP: git clone https://[email protected]/a/skyrings/skyring
  • Anonymous: git clone https://review.gerrithub.io/skyrings/skyring

N.B: With anonymous cloning, you will not be able to submit patches or push changes.

Alternatively for testing purposes, you can download sources using 'go get' command:

go get github.com/skyrings/skyring

######Building the source #

Change to source code directory:

cd $GOPATH/src/github.com/skyrings/skyring

Build the source:

make

Once the build is done the executable will placed in $GOPATH/bin

######Configuration Files and Misc items #

Copy the salt template files:

cd $GOPATH/src/github.com/skyrings/skyring  
mkdir -p /srv/salt/   
cp -f salt/* /srv/salt/

Create the configuration directory and copy the config files:

cd $GOPATH/src/github.com/skyrings/skyring/conf/sample/  
mkdir -p /etc/skyring   
mkdir -p /etc/skyring/providers.d   
cp skyring.conf.sample /etc/skyring/skyring.conf   
cp authentication.conf.sample /etc/skyring/authentication.conf   
cp providers.d/ceph.conf.sample /etc/skyring/providers.d/ceph.conf    
cp providers.d/gluster.conf.sample /etc/skyring/providers.d/gluster.conf   

Create logging directory:

mkdir -p /var/log/skyring   
chmod 777 /var/log/skyring  

######Configuring the server #

Update the value of field config.host in /etc/skyring/skyring.conf as below -

{
    "config": {
        "host":"&lt;<b>IP of the node</b>&gt;",
        "httpPort":8080,
        "supportedVersions":[1]
    },
    .....
}

######Configuring the salt reactor(s) #

Create a file /etc/salt/master.d/skyring.conf with below content

reactor:

  - 'salt/minion/*/start':
       - /srv/salt/push_event.sls

  - 'skyring/*':
       - /srv/salt/push_event.sls

  - 'calamari/*':
       - /srv/salt/push_event.sls

  - 'salt/presence/change':
       - /srv/salt/push_event.sls

  - 'salt/auth':
       - /srv/salt/push_event.sls

  - 'salt/job/*':
       - /srv/salt/push_event.sls

presence_events: True

keep_jobs: 1

Re-start the salt-master after the changes using command - systemctl restart salt-master

######Starting the server #

To start the server:

PYTHONPATH=~/.local/lib/python2.7/site-packages skyring