From a65e20109c3fef1297187d6d370b6dcdfe67c250 Mon Sep 17 00:00:00 2001 From: DanB Date: Wed, 3 Aug 2016 22:31:02 +0200 Subject: [PATCH] Adding osips_training docker file --- data/docker/osips_training/Dockerfile | 54 +++++++++++++++++++++++++++ data/docker/osips_training/README.md | 11 ++++++ data/docker/osips_training/my.cnf | 3 ++ data/docker/osips_training/start.sh | 8 ++++ 4 files changed, 76 insertions(+) create mode 100644 data/docker/osips_training/Dockerfile create mode 100644 data/docker/osips_training/README.md create mode 100644 data/docker/osips_training/my.cnf create mode 100755 data/docker/osips_training/start.sh diff --git a/data/docker/osips_training/Dockerfile b/data/docker/osips_training/Dockerfile new file mode 100644 index 000000000..dcad1ee8a --- /dev/null +++ b/data/docker/osips_training/Dockerfile @@ -0,0 +1,54 @@ +FROM debian:latest +MAINTAINER Radu Fericean, rif@cgrates.org + +# set mysql password +RUN echo 'mysql-server mysql-server/root_password password CGRateS.org' | debconf-set-selections && echo 'mysql-server mysql-server/root_password_again password CGRateS.org' | debconf-set-selections + +# install dependencies +RUN apt-get -y update && apt-get -y install git redis-server mysql-server python-pycurl python-mysqldb sudo wget vim zsh tmux rsyslog ngrep curl + +# add cgrates user +RUN useradd -c CGRateS -d /var/run/cgrates -s /bin/false -r cgrates + +# install golang +RUN wget -qO- https://storage.googleapis.com/golang/go1.6.3.linux-amd64.tar.gz | tar xzf - -C /root/ + +#install glide +RUN GOROOT=/root/go GOPATH=/root/code /root/go/bin/go get github.com/Masterminds/glide + +#install oh-my-zsh +RUN TERM=xterm sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"; exit 0 + +# change shell for tmux +RUN chsh -s /usr/bin/zsh + +# cleanup +RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# create a link to data dir +RUN ln -s /root/code/src/github.com/cgrates/cgrates/data /usr/share/cgrates + +# create link to cgrates dir +RUN ln -s /root/code/src/github.com/cgrates/cgrates /root/cgr + +# setup mysql for CGRateS +RUN cd /usr/share/cgrates/storage/mysql && ./setup_cgr_db.sh root CGRateS.org + + +#env vars +RUN export GOROOT=/root/go; export GOPATH=/root/code; export PATH=$GOROOT/bin:$GOPATH/bin:$PATH + +# build and install cgrates +RUN cd /root/cgr +RUN glide install + +# create cgr-engine and cgr-loader link +RUN ln -s /root/code/bin/cgr-engine /usr/bin/ +RUN ln -s /root/code/bin/cgr-loader /usr/bin/ + + +RUN cd /root/cgr +RUN echo 'export GOROOT=/root/go; export GOPATH=/root/code; export PATH=$GOROOT/bin:$GOPATH/bin:$PATH'>>/root/.zshrc + +# set start command +RUN CMD /root/code/src/github.com/cgrates/cgrates/data/docker/osips_training/start.sh diff --git a/data/docker/osips_training/README.md b/data/docker/osips_training/README.md new file mode 100644 index 000000000..7f0f334ce --- /dev/null +++ b/data/docker/osips_training/README.md @@ -0,0 +1,11 @@ +Docker +======= + +From the project root: + +``` bash +# build the image +docker build -t cgrates data/docker/osips_training +# create the container from the cgrates project root +./data/docker/osips_training/start.sh +``` diff --git a/data/docker/osips_training/my.cnf b/data/docker/osips_training/my.cnf new file mode 100644 index 000000000..254297241 --- /dev/null +++ b/data/docker/osips_training/my.cnf @@ -0,0 +1,3 @@ +[client] +user=root +password=CGRateS.org diff --git a/data/docker/osips_training/start.sh b/data/docker/osips_training/start.sh new file mode 100755 index 000000000..070ef5385 --- /dev/null +++ b/data/docker/osips_training/start.sh @@ -0,0 +1,8 @@ +# edit servers config files +sed -i 's/127.0.0.1/0.0.0.0/g' /etc/redis/redis.conf /etc/mysql/my.cnf + +/etc/init.d/rsyslog start +/etc/init.d/mysql start +/etc/init.d/redis-server start + +DISABLE_AUTO_UPDATE="true" zsh