forked from kaparora/continuous-delivery-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding the three pipleine projects for Dev, test and Prod
- Loading branch information
Kapil Arora
authored and
Kapil Arora
committed
Dec 27, 2015
1 parent
17880f7
commit 898bb0f
Showing
23 changed files
with
255 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/bash | ||
docker-compose stop | ||
yes | docker-compose rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
HOST=192.168.53.24 | ||
VOLUME=mysql_data_prod | ||
MOUNT_AT=/mnt/mysql_data_prod | ||
PASSWORD=netapp01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#! /bin/bash | ||
|
||
PORT=9494 | ||
|
||
echo "Staring application with docker compose" | ||
docker-compose build | ||
docker-compose up -d | ||
echo "Sleeping for 20 seconds for web service and sc agent to start" | ||
sleep 20s | ||
echo "calling the webservice to see if it is active and returns http code 200" | ||
#curl -s --head --request GET http://localhost:9292/locandtweet/netapp | grep "200 OK" > /dev/null | ||
httpCode=`curl -sL -w "%{http_code}\\n" "http://10.65.57.126:$PORT/table/employees" -o /dev/null` | ||
echo "Http code returned: $httpCode" | ||
if [ $httpCode == 200 ] | ||
then | ||
echo "deployment success" | ||
exit 0 | ||
else | ||
echo "deployment failed" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ruby_web_prod: | ||
image: 10.65.57.126:5000/ruby-mysql-web:0.0.1-SNAPSHOT | ||
ports: | ||
- "9494:9494" | ||
links: | ||
- mysql_db_prod:mysql_host | ||
mysql_db_prod: | ||
build: mysql-image | ||
volumes: | ||
- /mnt/mysql_data_prod:/var/lib/mysql | ||
- /software/snapcreator/scAgent4.1.2:/etc/netapp/snapcreator/scAgent4.1.2 | ||
environment: | ||
MYSQL_ROOT_PASSWORD: netapp01 | ||
SCAGENT_HOME: /etc/netapp/snapcreator/scAgent4.1.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#! /bin/bash | ||
source database.config | ||
MYSQL_HOST=`docker inspect --format '{{ .NetworkSettings.IPAddress }}' rubymysqlwebprod_mysql_db_prod_1` | ||
git clone https://github.com/datacharmer/test_db.git | ||
cd test_db | ||
mysql -h $MYSQL_HOST --user=root --password=$PASSWORD < employees.sql | ||
cd .. | ||
rm -rf test_db | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
if [ "$(id -u)" != "0" ]; then | ||
echo "This script must be run as root" 1>&2 | ||
exit 1 | ||
fi | ||
echo "Reading config...." | ||
source database.config | ||
echo "HOST: $HOST" | ||
echo "VOLUME: $VOLUME" | ||
echo "MOUNT_AT: $MOUNT_AT" | ||
echo "creating $MOUNT_AT dir if not exist already" | ||
mkdir -p $MOUNT_AT | ||
echo "trying Umount volume" | ||
umount $MOUNT_AT | ||
echo "Mounting volume $HOST:/$VOLUME at location $MOUNT_AT" | ||
mount -t nfs $HOST:/$VOLUME $MOUNT_AT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM mysql:latest | ||
RUN apt-get update | ||
RUN apt-get install -y openjdk-7-jre-headless | ||
COPY new-entry-point.sh /new-entry-point.sh | ||
ENTRYPOINT ["/new-entry-point.sh"] | ||
CMD ["mysqld"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#! /bin/bash | ||
echo "running sc agent " | ||
/etc/netapp/snapcreator/scAgent4.1.2/bin/scAgent start | ||
echo "running old entrypoint with args" | ||
/entrypoint.sh "$@" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#! /bin/bash | ||
docker-compose stop | ||
yes | docker-compose rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
HOST=192.168.53.24 | ||
VOLUME=mysql_data_test | ||
MOUNT_AT=/mnt/mysql_data_test | ||
PASSWORD=netapp01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
ruby_web: | ||
image: 10.65.57.126:5000/ruby-mysql-web:0.0.1-SNAPSHOT | ||
environment: | ||
PORT: 9393 | ||
ports: | ||
- "9393:9393" | ||
links: | ||
- mysql_db:mysql_host | ||
mysql_db: | ||
image: mysql:latest | ||
volumes: | ||
- /mnt/mysql_data_test:/var/lib/mysql | ||
environment: | ||
MYSQL_ROOT_PASSWORD: netapp01 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#! /bin/bash | ||
|
||
DOCKER_REPO=10.65.57.126:5000/ruby-twitter-api | ||
TAG=0.0.1-SNAPSHOT | ||
CONTAINER_NAME=hello-world-app-test | ||
TEST_PORT=9393 | ||
|
||
echo "Staring application with docker compose" | ||
docker-compose up -d | ||
echo "Sleeping for 10 seconds for web service to start" | ||
sleep 10s | ||
echo "calling the webservice to see if it is active and returns http code 200" | ||
#curl -s --head --request GET http://localhost:9292/locandtweet/netapp | grep "200 OK" > /dev/null | ||
httpCode=`curl -sL -w "%{http_code}\\n" "http://10.65.57.126:$TEST_PORT/table/employees" -o /dev/null` | ||
echo "Http code returned: $httpCode" | ||
if [ $httpCode == 200 ] | ||
then | ||
echo "test passed!" | ||
exit 0 | ||
else | ||
echo "test failed" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
if [ "$(id -u)" != "0" ]; then | ||
echo "This script must be run as root" 1>&2 | ||
exit 1 | ||
fi | ||
echo "Reading config...." | ||
source database.config | ||
echo "HOST: $HOST" | ||
echo "VOLUME: $VOLUME" | ||
echo "MOUNT_AT: $MOUNT_AT" | ||
echo "creating $MOUNT_AT dir if not exist already" | ||
mkdir -p $MOUNT_AT | ||
echo "trying Umount volume" | ||
umount $MOUNT_AT | ||
echo "Mounting volume $HOST:/$VOLUME at location $MOUNT_AT" | ||
mount -t nfs $HOST:/$VOLUME $MOUNT_AT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
if [ "$(id -u)" != "0" ]; then | ||
echo "This script must be run as root" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
|
||
echo "Reading config...." | ||
source database.config | ||
echo "VOLUME: $VOLUME" | ||
echo "MOUNT_AT: $MOUNT_AT" | ||
echo "Umount volume" | ||
umount $MOUNT_AT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM ubuntu | ||
RUN apt-get update | ||
RUN apt-get install -y curl | ||
RUN apt-get install -y ruby | ||
RUN apt-get install -y ruby-dev | ||
RUN apt-get install -y rubygems-integration | ||
RUN apt-get install -y libmysqlclient-dev | ||
RUN gem install bundler | ||
COPY src/* /etc/app/ | ||
RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 | ||
RUN \curl -sSL https://get.rvm.io | bash -s stable | ||
RUN /usr/local/rvm/bin/rvm requirements | ||
RUN cd /etc/app && bundle install | ||
ENV PORT 9494 | ||
WORKDIR /etc/app | ||
#CMD ["bundle", "exec", "rackup", "-p", "$PORT", "-o", "0.0.0.0", "config.ru"] | ||
CMD bundle exec rackup -p "$PORT" -o 0.0.0.0 config.ru |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#! /bin/bash | ||
|
||
DOCKER_REPO=10.65.57.126:5000/ruby-mysql-web | ||
TAG=0.0.1-SNAPSHOT | ||
|
||
docker build -t $DOCKER_REPO:$TAG . | ||
docker push $DOCKER_REPO:$TAG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'https://rubygems.org' | ||
gem 'rack' | ||
gem 'sinatra' | ||
gem "sinatra-cross_origin" | ||
gem 'json' | ||
gem 'mysql2json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
json (1.7.7) | ||
mysql2 (0.3.20) | ||
mysql2json (0.0.4) | ||
json (~> 1.7.7) | ||
mysql2 (~> 0.3.11) | ||
rack (1.6.4) | ||
rack-protection (1.5.3) | ||
rack | ||
sinatra (1.4.6) | ||
rack (~> 1.4) | ||
rack-protection (~> 1.4) | ||
tilt (>= 1.3, < 3) | ||
sinatra-cross_origin (0.3.2) | ||
tilt (2.0.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
json | ||
mysql2json | ||
rack | ||
sinatra | ||
sinatra-cross_origin | ||
|
||
BUNDLED WITH | ||
1.11.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require 'sinatra' | ||
require 'sinatra/cross_origin' | ||
require 'json' | ||
require 'mysql2' | ||
require 'mysql2json' | ||
|
||
configure do | ||
enable :cross_origin | ||
end | ||
|
||
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE | ||
|
||
helpers do | ||
def getTable(table_name) | ||
client = Mysql2::Client.new(:host => "mysql_host", :username => "root", :password => "netapp01", :database => 'employees') | ||
begin | ||
result = Mysql2json.query("SELECT * FROM #{table_name} limit 200", client) | ||
rescue Exception=>e | ||
puts "Error: #{e}" | ||
return "Error: #{e}" | ||
else | ||
return result | ||
end | ||
end | ||
|
||
end | ||
|
||
|
||
get '/table/:name' do | ||
content_type :json | ||
getTable(params['name']) | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
require 'rubygems' | ||
require 'bundler' | ||
|
||
Bundler.require | ||
|
||
require './app.rb' | ||
|
||
run Sinatra::Application |