Skip to content

Instantly share code, notes, and snippets.

@iwada
Last active April 21, 2016 10:25
Show Gist options
  • Save iwada/d9cb9f42ff4d25c165abf77941113e26 to your computer and use it in GitHub Desktop.
Save iwada/d9cb9f42ff4d25c165abf77941113e26 to your computer and use it in GitHub Desktop.
Installing cgradmin - CGRateS Admin Web Interface

Installing cgradmin - CGRateS Admin Web Interface

At the End, you should have this:::

Image of Running cgradmin

cgradmin is an administrative interface for CGRateS. At the end of this tutorial, you should have cgradmin running at http://localhost:8080. An Assumption is made that Debian would be used.

We would be needing the following Softwares installed:

1. Golang(>=1.4)
2. MySQL
3. Redis
4. CGRateS
5. cgradmin
  1. Installing Golang(>=1.4) To install Golang, Please follow this [link] (http://www.hostingadvice.com/how-to/install-golang-on-ubuntu/). We would be using Golang 1.4

  2. Installing MySQL(Skip if you already have MySQL Installed)

    To install MySQL::

    sudo apt-get install mysql-server

    During the installation, MySQL will ask you to set a root password. Please take note of this as you would be needing it latter.

  3. Installing Redis(Skip if you already have Redis Installed)

    To install Redis::

    sudo apt-get install redis-server

  4. Installing CGRateS From the CGRateS documentation,

    On the server you want to install CGRateS, simply execute the following commands:

    cd /etc/apt/sources.list.d/
    
    wget -O - http://apt.itsyscom.com/conf/cgrates.gpg.key|apt-key add -
    
    wget http://apt.itsyscom.com/conf/cgrates.apt.list
    
    apt-get update
    
    apt-get install cgrates
    

Now, We've got some postinstall setup to do::

cd /usr/share/cgrates/storage/mysql/

From within this directory, run

./setup_cgr_db.sh root YOUR_PASSWORD localhost

You should now have CGRateS along with it's components installed.

5 - Installing cgradmin Now, let's install cgradmin

go get github.com/cgrates/cgradmin

This would fetch cgradmin to your $GOPATH

Let's Start cgr-engine(this was installed along side CGRateS) with some sample config file, NOTE, You would need to leave this terminal running...

cgr-engine -config_dir /usr/share/cgrates/conf/samples/cgradmin/

Let's start up cgradmin web app

cd $GOPATH/src/github.com/cgrates/cgradmin

Within this directory, run

go run main.go

You should see something along the lines of

2016/04/15 22:37:19.646027 Starting Goji on [::]:8080

Now Open up your browser and visit http://localhost:8080

Use root as username and testus as password.

There you have cgradmin running, HOWEVER, you would observe that the Webapp would not be properly styled. You would need to install some static assets for it.

Let's get that done.

6 - Let's Update the static Resources needed by cgradmin First, you would need to install NodeJS and npm -

Please visit https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions

Once that is done successfully,

cd $GOPATH/src/github.com/cgrates/cgradmin/static

From within this directory, run

bower install

Restart your Webapp, and you should have a properly styled cgradmin Webapp.

That's It. Quite Easy!

Credit goes to @rif for his ascicasts at - https://asciinema.org/a/17066

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment