diff --git a/.gitignore b/.gitignore index 029f8c7de..78ccff556 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ docs/_* bin .idea dean* +data/vagrant/.vagrant diff --git a/data/vagrant/Vagrantfile b/data/vagrant/Vagrantfile new file mode 100644 index 000000000..280c6a8a2 --- /dev/null +++ b/data/vagrant/Vagrantfile @@ -0,0 +1,64 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # All Vagrant configuration is done here. The most common configuration + # options are documented and commented below. For a complete reference, + # please see the online documentation at vagrantup.com. + + # Every Vagrant virtual environment requires a box to build off of. + config.vm.box = "debian74_64" + config.vm.box_url = "https://s3-eu-west-1.amazonaws.com/ffuenf-vagrant-boxes/debian/debian-7.4.0-amd64_virtualbox.box" + config.vm.network :public_network + + + # The url from where the 'config.vm.box' box will be fetched if it + # doesn't already exist on the user's system. + # config.vm.box_url = "http://domain.com/path/to/above.box" + + # Create a forwarded port mapping which allows access to a specific port + # within the machine from a port on the host machine. In the example below, + # accessing "localhost:8080" will access port 80 on the guest machine. + # config.vm.network :forwarded_port, guest: 80, host: 8080 + + # Create a private network, which allows host-only access to the machine + # using a specific IP. + # config.vm.network :private_network, ip: "192.168.33.10" + + # Create a public network, which generally matched to bridged network. + # Bridged networks make the machine appear as another physical device on + # your network. + # config.vm.network :public_network + + # If true, then any SSH connections made will enable agent forwarding. + # Default value: false + # config.ssh.forward_agent = true + + # Share an additional folder to the guest VM. The first argument is + # the path on the host to the actual folder. The second argument is + # the path on the guest to mount the folder. And the optional third + # argument is a set of non-required options. + # config.vm.synced_folder "../data", "/vagrant_data" + + # Provider-specific configuration so you can fine-tune various + # backing providers for Vagrant. These expose provider-specific options. + # Example for VirtualBox: + # + # config.vm.provider :virtualbox do |vb| + # # Don't boot with headless mode + # vb.gui = true + # + # # Use VBoxManage to customize the VM. For example to change memory: + # vb.customize ["modifyvm", :id, "--memory", "1024"] + # end + # + # View the documentation for the provider you're using for more + # information on available options. + config.vm.provision "ansible" do |ansible| + ansible.playbook = "ansible_golang_release.yml" + ansible.verbose = "vvvv" + end +end diff --git a/data/vagrant/ansible_golang_release.yml b/data/vagrant/ansible_golang_release.yml new file mode 100644 index 000000000..429076b86 --- /dev/null +++ b/data/vagrant/ansible_golang_release.yml @@ -0,0 +1,71 @@ +--- + +- hosts: all + user: vagrant + sudo: yes + vars: + $root_db_password: CGRateS.org + + tasks: + - name: install dependency + apt: pkg={{ item }} state=latest + with_items: + - git + - bzr + - redis-server + - mysql-server + - python-pycurl + - python-mysqldb + - mercurial + + - name: add freeswitch gpg key + command: gpg --keyserver pool.sks-keyservers.net --recv-key D76EDC7725E010CF + + - name: add freeswitch apt key + shell: gpg -a --export D76EDC7725E010CF | sudo apt-key add - + + - name: add freeswitch apt repo + apt_repository: repo='deb http://files.freeswitch.org/repo/deb/debian/ wheezy main' state=present + + - name: install freeswitch + apt: pkg={{ item }} update_cache=yes state=latest + with_items: + - freeswitch-meta-vanilla + - freeswitch-mod-json-cdr + + - name: add cgrates apt-key + apt_key: url=http://apt.itsyscom.com/conf/cgrates.gpg.key state=present + + - name: add cgrates repo + apt_repository: repo='deb http://apt.itsyscom.com/debian wheezy main' state=present + + - name: install freeswitch + apt: pkg=cgrates update_cache=yes state=latest + + - name: update mysql root password for all root accounts + mysql_user: login_user=root login_password=$root_db_password name=root host=localhost password=$root_db_password + + - name: setup database tables + shell: chdir=/usr/share/cgrates/storage/mysql ./setup_cgr_db.sh root $root_db_password localhost + +- hosts: all + user: vagrant + + tasks: + - name: get golang + get_url: url=http://go.googlecode.com/files/go1.2.linux-amd64.tar.gz dest=~/go1.2.linux-amd64.tar.gz + + - name: unpack go + command: chdir=~/ tar xvf go1.2.linux-amd64.tar.gz + + - name: delete golang archive + file: path=~/go1.2.linux-amd64.tar.gz state=absent + + - name: copy bashrc + copy: src=bashrc dest=~/.bashrc + + - name: echo + command: echo $GOROOT; echo $GOPATH + + - name: get cgrates + shell: ~/go/bin/go get -u -v github.com/cgrates/cgrates diff --git a/data/vagrant/bashrc b/data/vagrant/bashrc new file mode 100644 index 000000000..f5ce2db65 --- /dev/null +++ b/data/vagrant/bashrc @@ -0,0 +1,115 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +case $- in + *i*) ;; + *) return;; +esac + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +#force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + #alias grep='grep --color=auto' + #alias fgrep='fgrep --color=auto' + #alias egrep='egrep --color=auto' +fi + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +export GOROOT=$HOME/go +export GOPATH=$HOME/gopath + +export PATH=$PATH:$GOROOT/bin:$GOPATH/bin diff --git a/data/vagrant/vagrant_ansible_inventory_default b/data/vagrant/vagrant_ansible_inventory_default new file mode 100644 index 000000000..3a8f94913 --- /dev/null +++ b/data/vagrant/vagrant_ansible_inventory_default @@ -0,0 +1,3 @@ +# Generated by Vagrant + +default ansible_ssh_host=127.0.0.1 ansible_ssh_port=2222