PHP 7.0 and Drupal 7 on Ubuntu 16.04 Xenial

Ubuntu 16.04 doesn’t natively let you install PHP5.6. It only lets you install PHP 7.0. It is a long process to install PHP 5.6 if your server is not allowed to connect to the internet.

Drupal 7, as of Drupal 7.44, (approximately July 2016) supports and works with PHP 7.0 .So you may install PHP 7.0 on Ubuntu 16.04 for Drupal 7 sites instead of jumping through the hoops to get PHP5.6 installed on the server.

 

Reference: Ubuntu Drupal 7 package 

Ruby on Rails Environment Setup on Windows 10

Windows with Ruby on Rails installed on Ubuntu Virtual Box

I am new to Ruby on Rails and I was asked to setup my Ruby on Rails local environment for work without any help from anyone. I spent a couple of weeks trying to install it on windows only to realize that there were too many gem unavailability issues in windows for the setup of the ruby application.

I tried the following before I ended up working almost completely from within a Linux Virtual Box Client.

  • Windows + Ruby + Source Code:
    • Install Ruby on Rails using the Rails installer and / or Ruby installer on Windows 10 with existing source code and gem bundles.
    • This failed because there were too many gems that were needed by the application that we were not available on windows version of Ruby.
  • Windows + (Linux Virtual Box + Ruby) + Source Code:
    • Install Ubuntu on Virtual Box. And Setup Ruby in Ubuntu while having the IDE and Source Code on Windows with the source code folder shared into the Virtual box using Guest Additions for running the WEBrick server and gem installations.
    • This failed because when doing the bundle install command from Linux Virtual Box on the shared windows source code folder failed due to permission issues.
  • Windows + (Linux Virtual Box + Ruby + Source Code):
    • Install Ubuntu on Virtual Box. And Setup your IDE, Ruby, and source code in Ubuntu. SSH into Virtual Box and access your application from your Windows Host using a host only virtual box network adapter.
    • This works for me because of the seamless mode in virtual box guest additions.
  • Ubuntu:
    • Install Ubuntu as a second OS with dual boot setup. And setup your IDE, Ruby, and source code in Ubuntu.
    • This works but doesn’t give the same comfort level or speed of development as Windows (to me).

So I am using the Windows + (Linux Virtual Box + Ruby + Source Code) setup for working with Ruby on Rails development now. I access the web application via browser on Windows and do all development on the Ubuntu virtual box using seamless mode.

Git Prune for Cleanup

When you or a team member removes a few branch from your remote git repository as part of cleanup and you still see the branches on your local environment you will have to run the git command below to remove (prune) all the branches from your local that do not exist on the remote repository anymore.

git fetch -p

GIT BFG

If you ever committed a large file (over 50 MB) in your git repository and are having issues pushing to the repository, you will have to use the BFG tool to delete the large file not only from the latest commit but also from the history of all commits in your repository to work properly on github.

if you see a similar error when pushing :

Counting objects: 387, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (349/349), done.
Writing objects: 100% (387/387), 402.76 MiB | 7.53 MiB/s, done.
Total 387 (delta 108), reused 48 (delta 36)
remote: warning: File /xxxxxxxxxxmpg is 51.10 MB; this is larger than GitHub’s recommended maximum file size of 50.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage – https://git-lfs.github.com.
remote: error: Trace: d051ecdf77d64a9b66a168bcb9608b85
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File docroot/sites/Black_Eyed_Peas_Concert.3gp is 334.19 MB; this exceeds GitHub’s file size limit of 100.00 MB
To git@github.com:xyxuhjhj.git
! [remote rejected] master -> master (pre-receive hook declined)

do the following after downloaidng the BFG tool: (Courtesy: BFG Tool)

git clone --mirror git://example.com/some-big-repo.git
java -jar bfg.jar --strip-blobs-bigger-than 100M some-big-repo.git
$ cd some-big-repo.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive

GIT Cherry Picking

Today I had to commit one change into two different branches (master and google). After googling for some time I found out that GIT has a way of picking one commit hash from a branch and apply it onto another branch.

i.e. If we commit a change into google branch and want that commit to be applied into the master branch too then we get the hash code of the commit from the google branch using the command “git log” and apply the commit hash onto the master branch using the following command.

git cherry-pick [commit-hash]

The sequence of commands in my case was as follows: (branches master and google):

git checkout google
git pull origin google

[always pull before commit and push]

git commit -a -m "committing all changes to google branch"
git push origin google
git log

[get the hashcode for the commit above and lets call it 62abc3]

git checkout master
git pull 

[always pull before commit and push]

git cherry-pick 62abc3

 

Production Server filling up with Redo Logs resulting in space issue. Deep research!

Situation: We have a production portal which connects to our Oracle  database to retrieve some data. We have been getting ORA-00257  archiver error on the portal quite often which makes us look bad. Most of the servers are UNIX based. One of our teammates has been looking at the site and letting us know of this errorso that we fix it before some user looks at it.

Reason for the error: This error usually shows up when the partition or hard disk which is used by Oracle for writing the redo logs is full.

How to check: Connect to the Oracle DB server and check the disk space on it using df -h in case of UNIX. Pretty obviously the partition which has 100% used is the hard disk that Oracle uses to write the redo logs. In case there are more than one partitions that show 100% usage, you need to figure out the redo log writing location from the show parameter DB_RECOVERY_FILE_DEST command in Sqlplus.

After figuring out the destination or location where Oracle is filling up the redo logs you can backup/move some of the older redo logs to a different location to free up space for the issue to be solved immediately.

Not solved yet?: In our case, Oracle kept filling up the redo log files again and again and we had to clean it up again. We went through various articles on oracle errors to figure the root cause of this issue. We first doubted the Tape Drive because we had a recent tape drive failure and this might be linked to it.

We looked into various stored scripts on the server which ran on a daily basis and looked at the logs. Looking at the logs for the RMAN scripts on the database server pointed us toward the RMAN-00571 and ORA-19502 errors which were related to space issues too.

These scripts were written probably by an previous DBA.They archive all the redo logs and deletes them at the end of the day. These were not able to successfully complete due to space not being sufficient on the hard disk.

Solution: Space clean up and making sure the archiving and deleting process are running properly at the end of the day so that the next redo log writing process has enough space to use.

Conclusion: Don’t just look for a direct solution to a problem in the IT field. There might be more than one cause for a single problem. One problem leads to another and then to another.