Skip to content

Documentation of Setting Development Environment for CDN

Azret Kenzhaliev edited this page May 2, 2018 · 4 revisions

Requirement: CDN can be set for LinuxOS and MacOS.

Prerequisites: git, go programming language (https://golang.org), gpg

Install Go Programming Language:

  1. Download the package from https://golang.org/dl/
  2. You can find the installation instructions for each OS in the following link: https://golang.org/doc/install

The next step is to set your GOPATH environment variable:

echo "GOPATH=$HOME/go" >> ~/.bashrc
echo "export GOPATH" >> ~/.bashrc

This will set GOPATH environment variable to your home directory/go. You may want to use different path.

To check your changes open new terminal window and check your go again with the command go env. You must see the line GOPATH=/home/yourUserName/go.

Now, in order to start with the beginnings, you need to download CDN repo to your computer. Follow these steps:

  1. Make sure you have git installed on your system. To install it use sudo apt-get install git
  2. Run go get github.com/subutai-io/cdn

Then, start your CDN server:

  1. Open terminal
  2. Create a directory for CDN database: sudo mkdir /opt/gorjun
  3. Give the CDN directory read/write permissions using this command: sudo chown $USER /opt/gorjun
  4. Switch to CDN code directory: cd $GOPATH/src/github.com/subutai-io/cdn
  5. Start CDN with go run main.go

In order to establish and test your connection with CDN, follow these steps:

  1. Generate your own GPG key if you don't have one

  2. Create new file registration.sh and fill it with the script from the following link: https://github.com/subutai-io/cdn/wiki/Authentication#registration and substitute KEY with your public GPG key (KEY=”your public key”).

  3. Run your bash script

Before you run the script you have to make it executable: chmod +x registration.sh. Then run the script by typing: ./registration.sh (make sure that your CDN server is running in the parallel terminal window).

  1. Check in the logs of server that you have registered on it.

You are all set now. For the next steps follow the aforementioned link: https://github.com/subutai-io/cdn/wiki/Authentication#token.