Posts

Load balacing containers(Docker)

This is my first blog related to Docker. With docker there are two main ways to communicate docker with each other.  With using the links which configure the container with the environment variables and host entry that allow containers to communicate with each other. Second is service discovery patterns that is Docker API. The Service Discovery pattern is where the application uses a third party system to identify the location of the target service.  For example, if our application wanted to talk to a database, it would first ask an API what the IP address of the database is.  This pattern allows you to quickly reconfigure and scale your architectures with improved fault tolerance than fixed locations. The machine name Docker is running on is called docker . If you want to access any of the services, then use docker instead of localhost or 0.0.0.0. Step 1 - Nginx Proxy. We want to have NGINX service running which can dynamically discover and update its l

Configure Jfrog Artifactory with Jenkins

Image
1. Download and configure JFrog Artifactory Following are the steps to download and create repositories and configure permissions to certain users in JFrog Arifactory: a. Download the JFrog artifactory .zip folder from  https://bintray.com/jfrog/artifactory/jfrog-artifactory-oss-zip/4.15.0 b. Extract the .zip folder in your system. Go to the Bin folder and execute  artifactory.bat c. Go to the browser and visit localhost:8081 in order to visit to the artifactory in browser. d. Log in as admin by providing the default credentials: Username: admin Password: password e. You can create a Local repository to store package files created by the Jenkins/Maven project: Go to Admin -> Repositories ->Local -> New f. Select Maven g. Provide key (name: Jenkins-integration) for your repository and check Handle Release and deselect Handle Snapshot. h. Similarly create another local repository with key (e.g. Jenkins-sna

S3cmd command line tools

Installation in ubuntu: apt-get install s3cmd Configure S3 Account: s3cmd --configure Usage:  bucket list of S3       s3cmd ls   upload files on s3 bucket       s3cmd sync -rv /LOCAL/DIR  s3:// BUCKET/   Download buck files with same pattern       s3cmd get  s3:// BUCKET/ 2020-01-*  /LOCAL/DIR/   Make bucket       s3cmd mb s3://BUCKET   Remove bucket       s3cmd rb s3://BUCKET    List objects or buckets       s3cmd ls [s3://BUCKET[/PREFIX]]    List all object in all buckets       s3cmd la     Put file into bucket       s3cmd put FILE [FILE...] s3://BUCKET[/PREFIX]   Delete file from bucket       s3cmd del s3://BUCKET/OBJECT   Delete file from bucket (alias for del)       s3cmd rm s3://BUCKET/OBJECT   Restore file from Glacier storage       s3cmd restore s3://BUCKET/OBJECT   Synchronize a directory tree to S3 (checks files freshness using         size and md5 checksum, unless overridden by options, see below)       s3cmd sync LOCAL_DIR s3://BUCKET[/PREFIX] or 

Switch between multiple PHP version in Ubuntu

If you have two php versions (e.g. PHP7.2 and PHP 5.6 ) installed in your ubuntu system. Switch from PHP 5.6 to PHP 7.2 =====> Apache:- sudo a2dismod php5.6 sudo a2enmod php7.2 sudo service apache2 restart   Command Line:- sudo update-alternatives --set php /usr/bin/php7.2 sudo update-alternatives --set phar /usr/bin/phar7.2 sudo update-alternatives --set phar.phar /usr/bin/phar.phar7.2 sudo update-alternatives --set phpize /usr/bin/phpize7.2 sudo update-alternatives --set php-config /usr/bin/php-config7.2  Switch from PHP 7.2 to PHP 5.6 =====>   Apache:- sudo a2dismod php7.2 sudo a2enmod php5.6 sudo service apache2 restart Command Line:- sudo update-alternatives --set php /usr/bin/php5.6 sudo update-alternatives --set phar /usr/bin/phar5.6 sudo update-alternatives --set phar.phar /usr/bin/phar.phar5.6 sudo update-alternatives --set phpize /usr/bin/phpize5.6 sudo update-alternatives --set php-config /usr/bin/php-config5.6  

Record SSH terminal of some user in Linux

Record you terminal's stdin/stdout to a server. You can use script command to record all the activity on terminal. Consider using script command   $ script <output_filename>   and then ssh to your server, once you are done close your ssh connection and $ exit   to stop the screen recording. You could make sure your recordings are always named uniquely by using the following convention, $ script filename_(date +"%Y-%m-%d%H%M%S") you can add this line in users .bashrc. or you can create bash script for this, for e.g. create one bash script named, recording.sh   #!/bin/bash _ck=`ps -ef | grep -i script | grep -v grep | grep -i filename` if [ ! -n "$_ck" ]; then echo "running" >>/tmp/.purval script filename_$(date +"%Y-%m-%d%H%M") fi     for e.g. script is located in users home folder. i.e. $HOME/recording.sh you can call the script into .bashrc.

How to run executable scripts in Nautilus?

Image
when i am trying to open executable scripts (e.g. .sh) from nautilus then it will directly open scripts into text editor. Solution: 1. open Nautilus 2. Open this from menu bar.            settings -> Preferences 3. Select the 'Behavior' tab. 4. Select "Ask each time" under "Executable Text Files". 5. Close the window. And it works.

Error while connecting RDP "an authentication error has occurred the token supplied to the function is invalid".

Image
an authentication error has occurred the token supplied to the function is invalid I have installed xrdp 0.9.8 at server side. Remote desktop connections are working fine when i am connect it from windows 8/10. but when i am trying to connect RDP from windows 7 it is showing error which is showing on left side. in xrdp 0.9.8 TLSv1.2 and TLSv1.3 is added by default. in older version of windows system TLSv1.3 was not supported. thats why it is not connecting with xrdp server. To resolve this issue from server side follow the steps below. 1. Login to xrdp server. 2. navigate to xrdp configuration file location, $cd /etc/xrdp $vim xrdp.ini replace ssl_protocols=TLSv1.2, TLSv1.3 with ssl_protocols=TLSv1, TLSv1.1 3. Restart xrdp service. $ service xrdp restart