Showing posts with label DevOps. Show all posts
Showing posts with label DevOps. Show all posts

Tuesday, 12 November 2019

Jenkins Vs TeamCity tools comparision

Jenkins and Teamcity tools are powerful continuous integration tools. Each tool has it's own features available to support Continuous integration  process.

Please refer following few features we have compared.


Jenkins is good tool when you going for end to end integration in enterprise level as it has more support to integrate 3rd party tools whereas Teamcity is good when you have lesser team working on with specified technology like Microsoft based applications.

Monday, 22 July 2019

Running .yml file in Docker to build WordPress application along with MySQL DB

WordPress is sample application made available as image in Docker hub/repository. To build this application with docker process it is also required DB to associate.

Following is the sample yml file with configuration details to be used in docker to build wordpress application up and running.

docker-compose.yml application:

version: '3'
services:
  wordpress:
    image: wordpress:latest # https://hub.docker.com/_/wordpress/
    ports:
      - 8081:80
    environment:
      WORDPRESS_DB_HOST: db
      WORDPRESS_DB_NAME: govardhansql
      WORDPRESS_DB_USER: root
      WORDPRESS_DB_PASSWORD: abc123
    depends_on:
      - db
    links:
      - db

  db:
    image: mysql:latest # https://hub.docker.com/_/mysql/ - or mariadb https://hub.docker.com/_/mariadb

    command: [
        '--default_authentication_plugin=mysql_native_password',
        '--character-set-server=utf8mb4',
        '--collation-server=utf8mb4_unicode_ci'
    ]
    environment:
      MYSQL_DATABASE: govardhansql
      MYSQL_ROOT_PASSWORD: abc123


This file is located in my local machine with the path: "C:\Govardhan\YYYY\DevOps\Docker\wordpress"execute this .yml file from docker with following commands.
first open the cmd prompt or windows powershell.

CD C:\Govardhan\YYYY\DevOps\Docker\wordpress
docker-compose up

following are screenshots for the reference.


later use the url as "http:\\localhost:8081" to view the wordpress application.

Hurry!!!! We have build the wordpress application in the docker container in very quickly with the power of Docker.

Docker useful commands with respect to DevOps, Jenkins and Selenium

Having docker commands handy is always good to speed up your work. Following are few useful commands from docker.

Pre-Requisite: installing the docker. To install docker please refer docker installation

Docker handy commands:
'shows all the containers and images irrespective of their running status
docker ps -a

'shows all the containers and images which are currently running status
docker ps

'to pull any image from the docker hub. this command only pull the image to host docker
docker pull <image name>
Ex: docker pull mysql
docker pull jenkins
docker pull selenium/hub

'to run any of the image. some images required to pass some parameters but some images can run directly with simple command.
docker run mysql
docker run --name govardhan-wordpress --link govardhansql:mysql -p 8080:80 -d wordpress
'URL deployed from wordpress can be accessed with: http://localhost:8080/

docker run --name GovardhanJenkins -p 8083:8080 -p 50000:50000 -v /var/jenkins_home jenkins
'URL deployed from Jenkins can be accessed with: http://localhost:8083/

mysql image installation commands:
docker pull mysql  -- pull the image from the repository
docker run --name govardhansql -e MYSQL_ROOT_PASSWORD=abc123 -d mysql:latest

docker pull mysql  -- will pull from the repository
docker run mysql -- will run the image in the container

Running docker .yml file:
'running .yml file for with docker compose option. This option is quite easy compare to run the commands sequantially.
' copy the docker .yml file and run the below command from cmd problem or windows powershell after navigating to .yml file location/directory
'example: my docker file is located at C:\Govardhan\YYYYY\DevOps\Docker\wordpress
cd C:\Govardhan\YYYY\DevOps\Docker\wordpress
docker-compose up
' the above command automatically opens the .yml file and compose the docker to create container and run the image.

How to delete docker image:
'below command will delete images which are not associated to any containers
docker image prune -a

'Remove all images which aren’t associated with a running container: The -a parameter is the crucial bit here.
'If you want to force the action to occur without a confirmation prompt, you may add the -f parameter, like so:
docker image prune -af
Note: -af is the same as specifying -a and -f separately

Running Selenium Grid/Hub to execute Selenium scripts in parallel mode:
'to run the selenium grid in docker container, please run the following commands
'up selenium hub
docker run -d -p 4446:4444 --name GovardhanSelenium-hub -P selenium/hub
'to link with node chrome
docker run -d -P --link GovardhanSelenium-hub:hub selenium/node-chrome-debug
docker run -d -P --link GovardhanSelenium-hub:hub selenium/node-firefox-debug
' after this Selenium grid can be accessed with below URL
http://localhost:4446/grid/console

Inspect the docker image to find out the configuration details and other stuff:
docker inspect <image name/id>
example: docker inspect GovardhanJenkins

View the container generated log:
docker logs <image name/id>
docker logs GovardhanSelenium-hub
docker logs 93ebac97829d

Friday, 19 July 2019

Docker windows storage location

Docker windows version can be installed in windows 10 enterprise edition.

After installing docker if you add add images in the container, the local(host) windows machine storage going to be increased as you are pulling all the images.

you can find the Hyper-V virtual hard disk size increased as soon as you pull any of the image available in the docker.

the virtual hard disk usually located in your local/host machine in below path.

C:\Users\Public\Documents\Hyper-V\Virtual hard disks