Skip to main content

Posts

Showing posts from 2017

Best practices for using HttpClient in c#

Introduction HttpClient is the library to Get, Post, Put,.. and call WebAPIs and it is very important to use it correctly. This Library has some methods to call web apis which all of them are Async. It is really important to use them in async method but if you are using an Async method in a console application that does not have separate UI thread you can use it like the following code : public void MySyncMethod() { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri( "https://google.com" ); var response = client.GetAsync( "SomeAddress" ) .ConfigureAwait( false ).GetAwaiter().GetResult(); if ( response .IsSuccessStatusCode) { //Do Something... } } } Using ConfigureAwait(false) is very important for the applications which does not have separate UI thread Creating HttpClient for each request is not a good Idea and  Reuse  Httpclient as much as possible

Advanced Installation of Openshift Origin 3.7 on CentOS7 with nfs storage

Installing Openshift origin 3.7 with NFS storage The first and for most is planning your architecture In this installation I will try to install 1 master and 3 nodes. your master can use as a node so we will install 1 master and 3 node (use master as a node). do not forget to register an DNS. in this example I will use sample.com 1- Install and run 3 machine with CentOS 7.x 2- set the hostnames of 3 machine # hostnamectl set-hostname master.sample.com # hostnamectl set-hostname node1.sample.com # hostnamectl set-hostname node1.sample.com 3- forward following domains to the machines *.sample.com        => master *.app.sample.com => master node1.sample.com  =>  node1 node2.sample.com  =>  node2 4- generate ssh key in master and copy to all servers as you need to ssh to all machine without password by Ansible # ssh-keygen -t dsa # cat .ssh/id_dsa.pub * copy the keys to all machin in  .ssh/authorized_keys  file  6- install fallowing packages in all

Advanced Installation of Openshift Origin 3.6.0 on CentOS7

To install openshift origin 3.6.0 The first and for most is planning your architecture In this installation I will try to install 1 master and 3 nodes. your master can use as a node so we will install 1 master and 3 node in just 3 machine. do not forget to register an DNS. in this example I will use sample.com 1- Install and run 3 machine with CentOS 7.x 2- set the hostnames of 3 machine # hostnamectl set-hostname master.sample.com # hostnamectl set-hostname node1.sample.com # hostnamectl set-hostname node1.sample.com 3- forward following domains to the machines *.sample.com        => master *.app.sample.com => master node1.sample.com  =>  node1 node2.sample.com  =>  node2   4- generate ssh key in master and copy to all servers as you need to ssh to all machine without password by Ansible # ssh-keygen -t dsa # cat .ssh/id_dsa.pub * copy the keys to all machin in  .ssh/authorized_keys  file  6- install fallowing packages in all machines # y

Popular posts from this blog

Best practices for using HttpClient in c#

Introduction HttpClient is the library to Get, Post, Put,.. and call WebAPIs and it is very important to use it correctly. This Library has some methods to call web apis which all of them are Async. It is really important to use them in async method but if you are using an Async method in a console application that does not have separate UI thread you can use it like the following code : public void MySyncMethod() { using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri( "https://google.com" ); var response = client.GetAsync( "SomeAddress" ) .ConfigureAwait( false ).GetAwaiter().GetResult(); if ( response .IsSuccessStatusCode) { //Do Something... } } } Using ConfigureAwait(false) is very important for the applications which does not have separate UI thread Creating HttpClient for each request is not a good Idea and  Reuse  Httpclient as much as possible

Advanced Installation of Openshift Origin 3.7 on CentOS7 with nfs storage

Installing Openshift origin 3.7 with NFS storage The first and for most is planning your architecture In this installation I will try to install 1 master and 3 nodes. your master can use as a node so we will install 1 master and 3 node (use master as a node). do not forget to register an DNS. in this example I will use sample.com 1- Install and run 3 machine with CentOS 7.x 2- set the hostnames of 3 machine # hostnamectl set-hostname master.sample.com # hostnamectl set-hostname node1.sample.com # hostnamectl set-hostname node1.sample.com 3- forward following domains to the machines *.sample.com        => master *.app.sample.com => master node1.sample.com  =>  node1 node2.sample.com  =>  node2 4- generate ssh key in master and copy to all servers as you need to ssh to all machine without password by Ansible # ssh-keygen -t dsa # cat .ssh/id_dsa.pub * copy the keys to all machin in  .ssh/authorized_keys  file  6- install fallowing packages in all

Advanced Installation of Openshift Origin 3.6.0 on CentOS7

To install openshift origin 3.6.0 The first and for most is planning your architecture In this installation I will try to install 1 master and 3 nodes. your master can use as a node so we will install 1 master and 3 node in just 3 machine. do not forget to register an DNS. in this example I will use sample.com 1- Install and run 3 machine with CentOS 7.x 2- set the hostnames of 3 machine # hostnamectl set-hostname master.sample.com # hostnamectl set-hostname node1.sample.com # hostnamectl set-hostname node1.sample.com 3- forward following domains to the machines *.sample.com        => master *.app.sample.com => master node1.sample.com  =>  node1 node2.sample.com  =>  node2   4- generate ssh key in master and copy to all servers as you need to ssh to all machine without password by Ansible # ssh-keygen -t dsa # cat .ssh/id_dsa.pub * copy the keys to all machin in  .ssh/authorized_keys  file  6- install fallowing packages in all machines # y