Thursday, February 23, 2017
Wednesday, January 11, 2017
ElasticSearch , Logstash , Kibana and Filebeat with Docker
One solution which works ( at least for me ) is by using ElasticSearch , Logstash , Kibana or also called ELK , to capture and parse your logs whilst having a tool like Filebeat which actually monitors your logs from Docker containers ( or not ) and send updates across to the ELK server.
I have created a github repository with my solution using ELK + Filebeat and Docker , have a look at the guide around how to setup :
https://github.com/javedgit/Docker-ELK
Monday, January 09, 2017
Install docker in 2 commands on Ubuntu
1.
wget -qO- https://get.docker.com/ | sh 2. sudo usermod -aG docker $(whoami)
Then logout and login back to your terminal .
Dodo written by
Unknown
at
3:21 PM
0
dodo shouts
Category: Docker
Friday, January 06, 2017
Automatic Install of Maven with Jenkins and use within Pipeline
This is what you need to do to perform this :
- Install the following 2 plugins on your Jenkins 2x instance ( if not already preseent :
- Config File Provider - https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin
- Pipeline Maven Plugin - https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Maven+Plugin
- Restart your Jenkins such as the Plugins can take effect
- Define your settings.xml file within Jenkins > Manage Jenkins > Managed Files
- Click on Add a new Config
- choose Global Maven settings
- choose a valid id name e.g GlobalMavenSettingsForXXX
- copy paste the settings.xml of your project on next page
- Note the settings.xml should allow you to get your plugins and dependencies from your repositories
- Define your Maven tool within the menu Jenkins > Manage Jenkins > Global Tool Configuration page
- Click on Maven Installations
- Specify name for your maven
- Specify maven home directory e.g /usr/local/maven-3.2.5
- Check the Automatic install option
- Choose Install from Apache e.g maven-3.2.5
- Make sure that you Jenkins has access to install Maven within your maven home directory by executing the following command (on your slave ):
- sudo chmod -R ugo+rw /usr/local/maven-3.2.5
- Now you can use maven in your Jenkins pipeline using a command such as :
Dodo written by
Unknown
at
6:13 PM
0
dodo shouts
Thursday, January 05, 2017
Publish Docker Image to Amazon ECR
Now in my case I wanted to be able to push an image to my private Registry within the context of a Jenkins build .
So we will need to do the following :
- Configure AWS credentials on build machine
- Configure Amazon ECR Docker Registry
- Modify our Jenkins pipeline to perform a push
1. install the awscli which allows you then to configure your aws account login info on your env , this is done using :
sudo apt install awscli
2. next we do the aws configuration using the following command, ( see AWS CLI official guide ):
aws configure
Note that the Secret Access Key ID is generated only once , so you need to keep it somewhere safe or regenerate a new one .
To get the 2 keys you would need to login to your AWS console and go to :
Wednesday, January 04, 2017
Linking Containers together using --link and Docker Compose
- there is a need for the tomcat instance to connect to an Oracle instance .
- Both of these run in docker containers
- I consider the Oracle instance to be a shared docker service , meaning it will be used by other services than the tomcat instance and that I do not want to tear it down as regularly as the tomcat docker instance
I would first need to build an image of my webapp with tomcat6 using a command similar below :
docker build -t tomcat6-atlas .
Then typically i use the following commands to run my docker image for tomcat:
docker run -it --rm --link atlas_oracle12 --name tomcat6-atlas-server -p 8888:8080 tomcat6-atlas
This tells my docker that I want to :
- run an image of tomcat6-atlas as a container
- the alias name of the container should be tomcat6-atlas-server using the --name flag
- the port 8080 on the container should be mapped to 8888 on the host using -p flag
- and that i should link my atlas_oracle12 container which is already started ( check this blog entry ) to this tomcat6-atlas-server container that am firing using the --link flag .
- It specifies the name of the project as atlas_tomcat6
- It assumes that in the same location as the docker-compose.yml file there is a Dockerfile to perform the build
- It knows thats the name and tag of the image is 'tomcat6-atlas' and 'latest' respectively
- With the network_mode:bridge value it understands that instead of creating a seperate network for the docker compose triggered instance of the container that it needs to use the default network of the host bridge , that is it will be able to connect to atlas_oracle12 ( container which was not started by docker compose )
- Containers on which atlas_tomcat6 has a dependency on but triggered seperately are defined with external-links tag e.g atlas_oracle12
- ports tag specifies the port mappings
docker-compose build
If you want to run this in the bakground then you an use the -d flag :
Dodo written by
Unknown
at
11:28 AM
0
dodo shouts
Portainer for visualizing your docker infra
Below is a screenshot showing the features within shipyard:
You can see that it has information around containers , images , nodes and registries and that pretty much stops there.
In comparison Portainer provides much more level of details :
The thing that interested the most was the Networks section as I was trying to figure out how to connect a docker-compose tiggered container with a shared container which was not launched through docker-compose.
Installation Portainer :
- You need as pre-requiste to have docker and docker swarm installed
- Official installation instructions are here
- Then just execute the following command to install the Portainer container ,which will be exposed on port 9000 :
docker run -d -p 9000:9000 portainer/portainer
Note that am assuming that your running on ubuntu /linux
To run portainer on a local instance of the docker engine use the following command :
docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
Endpoints
You an have multiple endpoints configured such as you are monitoring diferent remote instances :
- make sure that inbound ports are opened on your remote endpoints (e.g 2375 )
- if you run Portainer locally to your docker containers , there is a recommended setting to be changed or just provide the public ip addr. of the docker host
Dodo written by
Unknown
at
10:53 AM
0
dodo shouts
Thursday, December 29, 2016
Install Shipyard to monitor Docker Containers
There are 2 ways to install shipyard both involve (without any surprise) to make use of docker containers.
I have tried the manual install as it gives me more flexibility . The link to the installation is found here . This comes as a number of docker images to run .
The key thing to bear in mind is that wherever you see <IP-OF-HOST> you need to add the actual public ip address of the docker host .
Below are some examples of where the swarm manager and agent ask for the <IP_OF_HOST>
docker run \ -ti \ -d \ --restart=always \ --name shipyard-swarm-manager \ swarm:latest \ manage --host tcp://0.0.0.0:3375 etcd://<IP-OF-HOST>:4001
docker run \ -ti \ -d \ --restart=always \ --name shipyard-swarm-agent \ swarm:latest \ join --addr <ip-of-host>:2375 etcd://<ip-of-host>:4001
Do not put localhost as this IP address else you will not be able to view containers on the docker host .
Also you can configure the port on which your shipyard WEB GUI is accessible by changing the port number below highlighted in yelow i.e 7777
docker run \ -ti \ -d \ --restart=always \ --name shipyard-controller \ --link shipyard-rethinkdb:rethinkdb \ --link shipyard-swarm-manager:swarm \ -p 7777:8080 \ shipyard/shipyard:latest \ server \ -d tcp://swarm:3375
Dodo written by
Unknown
at
3:00 PM
0
dodo shouts
Tuesday, December 27, 2016
Oracle 12c setup using Docker on Ubuntu
Pre-requisites
First things first we need to setup docker and this is done by following the docker docs :
https://docs.docker.com/engine/installation/linux/ubuntulinux/
Installing Oracle Image
Now that you have a working docker install you need to :
- Download the image for Oracle 12c
- Open port 8080 and 1541 such as you get access to the web Application express interface and are able to connect to the Oracle instance via SQLPlus respectively
- Map a source directory on your docker host with a directory within the Docker Oracle container should you want to import dumps for example
- atlas_oracle12 - this is the name I have given to my container , it can be any valid name e.g foo
- /home/ubuntu/atlaslocaldump - this directory on my docker host which i want to make visible within the oracle docker container ( so basically the source )
- /u01/app/oracle/admin/xe/dpdump/ - this is the directory on the docker container from which i will be able to access the files within /home/ubuntu/atlaslocaldump
- sath89/oracle-12c - this is the name of the image for the Oracle-12c install , you can get more information around this here on docker hub .
- Also it takes around 10-15 mins depending on your machine to initialise the Oracle instance so you might not just be able connect straight to SQLPlus .. give it some time to initialise
Removing the Oracle Container
For some reasons you might want to remove the oracle container in our case it is named atlas_oracle12 ( change this below to the name you gave your container instance )
To do that you need to stop the contained using command :
docker stop atlas_oracle12
Then remove the container directly using :
docker rm atlas_oracle12
You can check that the container is removed by doing a :
docker ps
Dodo written by
Unknown
at
5:13 PM
0
dodo shouts
Sunday, November 13, 2016
Truffle and Ethereum - call vs transactions
What's the difference between a call and a transaction you say ?
- Well a call is free ( does not cost any gas ) , it is readonly and will return a value
- whilst a transaction costs gas , it usually persists something and does not return anything
Please read the "Making a transaction" and "Making a call" section in the offical lib:
https://truffle.readthedocs.io/en/latest/getting_started/contracts/
Say for example in your app.js of your truffle app you have a fictionious setComment and getComment function ( to persist and retrieve comments respectively ) this is how they could look like :
===Extract app.js====================
function setComment(){
// Assuming your contract is called MyContract
var meta = MyContract.deployed();
//Taking a comment field from page to save
var comment = document.getElementById("comment").value;
// Note that the setComment should exist in your MyContract
meta.setComment(comment,{from: account}).then(function() {
setStatus( "Tried to save Comment:" +comment);
}).catch(function(e) {
console.log(e);
setStatus("Error saving comment .. see log."+ e);
});
}
function getComment(){
var meta = MyContract.deployed();
// notice that in the readonly getComment method that after method name a .call is used
// this is what differentiates a call from a transaction
meta.getComment.call({from: account}).then(function(value) {
setStatus( "Comment:" +value);
}).catch(function(e) {
console.log(e);
setStatus("Error retrieving comment .. see log."+ e);
});
}
=============================
Dodo written by
Unknown
at
10:03 PM
2
dodo shouts
Category: Blockchain
Wednesday, November 02, 2016
Ethereum Blockchain Simple Contract Example
Solidity is the language in which the contracts are writing its pretty simple enough but lets make some small steps against which then we can build more complex scenarios.
Assumptions :
- We are deploying to an Ubuntu env. , although the commands could be adapted to whichever environment your using
- We are starting with a fresh Ubuntu with nothing on it
- Ubuntu version used is 16.04 LTS
- We are going to use a development framework such as Truffle to help us in quickly testing our smart contract
- We are not going to connect to either the live or test 'morden' Ethereum network instead we are going to run a test environment locally, this is done via the ethereumjs-testrpc
- Ubuntu server in my case is a t2.medium server 2 cpu with 4GB RAM at least
Dodo written by
Unknown
at
5:38 PM
1 dodo shouts
Category: Blockchain
Monday, October 24, 2016
First Steps with Blockchain
Dodo written by
Unknown
at
6:24 PM
0
dodo shouts
Category: Blockchain
Monday, September 19, 2016
Installing mvnw on Ubuntu
The mvnw tool which is wrapper on top of maven needs to be installed by following the example set at https://github.com/vdemeester/mvnw .
First need to checkout the tool :
git clone git://github.com/vdemeester/mvnw.git ~/.mvnw
Then you need to add the following environment variable within .bashrc:
nano ~/.bashrc
Command:
export PATH="$HOME/.mvnw/bin:$PATH"
then enable it :
. ~/.bashrc
Dodo written by
Unknown
at
7:51 PM
0
dodo shouts
Install Maven 3.3.9 on ubuntu
This article assumes that you are installing on Ubuntu the version 3.3.9 of maven ( currently latest version as am writing entry ):
wget http://apache.mirrors.lucidnetworks.net/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
sudo mkdir -p /usr/local/apache-maven
sudo mv apache-maven-3.3.9-bin.tar.gz /usr/local/apache-maven
cd /usr/local/apache-maven
sudo tar -xzvf apache-maven-3.3.9-bin.tar.gz
Once this is done add to you environment variables by editing .bashrc:
nano ~/.bashrc
export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
export M2=$M2_HOME/bin
export MAVEN_OPTS="-Xms256m -Xmx512m"
export PATH=$M2:$PATH
then apply it by executing :
. ~/.bashrc
Dodo written by
Unknown
at
7:51 PM
0
dodo shouts
Sunday, August 21, 2016
Skytravel Agency
Airfare Promo to Singapore/Kuala Lumpur ***Rs 17,800***
4 Nights in Kuala Lumpur (3 star hotel) ***Rs 24,000***
4 Nights in Kuala Lumpur (4 star hotel) ***Rs 26,000***
4 Nights in KL, 2 Nights in Singapore ***Rs 31,500***
3N in KL, 2N in Singapore, 3N in Bangkok ***Rs 45,000***
3N in KL, 2N in Singapore, 3N in Bali ***Rs 43,500***
Dodo written by
Unknown
at
9:20 PM
0
dodo shouts
Sunday, August 07, 2016
Apollo Chennai Hospital
I need to already make you aware that am neither working for Apollo nor have medical expertise it is just my own personal experience which am relating in this post so do take this into consideration please.
Note also that there are many Apollo hospitals in Chennai which specialise in terms of :
1. Cancer
2. Pregnancy
3. Heart & Lungs
4. etc...
I went to the main Hospital on Greams Lane which is a more general type of Hospital so the pictures and details will relate to this hospital although the other hospitals are pretty close by.
Pre-Requisites
Before going to Chennai you need to make sure that you have the following :
- Already contacted Apollo Hospitals we used to contact via the email address: apollohospitals.india@gmail.com and their website address is chennai.apollohospitals.com
- You need to have already scanned all your medical reports and sent to the representative of the International Patients Division
- They usually respond either the same day or the very next day , I also received a phone call once I had my phone number within my email signature
- In parallel check properly with local Doctor whether the patient actually needs to be treated abroad, this is very important else you will just spend a lot of money for nothing when you could have had the treatment or part of the treatment within your own country
- Get approval and a written report summary of the condition of the patient from your local doctor and approval that the patient is fit to travel and that he/she should seek medical treatment abroad .
- You need to then get the appropriate Medical visa for the patient and the attendees , this is normally a fast enough process , you can get it within 3-5 days in Mauritius , you will probably be asked to fill an online visa form ( https://indianvisaonline.gov.in/visa/index.html )
- Once you get the approval and report from your Local Doctor and your medical visa you can now tell Apollo around your trip so you will need to choose your room type ( Private rooms are comfy enough ) and when to pick you up at the airport.
- When asking for pickup from Apollo do mention the number of passengers and lugage such as the right type of taxi can come pick you up that is either a car or SUV
- A flight on Monday's to Chennai from Mauritius with a technical stop at Bengalaru ( you stay in the plane for 1 hour in Bengalaru then you travel to Chennai )
- A flight back to Mauritius every Tuesdays from Chennai
- Fastest flight would be around 6 hours something
The picture above gives you an idea in terms of flight from Air Mauritius as well as costs although there are also flights from Emirates but which are more costly.
Be careful when booking your flights because there are flights which involve transit in Mumbai or Delhi with some lengthy transit times . Depending on the state of the patient I would recommend to choose the direct flight and plan well in advance ( if possible ).
In my case we took business class because of the extra room space but mind you that does increase the cost of the travel a lot .
I always take Atom Travels for my business trips so I asked them to book for my parents and myself for this medical trip , Henna from Atom was very helpful and quickly sorted out all issues in terms of flight bookings for us . So if your in Mauritius try Atom Travels for your booking , they are a responsive and very professional travels agency.
Wheel Chair
If you need a wheel chair please make sure that you have it as a remark within your Ticket and do ask for one at the departure counter in Mauritius when your check-in.
Normally a staff will come with a wheel chair and breeze you through all the queues and counters rapidly such as you can board your plain with minimal issues.
Basically your like a VIP if your going with somebody in a wheel chair, so do expect some stares from other passengers as why on earth you have passed in front of them in queques and check points.
Money
- Before travelling already ask for the approximate cost of the treatment for which you are going with Apollo , they will provide you with indicative cost range in USD
- Max out as much as possible your credit cards
- Ensure you have some amount of money with you in USD
- Try to enable your e-banking account such as you can make transfers from the internet directly
- Inform your bank that you will be outside of the country from what date to what date such as they allow the processing of your transactions whilst being abroad
- Install a currency convertor on your phone , this is always very useful
- Bed for the patient ( typical hospital beds )
- A cot for one medical attendant
- A TV screen with lots of Indian serials
- A private bathroom/washroom
- Air conditioning
- The hotel has opened its door since start of 2016 so its quite new at the point of writing of this blog .
- The service is very good and the staff were exceptionally helpful towards all the demands I had .
- The WIFI is decent enough but dont expect awesome connection speeds here
- The Buffet at Rs800 INR was absolutely great with a mix of different south indian dishes which I wouldn't have discovered on my own along with Biryani every single night
- Room prices were at Rs 4, 200 INR per night .
- There is also a small Gym on the 11th floor
The picture above shows the front the Apollo main hospital at Greams Lane off Greams road. It is a kinda of attractive location so not really gloomy as most hospitals are .
Once you go past the gates then you need to head to the Sindoori Block , this is where the international patients need to register themselves. This Sindoori Block also has a small Bistrot restaurant ,although food is not that great , your better off buying food outside.
- The patient is constantly being checked in terms of medicine that needs to be taken or blood samples that needs to be taken
- Doctors usually come at a predefined time , you can ask to them as many questions as you might have and discuss about your concerns , they typically provide as much information as possible
- Apollo Hospital has all facilities to do blood tests , image scans , MRI , etc.. within the same building or in Apollo hospitals nearby so you
- All reports are either received the same day or the next day which is not something possible for all analysis in Mauritius , so you save in terms of time
- A nutritionist is assigned to the patient that comes almost daily to check what the patient should be eating as advised by the doctor
- The room and wash room are kept very clean by the cleaners
- there is also WIFI in the hospital which you can use to consult mails or use WhatsApp .
- Nurses are very patient and friendly , at least the ones we had to deal with
- There are representatives of the hospital that check Quality Assurance in terms of service which is being offered and constant try to get feedback whether positive or negative
- You can order food for the attendant directly to your room
- Better WIFI connection because at times it wasn't that great and WIFI is important to keep in contact with folks back home
- Time to order food for attendants is very fixed past 12:30
- Faster checkout procedure for preparing bill
- Stairways to the attendants instead of relying on elevators that most of the time are crowded
- European / American channels in the Private rooms
- Better air conditioning in the rooms , ours had a problem with changing the temperature
- Mosquito nets for the patient
- You need to provide a deposit at the start of the treatment
- You can regularly monitor the expenses by calling the billing department , the number is available next to the phone
- You can pay for expenses all throughout the day the service runs 24/7
- There are two offices for paying the biggest one runs 24/7 and is next to Sindoori Block , and there is a second smaller / faster office which is on the main block itself
- Doctor expenses are available only on checkout day
- It takes half a day for preparing the full expense bill including doctor expense
- The SBM debit card works for payment
- Apollo also takes foreign currency , so you can pay in USD dollars.
Here I must say I was a bit disappointed because we had to wait a long time to get our final bill although we mentioned well in advance that we wanted to have everything settled asap when we went to the big billing department we also had a very unpleasant staff talking to us but his other colleagues were much more courteous
Transport in Chennai
- There is a rickshaw stand in front of the main gate as you can see below . If you want to go anywhere always keep a copy of the address on piece of paper or as a photo explain to them where you wanna go and if they don't understand ask to call the place where you need to head to . For example in once instance they didnt understand where the IBIS hotel was located so they called and got the directions.
- You also have the excellent option of using OLA cabs , but for that you need to get an Indian SIM card. Once you have that and data on the card then all you need is to register on either the Android or iOS version of the app , enable your GPS and book a cab to take you to your destination. It is a very efficient service if you are scared taking the rickshaw.
Do not expect a lot from inside the terminal once you passed the very serious military guards that will do all kind of excessive checks . The terminal seems old and not well kept , it is really nothing compared to Delhi's luxurious airport terminal .
Business lounge is also not great at all and seems more like a cafeteria.
So once this is done all you need is wait for your flight and fly back home!
Dodo written by
Unknown
at
12:46 PM
0
dodo shouts
Tuesday, April 12, 2016
MySQL setup on Ubuntu 14.04
- First do an update :
sudo apt-get update
- Then execute the install :
sudo apt-get install mysql-server
You will be prompted to enter at some point the password , so do that on the screen.
You can check whether the service is running using the following command :
sudo netstat -tap | grep mysql
To create a database or execute any command you need to access mysql prompt and provide password:
mysql -u root -p
Source:
https://www.digitalocean.com/community/tutorials/a-basic-mysql-tutorial
https://help.ubuntu.com/lts/serverguide/mysql.html
Dodo written by
Unknown
at
4:49 PM
0
dodo shouts
Friday, April 08, 2016
Tomcat 8 Docker install on Ubuntu 14.04
Docker Install
You need to first follow the instructions for setting up docker :
https://docs.docker.com/engine/installation/linux/ubuntulinux/
Tomcat Install
- identify your Ubuntu instance in my case I wanted to run it with JDK 8 so first navigate to Docker Hub :
https://hub.docker.com/_/tomcat/
- Then choose the correct docker image version :
8.0.33-jre88.0.33-jre8This will download the Tomcat 8 with JDK 8 image and start it on port 8080 .
You will be able to access your tomcat instance http://public_id_address:8080
Docker Commands
- To check which docker containers are running execute the command
sudo docker ps
You should see something like this:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
40586996cebe tomcat:8.0.33-jre8 "catalina.sh run" 31 minutes ago Up 31 minutes 0.0.0.0:8080->8080/tcp jolly_almeida
- To stop the docker container choose the docker container id , which you find when doing docker ps :
sudo docker stop 40586996cebe
- To restart the tomcat conatiner re-execute:
sudo docker run -it --rm -p 8080:8080 tomcat:
8.0.33-jre8
Dodo written by
Unknown
at
3:35 PM
0
dodo shouts