basic cwp with jenkins and nodejs

hostname srv1.example.com yum -y install wget yum -y update reboot cd /usr/local/src wget http://centos-webpanel.com/cwp-el7-latest sh cwp-el7-latest -r no --phpfpm 7.3 --softaculous no reboot sudo wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key sudo yum upgrade sudo yum install epel-release java-11-openjdk-devel sudo yum install jenkins sudo systemctl daemon-reload curl -sL https://rpm.nodesource.com/setup_12.x | bash - sudo yum install nodejs npm -y sudo npm install pm2@latest -g

December 28, 2021 · 1 min · Harshvardhan Malpani

Installing a testing instance for Magento CLI only

Prerequisite: Magento repo access keys Mysql Database, username and password a domain name pointing to a server if you dont have access key, get a pair here : https://marketplace.magento.com/customer/accessKeys/\ php -d memory_limit=-1 /bin/composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.2.11 ./ In the above command, you can change version/subversion of magento repo. You can also change the install directory After the successful run of above command:\ bin/magento setup:install \ --base-url=https://testmagento.domain.com \ --db-host=localhost \ --db-name=testmage_x1 \ --db-user=testmage_x1 \ --db-password=WEux3dxxxxw \ --admin-firstname=xxx \ --admin-lastname=yyy \ [email protected] \ --admin-user=admin \ --admin-password=WwKhxxxxxxEK \ --language=en_US \ --currency=USD \ --timezone=America/Chicago \ --use-rewrites=1 YOu will see Magento Admin URI: /admin_10lf7y after successful run ...

February 4, 2021 · 1 min · Harshvardhan Malpani

Basic Authentication with Nginx with proxy port (react/node app etc)

Reference:https://docs.nginx.com/nginx/admin-guide/security-controls/configuring-http-basic-authentication/ Requirements: apache2-utils or httpd-tools Use htpasswd utility and create a .htpasswd file, see reference\ htpasswd -c /etc/nginx/.htpasswd usernamethatyouwant chmod 644 /etc/nginx/.htpasswd After that, just add lines in nginx conf 1 2 3 4 5 6 7 8 9 10 location / { auth_basic "Backend Area"; auth_basic_user_file /etc/nginx/.htpasswd; ## path to your passwd file ## ... ## xyz code ##... proxy_pass http://127.0.0.1:4000; ## Proxy port for your app proxy_set_header Authorization ""; ## DONT FORGET THIS. reset the auth header include proxy.inc; } Restart nginx now or test first using “nginx -t”

January 22, 2021 · 1 min · Harshvardhan Malpani

Jenkins auto deploying flask in test env with last build process kill and pipenv

#!/bin/sh cd $WORKSPACE export PY=/usr/local/bin/python3 export FLASK_RUN_PORT=4005 $PY -m pip install pipenv $PY -m pipenv install --dev export VENV_HOME_DIR=$($PY -m pipenv --venv) source $VENV_HOME_DIR/bin/activate flask db upgrade flask populate-initial-data export BUILD_ID=XYZapi $WORKSPACE/killlastbuild.sh flask run & deactivate killlastbuild.sh can have anything inside it depending upon your project requirements. I put 2 process killers to kill background-ed daemon processes from previous build command ps -Af | grep "xyzapi" | grep -v grep | awk '{print$2}' | head -1 | xargs kill -9 ps -Af | grep "xyzapi" | grep -v grep | awk '{print$2}' | head -1 | xargs kill -9

June 22, 2020 · 1 min · Harshvardhan Malpani

Total inode count for a particular user in linux

Inode usage for current working directory echo "Detailed Inode usage for: $(pwd)" ; for d in `find -maxdepth 1 -type d |cut -d\/ -f2 |grep -xv . |sort`; do c=$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n" Use cd ~ to change pwd to current user home cd ~ Reference: Magesh from 2daygeek : https://www.2daygeek.com/linux-check-count-inode-usage/

February 17, 2020 · 1 min · Harshvardhan Malpani

How to solve MySQL server gone away error Maria Db update on cPanel and WHM?

This is related to new MariaDb upgrade from 10.1.41 to 10.1.42 and also for servers which were updated from 10.2.27 to 10.2.28 Go to solution ( Special Thanks to @Valetia ) You will see errors in following formats/messages: No file or input found MySQL Server has gone away Connection to MySQL Server failed sqlstate[hy000]: general error: 2013 lost connection to mysql server during query General error: 2006 MySQL server has gone away ERROR 2006 (HY000): MySQL server has gone away ERROR 2013 (HY000): Lost connection to MySQL server during query Log files (/var/lib/mysql/$hostname.err) will have or can have any of these errors: ...

November 6, 2019 · 1 min · Harshvardhan Malpani

How to fix Composer should be invoked via the CLI version of PHP, not the cgi-fcgi SAPI error in SSH?

Put this in your bash profile and run source ~/.bashrc alias composer="/opt/cpanel/ea-php71/root/usr/bin/php /opt/cpanel/composer/bin/composer" As Composer is now available via WHM you can use this to find it: which composer This returned path “/opt/cpanel/composer/bin/composer” for me. If this returns nothing then disregard the rest of this answer, as Composer is not available to you at system level. You can now use php-cli to call this with Composer’s absolute path: php-cli /opt/cpanel/composer/bin/composer install php-cli /opt/cpanel/composer/bin/composer update php-cli /opt/cpanel/composer/bin/composer require whatever/example You may however need to alias php-cli if your system claims this isn’t found. It very much depends how PHP has been deployed on the WHM server. Learn how to fix PHP CLI error. You can do this by adding a user alias to the end of your “.bashrc” or “.bash_profile” file as follows: ...

February 12, 2019 · 1 min · Harshvardhan Malpani

How to edit default python version for a linux user?

Edit the bash profile and add an alias using the following code $ nano ~/.bashrc Put the following line of code in .bashrc file and alter the python3.6 path as per your new installation alias python='/usr/local/bin/python3.6' Use CTRL x to exit and save After that you need to reload the source, so use the following command and you are good to go. $ source ~/.bashrc

December 31, 2018 · 1 min · Harshvardhan Malpani
lindows winux

Windows v/s Linux. What’s your choice?

Hi Everyone. Today we are going to talk about the two operating systems. Windows and Linux. Both of them have their own pros and cons. Offcourse Windows have its monopoly with 88% plus market shares. Although slowly but Linux has started getting attention and getting more popular day by day. Windows has dominated the market because it is way simpler to operate than any other operating system. In this article, we will be focusing on understanding the two operating systems and their pros and cons. ...

November 1, 2018 · 4 min · Harshvardhan Malpani

How to repair a MySQL database?

Hello! Good to see you. This is going to be a very important article because we are about to discuss “How to repair a MySQL database?” Why repair MySQL Database? Databases can become corrupted for any number of reasons, from software defects to hardware issues. If this occurs, you can try to repair the database. Wondering how to do it? Just follow this article. REPAIRING MYSQL DATABASES: Let’s see how to repair MySQL database through Linux and Windows command line. ...

October 30, 2018 · 2 min · Harshvardhan Malpani