Posts

Showing posts from July, 2014

Port Forwarding using your Windows Server or Laptop

Sometimes we just need to forward a port from one host, to another host. A few years back I built a java NIO-based port forwarder to learn about java NIO socket communication. The java source codes since has been lost and there is a different need for port forwarding, the first is that a server having failure connecting to services in another server, and I think that the server's IP  might be translated to another IP while it were connecting to another network. So the port forwarding need to be able to log the IPs of the incoming  connection. The second, is to temporarily circumvent strange network problems that prevent the first server connecting to another server. Step 1 - Decide which incoming port to use First we need to decide what port we are going to use to accept connections in the first host. Check first that the port is not already occupied in the host (try opening http://127.0.0.1:xx in your favorite browser where xx is the chosen port) Step 2 - Open windows fire

Compiling PDO_OCI in CentOS / RHEL

Background Similar to the previous post, my yii-framework based PHP application need to access to oracle database tables. Yii requires PDO_OCI PHP extension in order to access oracle database. I will describe steps that I took to compile PDO_OCI extension from php package source SRPMS.  Preparation In CentOS, we need to create /etc/yum.repos.d/source.repo because CentOS doesn't come with one : [base-SRPMS-6.5] name=CentOS-$releasever – Base SRPMS baseurl=http://vault.centos.org/6.5/os/Source gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=1 enabled=1 [updates-SRPMS-6.5] name=CentOS-$releasever – Base SRPMS baseurl=http://vault.centos.org/6.5/updates/Source gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 priority=1 enabled=1 We also need yum-utils and rpm-build packages yum install yum-utils rpm-build Then, download the source package file with yumdownloader : [root@essdev ~]# yumdownloa

How To Build PDO_OCI in Ubuntu 12.04

Building PDO_OCI extension in Ubuntu 12.04 is a little difficult. The reason : a. pdo extension are included in the php5 package b. PDO_OCI in pecl requires pdo extension source, not pdo extension binary c. pdo from pecl cannot compile under php 5.3 c. malformed tgz resulting from 'pecl download PDO_OCI' (well, as of today, 11-07-2014, it is) Why I need PDO_OCI? Well, I used Yii framework and need to access oracle database. Yesterday I tried this strategy to obtain pdo_oci extension : 1. downloaded instant client 10.2.0.4 basic and sdk from OTN (oracle tech network) 2. extract the instant client files, move them to  /opt/instantclient_10_2, create 3 symbolic links. 3. download php5 source package, and try to rebuild the php5 debs using debuild. This would ensure the php extensions were build. apt-get install dpkg-dev apt-get source php5 apt-get build-dep php5 apt-get install devscripts debuild -us -uc 4. after php5 deb created, change the debian/rules file to en

How to dump stacktrace in running Ruby process

Background Murphy's law describe that if something could break, it would break in the worst time possible. Or something like that. Anyway, more often than not, our software doesn't behave as it should. And I often get web apps that waiting endlessly for something. It made us curious what on earth cause the app to wait. In this case, the app is openshift origin console. Being Ruby based, means there supposedly a way to dump stack from running threads.  Technique At first I tried to borrow the openshift ruby cartridge method of thread dump. Upon reverse engineering the cartridge (ok, I just snoop in some files such as this ) I am surprised to find out that all that the ruby cartridge does is to send signal ABRT to the process which has the title prefix of Rack: .  Trying to apply the same procedure to the running openshift-console process, and the result is a killed process and a confusion. Another reference, the Phusion Passenger user's guide , tells me that Ruby

Learning Openshift Origin

This post will be about my experience installing OpenShift Origin in my company's servers. Installation I find the comprehensive deployment guide in OpenShift site (http://openshift.github.io/documentation/oo_deployment_guide_comprehensive.html) is very useful, but not without flaws. My OS is RHEL, but I think my experiences would also apply to CentOS systems. The first glitch found was that the yum update went broken just after step 1.1 (repository configuration). The problem was a complex dependency between packages, in short it could be fixed after I do " yum erase libart_lgpl-devel ". That package is not needed for correct system operation. I noted that the mcollective installation (Chapter 5) as prerequisite doesn't mention that in RHEL we need different package than Fedora, that is yum install -y ruby193-mcollective-client Openshift installation liberally uses SCL (software collections) packages, in which a different root  is used to install newer ve