Posts

Create a drupal development environment using docker.

Image
Currently at work i am using docker to streamline and speedup of development and deployment to testing and production, I am using symfony currently and our app is dockerised, i wanted to do the same for drupal based apps. I searched for a official drupal docker repo and i did find this.  https://www.drupal.org/node/2538074 Unfortunately there was very terse explanation but pretty much worked, i found a few hiccups along the way so wanted to share what i did. Pre-requisite: Install docker for your environment. Lots of details are available at  https://docs.docker.com/ explaing docker and installing docker for your environment. The docker repo holds the drupal container at  https://hub.docker.com/_/drupal/ , following the instructions this is how to create the drupal container: In order to use my code base we need to mount the volume with the -v directive as below, we do this in one command: docker run -v /$HOME/work/drupal8:/var/www/html -p 8080:80 --name my...

Use Symfony2 to create template/skeleton code

Image
Pre-requisite: A lamp environment, i will be using a vagrant lamp box (scotch-box) i created earlier. To understand Symfony2 there is nothing better than getting ones hands dirty. We will try to use doctrine to build models, create views using twig and maybe use a dash of frontend magic using backbone or something similar. For the test project I chose a sales bundle where we will make models for item, item type and sale. Using symfony2 command line to create a model. Because i have used vagrant scotch-box to provision my dev environment, i need to first make sure i do vagrant up to start the VM. then i do vagrant ssh this will take me to the ssh locate where you have symfony installed, in my case it is /var/www/public/sandbox and give the following command: php app/console generate:bundle pick a name any name....well not actually, we need to be following coding standards set out in the symfony guide to ensure we name our bundle like this Bundle, so in my case i didn'...

Installing sqlyog on Mac OS X Yosemite

I like to use sqlyog for my work with mysql, but only windows binaries are supplied on the google code site. Another option is to use sqlyog in wine, so to install wine a simpler option is to use Homebrew (http://brew.sh/). Installation for homebrew is quite straightforward, however you need to have installed the command line tools with xcode, if not please install that first. The installation instructions are already on the first page of the homebrew website, so i will not reproduce this, once brew is installed, install wine. brew install wine when i tried installing wine, brew asked me to install a dependency and nicely told me to do the following wine: XQuartz is required to install this formula. You can install with Homebrew Cask:   brew install Caskroom/cask/xquartz so i just did that, once this was completed i could complete installing wine. Now head over to https://code.google.com/p/sqlyog/wiki/Downloads and install the latest sqlyog, at ...

Installing Symfony2

Installation for Symfony was straight forward, using the new symfony installer. head over to symfony https://symfony.com/download and download the installer, installation instructions are included on the page. Remember we are using the vagrant box we installed earlier, start vagrant using vagrant up and you should then have a public folder under your scotch-box folder under vagrant. Install symfony under this folder.

Using Vagrant and Puppet to build a PHP/Lamp environment

Vagrant is a real help in creating developer environments and is widely used by many development teams due to its flexibility and ease of replicating environments. In order to get ready with Drupal 8, I wanted to get to know Symfony this is an attempt to do that and hopefully this will help me do just that and help others who stumble upon this site. The steps for creating a development environment is below, I am using a Mac OS X Yosemite, you can use your favourite OS : 1. Install vagrant using vagrantup.com 2. Install a provider I have used VirtualBox. 3. Initialise a Vagrant environment. Vagrant should work form any where on your computer because the installer would have added this to your executable paths, so lets create a new folder called 'vagrant' and run the following command vagrant init hashicorp/precise64 This creates the Vagrantfile which is the main configuration file for vagrant. Open the Vagrantfile in your favourite editor or maybe just vi it. s...

Install the right version of php_mongo.dll in windows

I use a macbook pro for my freelance work, a ubuntu netbook while travelling and forced to use a windows box at work. I have been recently working a lot with Mongo DB and Drupal, I installed Mongo and php drivers for mongodb without any problems on Mac and Linux, I struggled to get the correct version of php_mongo.dll on my windows box. Installing php_mongo.dll becomes very simple if you find the right version of the dll file. To find the right version, you need to ensure you look at your current configuration, note these steps these will be helpful. use phpinfo() to find out the following information: PHP Version Compiler Architecture Server Software For instance my local machine was a x64 machine running windows 7 pro, however the version of PHP installed was a 32bit. By phpinfo() shows me following: PHP Version: 5.4.x Compiler: MSVC9 (Visual C++ 2008) Architecture: x86 SERVER_SOFTWARE: Apache/2.4.3 (Win32) OpenSSL/1.0.1c PHP/5.4.7 Notice fr...

Import data from mysql to mongo

To import data from mysql into mongodb we need to export data from mysql in a format mongo likes, this is either a tsv or a csv. Ideally you would like to use the following sql select columns INTO OUTFILE '/path/to/csv'    FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'    LINES TERMINATED BY '\n' from table [where clause] What the above SQL does is exports the data (only data , no headers) into a file as provided in your path, make sure you have access to location where you are putting the file. If you ignore the path and just use the filename this will be stored in the location where mysql data files are stored. To get the fields in the data file, we can use the following     echo "SELECT * FROM ;" | mysql -uXXX -pXXX > '/path/to/ .tsv' Finally you want all the be imported into a mongo database, here since our file contains a header we specify the --headerline option. For a complete list of...