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

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

Docker – Part 1 – Where to start – doc and install

The websites to know

The docker website : https://www.docker.com

The docker hub : https://hub.docker.com/account/signup/

The docker training website : https://hub.docker.com/account/signup/

devops.pm :hey dude ,  you’re already in the good place !!


How to begin : (On linux Ubuntu Trusty 14  64Bits)

Step ONE : install docker

Check your kernel : with command line
$ uname -r
You must use 3.10 at minimum

Log into a terminal whith sudo privileges.

Verify that you have wget installed.
$ which wget

If wget isn’t installed, install it after updating your manager:
$ sudo apt-get update
$ sudo apt-get install wget

Get the latest Docker package
$ wget -qO- https://get.docker.com/ | sh

When it’s done , just verify your docker installation
$ sudo docker run hello-world

Your result must be :

 
Hello from Docker.
This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
< 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.     (Assuming it was not already locally available.)  3. The Docker daemon created a new container from that image which runs the     executable that produces the output you are currently reading.  4. The Docker daemon streamed that output to the Docker client, which sent it     to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

 

 

WELL DONE PADAWAN !!!

mobydock

devops.pm father

More Posts - Website

Follow Me:
TwitterFacebook