cAdvisor container monitoring

cadvisor

cAdvisor (Container Advisor) provides container users an understanding of the resource usage and performance characteristics of their running containers. It is a running daemon that collects, aggregates, processes, and exports information about running containers. Specifically, for each container it keeps resource isolation parameters, historical resource usage, histograms of complete historical resource usage and network statistics. This data is exported by container and machine-wide.

cAdvisor has native support for Docker containers and should support just about any other container type out of the box. We strive for support accross the board so feel free to open an issue if that is not the case. cAdvisor’s container abstraction is based on lmctfy’s so containers are inherently nested hierarchically.

To quickly tryout cAdvisor on your machine with Docker, we have a Docker image that includes everything you need to get started. You can run a single cAdvisor to monitor the whole machine. Simply run:

sudo docker run \
--volume=/:/rootfs:ro \
--volume=/var/run:/var/run:rw \
--volume=/sys:/sys:ro \
--volume=/var/lib/docker/:/var/lib/docker:ro \
--publish=8080:8080 \
--detach=true \
--name=cadvisor \
google/cadvisor:latest

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook

Starting with Git and Github on ubuntu

github

1 – Install Git
sudo apt-get install git

2 – Create a github account on GITHUB

3 – configure your git on your linux
git config --global user.name "user_name" where user_name is your github login
git config --global user.email "email" where email is your email used on github

Before the next step I will propose you to see our post about using SSH beetwin git and github

Here is the post :GIT GITHUB and SSH

 

4 – Create a local repository
Create a folder in your system. This will serve as a local repository which will later be pushed onto the GitHub website.
Use the following command: git init devops_pm_rep

 

On github you can try to fork an existing project , for example

https://github.com/jjz109/jhipster_example

Connected you can clic on the fork button to add this project to your account

When your github account is ok , you can create a local clone on your computer by using git
On github, on the right you’ll find a https clone url field. Copy the link.
something like  : https://github.com/xxxxxxxx/jhipster_example.git
in a terminal:
git clone https://github.com/xxxxxxxx/jhipster_example.git where xxxxis your user-name
It should do:

Clonage dans 'jhipster_example'...
remote: Counting objects: 6, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
Vérification de la connectivité... fait.

You can now ask git to sync your clone with the original repository (orignal is not your fork but the project you forked)

copy the url to the original project. in the example :
https://github.com/jjz109/jhipster_example.git

in your terminal : go to the repository where you put your git clone

cd $home
ls
cd xxxxxx

when you find your .git
git remote -v will show your repositories

git remote add upstream https://github.com/jjz109/jhipster_example.git
wil add this upstream

Now, you can keep your fork synced with the upstream repository with a few Git commands
Sync a fork of a repository to keep it up-to-date with the upstream repository


git fetch upstream
# remote: Counting objects: 75, done.
# remote: Compressing objects: 100% (53/53), done.
# remote: Total 62 (delta 27), reused 44 (delta 9)
# Unpacking objects: 100% (62/62), done.
# From https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY
# * [new branch] master -> upstream/master

Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master

Check out your fork’s local master branch


$ git checkout master
# Switched to branch 'master'

Merge the changes from upstream/master into your local master branch. This brings your fork’s master branch into sync with the upstream repository, without losing your local changes.
$ git merge upstream/master

Syncing your fork only updates your local copy of the repository. To update your fork on GitHub, you must push your changes.

Pushing to a remote

Use git push to push your local branch to a remote repository.

The git push command takes two arguments:

A remote name, for example, origin
A branch name, for example, master

For example:

git push

As an example, you usually run git push origin master to push your local changes to your online repository.

 

ENJOY !

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook

Jenkins – Configurating Jenkins for Maven

After installing
JENKINS :JENKINS – go on board
MAVEN :STARTING WITH MAVEN

You can configurate Jenkins ‘s maven plugin :

Before, just control your JDK configuration jdk_jenkins

and after set the maven config

maven_jenkins

When it’s done, you must restart jenkins
http://localhost:8080/restart

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook

Starting with Maven

mavenhttps://maven.apache.org

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.

The Project Object Model (POM) describe the project, his dependencies with external module and the order needed to buid it. Maven has native ability as Java code compilation or modulatirty.

Install Maven

$ sudo apt-get install maven

Check the installed maven’s version:
$ mvn -v


Apache Maven 3.0.5
Maven home: /usr/share/maven
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "3.16.0-43-generic", arch: "amd64", family: "unix"

USING MAVEN

A fresh build of a project generating all packaged outputs and the documentation site and deploying it to a repository manager could be done with
$ mvn clean deploy site-deploy

You will find configuration files in
/etc/maven

2 important files : m2.conf settings.xml

The default repository is
~/.m2/repository/

You should creat a directory to share the files used by maven (example with jenkins)
So create /opt/maven-work
and make some change in
setting.xml
$vi /etc/maven/settings.xml

and had this line
/opt/mvn-work

