28th Apr2015

Unable to connect to github.com using git://github.com

by Gyro

While installing boostrap-sass using bower, the server returned a weird error message.

Failed to execute "git ls-remote --tags --heads git://github.com/twbs/bootstrap-sass.git", exit code of #128 fatal: unable to connect to github.com: github.com[0: 192.30.252.130]: errno=Connection timed out

I was a bit confused as this was working perfectly fine on my localhost, after some searching I found out that "The native git protocol uses port 443 for the main repo and port 9418 for the submodules. If this port is firewalled on the network, recursive clone times out and fails.".

Git can use https:// instead of git://, so the solution is to set it to use https:// by default:

~$ git config --global url."https://".insteadOf git://

Enjoy :crazy:
Gyro

 

Sources:
https://github.com/lagadic/vision_visp/issues/13
https://github.com/angular/angular-phonecat/issues/141

 

Similar error messages:

  • fatal: unable to connect to github.com:
    github.com[0: 192.30.252.131]: errno=Connection timed out
    Clone of ‘git://github.com/lagadic/visp_auto_tracker.git' into submodule path ‘visp_auto_tracker' failed
  • npm ERR! Error: Command failed: fatal: unable to connect to github.com:
    npm ERR! github.com[0: 192.30.252.130]: errno=Connection timed out
  • Failed to execute "git ls-remote --tags --heads git://github.com/twbs/bootstrap-sass.git", exit code of #128 fatal: unable to connect to github.com: github.com[0: 192.30.252.130]: errno=Connection timed out
    fatal: unable to connect to github.com:
    github.com[0: 192.30.252.130]: errno=Connection timed out

4658

04th Nov2014

ISPConfig/Dovecot Fix: message exceeds temporary size limit

by Gyro

A simple ISPConfig/Dovecot Fix: message exceeds temporary size limit.

I just setup a dedicated server as a webserver using ISPConfig as the control panel following pretty much this guide:
The Perfect Server -- Ubuntu 12.04 LTS (nginx, BIND, Dovecot, ISPConfig 3)

Everything went smoothly, until I setup and tested email addresses.

Thunderbird kept giving me this error popup when trying to send an email:

The size of the message you are trying to send exceeds a temporary size limit of the server. The message was not sent; try to reduce the message size or wait some time and try again. The server responded: (IP, Sender) first encounter..

So, I searched Google for that exact phrase as well as part of it, like "The size of the message you are trying to send exceeds a temporary size limit of the server" or "message exceeds a temporary size limit", and so on, then I finally found a small post that (accidentally?) contained the solution, a parameter that was missing in my config file!

It took quite a while to find the answer, so hopefully this post will help others to get the solution quicker :)

FIX: message exceeds temporary size limit

edit /etc/postfix/main.cf and add this (missing) line:

virtual_mailbox_limit = 0

Final step: restart dovecot:
$ service dovecot restart

Done, enjoy! :crazy:

Sources:
http://www.howtoforge.com/forums/showthread.php?t=1325
http://www.postfix.org/postconf.5.html

1328

06th Aug2014

Comming Soon: HHVM Support in WHM/cPanel?

by Gyro

Great news everyone, it looks like cPanel is gearing up to integrate HHVM (HipHip Virtual Machine)!

I just received a notification from the official features request section of cPanel, in particular the request for PHP HHVM support for better performance.

To quote: "Has anyone had any success implementing PHP HHVM on their own? It's very helpful for us to hear about real world experiences with features we are considering to add in cPanel & WHM." -- cPScottT (cPanel staff).

Don't know HHVM yet?

HHVM is what powers Facebook, it has been developed by Facebook, and they made it available for everyone free of charge. HHVM processes PHP code lighting fast and is currently compatible with about 98% of all php applications.

Today, cPanel employees have finally picked up on this and started asking some questions about HHVM in the respective feature request. What happened next is what got me really excited: Their entire features request section went temporarilly offline! I can only guess that the news has spread rapidly through the twitterverse and other social media channels, resulting in such an increase of page requests that it overwhelmed their server! Maybe they should run their feature request section on HHVM…

Anyways, I am pretty sure that with this kind of response to an "innocent" question by cPanel staff, integrating HHMV into WHM/cPanel has just jumped to the top of their To-Do-List.

Not sure about you, but I am thrilled about this news! :crazy:

2056

23rd Jan2014

Update/Install ImageMagick on CentOS 5 and CentOS 6

by Gyro

Today I had a classic example of what happens when you do not RTFM. I had to install ImageMagick on a webserver running CentOS 5 with cPanel. First I simply ran "yum install imagemagick", which did install ImageMagick just fine.

Now, the reason I had to install it was to do a batch resize of about 20,000 images and place the resized images in a new directory. So I did:
# mogrify -resize 250 -quality 70 -path /home/somesite/public_html/image/thumbs/ -format jpg /home/somesite/public_html/images/*

To my surprise I got the error message:

mogrify: unrecognized option `-path'.

After a quick google search, I realized that yum installed a super old version that was not supporting the -path option?!

So, after some more searching, I found this great guide on how to Install ImageMagick 6.6.5 and followed the instructions. But when I got to the final installation command, I got a dependencies error?!

After another google search, I came across a forum post saying "Make sure that RPMForge repository is installed first, and then everything works."… and when I looked back at the guide, I realized that it did in fact tell me to do that. The reason I did not see it was because it was a one liner with a link to another website, and I was expecting to be able to simply copy paste commands, so I skipped reading that line. I did not RTFM properly…

So, to make it easy for the future, I will combine these two pages, in order to have a step by step set of instructions without having to go to another website :)

Before starting, make you sure you know whether you are using a 32-bit or 64-bit system.
# uname -i
x86_64 would be 64-bit

OK, here we go!

1. Uninstall ImageMagick

# rpm -e --nodeps ImageMagick.i386 ImageMagick-devel.i386 ImageMagick.x86_64 ImageMagick-devel.x86_64
this actually didn't work for me, so I did:
# yum remove imagemagick

2. Add the EPEL repository to yum:

CentOS 6:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
CentOS 5:
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

3. Download and Install RPMforge (Check here for newer version.)

CentOS 6:
Download RPMforge for 32-bit systems: rpmforge-release-0.5.3-1.el6.rf.i686.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
Download RPMforge for 64-bit systems: rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm

Install DAG's GPG key:
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

If you get an error message like the following the key has already been imported:
error: http://apt.sw.be/RPM-GPG-KEY.dag.txt: key 1 import failed.

Verify the package you have downloaded:
# rpm -K rpmforge-release-0.5.3-1.el6.rf.*.rpm

Install RPMforge:
# rpm -i rpmforge-release-0.5.3-1.el6.rf.*.rpm

CentOS 5:
Download RPMforge for 32-bit systems: rpmforge-release-0.5.3-1.el5.rf.i386.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.i386.rpm
Download RPMforge for 64-bit systems: rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm
# wget http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el5.rf.x86_64.rpm

Install DAG's GPG key:
# rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt

If you get an error message like the following the key has already been imported:
error: http://apt.sw.be/RPM-GPG-KEY.dag.txt: key 1 import failed.

Verify the package you have downloaded
# rpm -K rpmforge-release-0.5.3-1.el5.rf.*.rpm

Install RPMforge
# rpm -i rpmforge-release-0.5.3-1.el5.rf.*.rpm

4. Install dependencies for ImageMagick 6.6

For 32-bit systems:
# yum install djvulibre OpenEXR jasper ghostscript librsvg2 libwmf libtool-ltdl
For 64-bit systems:
# yum install djvulibre OpenEXR jasper ghostscript librsvg2.x86_64 libwmf.x86_64 libtool-ltdl.x86_64

Systems running CentOS 6 will need the old version of libtool-ltdl installed:
For 32-bit systems:
# rpm -ivh --force ftp://ftp.muug.mb.ca/mirror/centos/5.9/os/i386/CentOS/libtool-ltdl-1.5.22-7.el5_4.i386.rpm
For 64-bit systems:
# rpm -ivh --force ftp://ftp.muug.mb.ca/mirror/centos/5.9/os/x86_64/CentOS/libtool-ltdl-1.5.22-7.el5_4.x86_64.rpm

5. Download and Install ImageMagick 6.6.5

Download for 32-bit systems: ImageMagick-6.6.5-10.i386.rpm
# wget http://www.lassosoft.com/_downloads/public/Lasso_Server/CentOS-Extra/ImageMagick-6.6.5-10.i386.rpm
Download for 64-bit systems: ImageMagick-6.6.5-10.x86_64.rpm
# wget http://www.lassosoft.com/_downloads/public/Lasso_Server/CentOS-Extra/ImageMagick-6.6.5-10.x86_64.rpm

Install ImageMagick
# rpm -ivh ImageMagick-6.6.5*

DONE! :crazy:

9687

21st Feb2013

Speed up your WordPress with CloudFlare!

by Gyro

My web hosting services provider ServerPilot has integrated CloudFlare into the cPanel!

CloudFlare is Content Deliver Network (CDN) with 22 data centers across the globe, and according to google there are only 9 web services in the world that have more traffic than CloudFlare. It is free, and it will make your website's load lightning fast from anywhere in world!

Even if your website is hosted with a slow hosting provider elsewhere, you can use CloudFlare for free!

If you give CloudFlare a try, make sure you also get the CloudFlare WordPress Plugin! WIth it, you can turn on the "Developer Mode" from your WordPress admin panel -- a must when updating your site, as changes won't show up immediately if the Developer Mode is turned off.

Enjoy! :enjoy:

1174

21st Feb2013

Restore large mysql databases with nginx 504 Gateway Timeout

by Gyro

I had to restore a 36MB sql database today and kept getting a "504 Gateway Time-out".

After playing around with the config files, adding fastcgi_read_timeout to the settings for php5-fpm, and fiddling with the php.ini, I realized that this can be accomplished with one single line using ssh:

Assuming that you have packed the .sql file into a zip file, and you are currently in that folder:
# gunzip < databasebackup.sql.gz | mysql -DDATABASENAME -uUSERNAME -pPASSWORD

DATABASENAME = name of the database
USERNAME = mysql username
PASSWORD = mysql password

I hope this helps when trying to restore large mysql databases with nginx 504 Gateway Timeout

2337

11th Feb2013

WHMCS: Round up product prices for secondary currencies

by Gyro

Today, I actually assisted my hosting provider in setting up secondary currencies in WHMCS, the billing and support system for/from cpanel! :)

They only wanted full numbers for the monthly breakdowns, so when they click "Update Prices" in the Currency Settings and a product would cost 1233.37 the price gets automatically rounded up to 1234.00.

Unfortunately, WHMCS doesn't offer this feature, so I suggested to setup a script on a secure location that they can trigger after they update the currency conversion rates and product prices. Below is the sql query that goes through all secondary currencies (1 = default currency) and rounds up the values, so that the setup fee and all monthly prices are full numbers.

The script itself would run a simple MySQL query:

UPDATE tblpricing SET
msetupfee = ceil(msetupfee),
qsetupfee = ceil(qsetupfee),
ssetupfee = ceil(ssetupfee),
asetupfee = ceil(asetupfee),
bsetupfee = ceil(bsetupfee),
tsetupfee = ceil(tsetupfee),
monthly = ceil(monthly),
quarterly = ceil(quarterly/3)*3,
semiannually = ceil(semiannually/6)*6,
annually = ceil(annually/12)*12,
biennially = ceil(biennially/24)*24,
triennially = ceil(triennially/36)*36
WHERE
currency != 1 AND
id = id

you could replace

currency != 1 AND

with
currency = 2 AND

or
currency IN(2,3,6) AND

etc

Enjoy :enjoy:

2273

21st Jan2013

Gitlab service doesn’t run on startup/boot/autostart

by Gyro

I have been using Gitlab for a while now to have backups of all my git repositories on my dedicated servers. Now, I needed to reboot one of them for the first time since I installed Gitlab, and ended up with a ‘502 bad gateway' warning by nginx, when trying to access the Gitlab web interface.

I found this on the github, hidden in a small pull request:

gitlab doesn't start on boot if you follow the install instructions on Ubuntu (12.04 LTS Server -- probably others). Turns out gitlab requires redis-server to be running for gitlab to be able to start. Startup script S20redis-server isn't run until after S20gitlab so gitlab fails to start on boot. Webserver will be up, bad gateway 502 error is usually seen/reported. Starting gitlab manually works (because redis-server has started). This change makes gitlab start after redis-server.

The single line for victory:
# sudo update-rc.d gitlab defaults 70 30

Enjoy :enjoy:

source: github

2976