About the MAVEN_HOME :
You must look for /usr/share/maven or /usr/share/maven2
there you ll find :
bin boot conf lib man

If you want to configurate JENKINS with MAVEN : see our post

Just creating the package and installing it in the local repository for re-use from other projects can be done with
$ mvn clean install

This is the most common build invocation for a Maven project.

When not working with a project, and in some other use cases, you might want to invoke a specific task implemented by a part of Maven – this is called a goal of a plugin. E.g.:
$ mvn archetype:generate
or
$ mvn checkstyle:check

There are many different plugins avaiable and they all implement different goals.

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook

Jenkins from scratch – HowTo part 2 – Administrate (first time)

after the Part 1 – Install Jenkins
you should access the home page http://localhost:8080

On the left you’ll find a link administrate jenkins : http://localhost:8080/manage

First step you shoutl discover the manage system page :http://localhost:8080/configure
You’ll find a help button on the right of the fields

The default configuration setting should answer for most of the use case. So don’t play with if you didn’t read the help

THE REAL FUN TOY you must know how to use is the plugin manager : http://localhost:8080/pluginManager/

You will be able : to see, install, update plugin for jenkins

If you prefer to use the CLI, let see how to install plugin :
java -jar jenkins-cli.jar -s http://jenkins:8080/ install-plugin xxxxxxx
where xxxxxxxx is the short name of the plugin you want to install

RESTART after a PLUGIN INSTALLATION
On the local website you’ll find a button to restart after a plugin install
on CLI :
java -jar jenkins-cli.jar -s http://jenkins:8080 safe-restart

If you want a list of available plugins :
PLUGIN LIST FROM JENKINS WEBSITE

SECURITY and ACCESS CONTROL
You can force the users to create an account to connect to jenkins
http://localhost:8080/configureSecurity/

See you on part 3 to create your first JOB

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook

EASY DEPLOY on distelli.com ( FREE PLAN)

This example illustrate some steps to deploy on distelli.com  https://www.distelli.com/

I ve choosen a simple PHP app

First creat an account on distelli.com (a FREE PLAN account for :

  • 2 Servers
  • Unlimited Deployments
  • Unlimited Releases
  • Email Support

After sign in , you will be ask for a fisrt EASY DEPLOY experience

installing the client

curl -sSL https://www.distelli.com/download/cli/setup | sh

copying the app from git

git clone https://github.com/Distelli/PHPUbuntuPSimpleApp.git ~/distelli/sample_apps/PHPUbuntuPSimpleApp && sed -i.orig "s/<username>/xxxxxx/g" ~/distelli/sample_apps/PHPUbuntuPSimpleApp/distelli-manifest.yml && cd ~/distelli/sample_apps/PHPUbuntuPSimpleApp

where xxxxxx is your distelli username

installing the agent on your server

curl -sSL https://www.distelli.com/download/agent/install | sh

deploying the app

distelli deploy -m "My fisrt sample deployment" -e PHPUbuntuPSimpleAppEnv -y

 

After that you will be able to manage your server and app on distelli.com

showing : standard output of your server , …statuts, …


 

To stop the agent :

sudo -i

dagent stop

And logout from client :

distelli logout

TRY IT and ENJOY

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook

Docker – Part 2 – No Diving – Just Dockerizing

The force :
Docker allows you to run applications inside containers.
Running an application inside a container takes a single command:
$ docker run

A first exercice will

launch a bash commande line  (/bin/echo ‘hello dockerworld’)
on a linux ubuntu image (ubuntu:14.04)
inside our in a container (docker run)


$ docker run ubuntu:14.04 /bin/echo 'Hello world'

During this execution, Docker will look for the ubuntu:14.04 image in your Docker host.

If Docker doesn’t find it, he looks for it on the public part of  Docker Hub and download it in your Docker host.

To learn more about docker images : see the post about Managing Docker Images

As soon as the command echo ended, the docker container stop.

A second exercice will

launch a bash session

let the container alive until you quit the bash

$ docker run -t -i ubuntu:14.04 /bin/bash

you can try somme commands : pwd, ls, ..etc

until you exscute exit commande line , you will use the session on the docker container

 

A third exercice will

launch a container as a deamon (which we ll be more helpful !!)

present you « container ID »

show you the docker ps command to show the containers who are running

show you the docker logs command to show what happen inside a container


$ docker run -d ubuntu:14.04 /bin/sh -c "while true; do echo hello world; sleep 1; done"

this will give you a container id which is a unique identifier of your container

$ docker ps

this will show all the running containers and give you

CONTAINER ID      IMAGE     COMMAND     CREATED     STATUS     PORTS     NAMES

the NAME is automatically given by docker command. it will help you to work on your container

exemple :

$ docker logs xxxxxxxxxx  

where xxxxxxxxxx is your CONTAINER NAME

This will give the standard output of your container

hello world
hello world
hello world
hello world

To stop the container : $ docker stop xxxxxxxxxxxx

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook