bitbucket post hook sample json

Like github, bitbucket sends a useful json post data to a url specified by you if you add a post hook in a the bitbucket repo. The post json can be useful if you want to determine the file changes of the branch that has the change. example json is

Array
(
[payload] => {"repository": {"website": "", "fork": false, "name": "repo_name", "scm": "git", "owner": "your_group", "absolute_url": "/your_group/your_repo/", "slug": "your_repo", "is_private": true}, "truncated": false, "commits": [{"node": "727a3b3c6b37", "files": [{"type": "modified", "file": "code/yourfile.php"}, {"type": "modified", "file": "code/yourfile.php"}], "raw_author": "your name <bernard@youremail>", "utctimestamp": "2014-11-26 04:13:10+00:00", "author": "yourname", "timestamp": "2014-11-26 05:13:10", "raw_node": "727a3b3c6b37f0b9c03fde57943f3f463a12f9e5", "parents": ["2405db2a7a94"], "branch": "develop", "message": "update deploy scripts\n", "revision": null, "size": -1}], "canon_url": "https://bitbucket.org", "user": "yourname"}
)

cpanel changing document root of primary domain

there might be times when you want to restructure the default public_html directory structure. The document root might reside somewhere deep in for security reasons.

go to /var/cpanel/userdata/USERNAME/DOMAIN.COM

edit the documentroot line

then

/scripts/rebuildhttpdconf
service httpd restart

Allow different order status in woocommerce

sometimes it is necessary to add new order type, for example some of the items i sell requires installer confirmation. Thanks woocommerce, the hooks are easy to use. In your functions file:

// New order status - Waiting for Installer Response
function register_waiting_installer_order_status() {
  register_post_status( 'wc-waiting-installer', array(
    'label' => _x( 'Waiting for installer Response', 'Order status', 'woocommerce' ),
    'public' => false,
    'exclude_from_search' => false,
    'show_in_admin_all_list' => true,
    'show_in_admin_status_list' => true,
    'label_count' => _n_noop( 'Waiting for installer response <span class="count">(%s)</span>', 'Pre Order <span class="count">(%s)</span>', 'textdomain' )
  ) );
}
  
add_action( 'init', 'register_waiting_installer_order_status' );

function waiting_for_installer_response_order_status($o) {
	$o['wc-waiting-installer'] = _x( 'Waiting for installer response', 'Order status', 'woocommerce' );
	return $o;
}

add_filter( 'wc_order_statuses', 'waiting_for_installer_response_order_status' );

Jenkins installation

A lot of resources can be found on the web.

digitalocean has a good one as well.

https://www.digitalocean.com/community/tutorials/how-to-install-and-use-jenkins-on-ubuntu-12-04

Tips for upgrading ubuntu 14.04

ubuntu 14.04 is a big upgrade. upgrading also affects LAMP. It comes with php 5.5 and apache 2.4

The most headache part is apache 2.4. It no longer work out of the box.

The biggest change is that in the vhost directive, you have to add

“Require all granted” in place of

Order allow,deny
Allow from all

 

The mod-rewite is also not turned on by default. remember to

a2enmod rewrite.

see http://httpd.apache.org/docs/2.4/upgrading.html

Creating Dev Environment

The idea is to have a production-like system within your system.

1. Download virtualbox.

2. Download a ready-to-go vm instance.

3. Expand the vm instance to desired size.

4. In instance, create a user and setup samba share.

5. In virtualbox host, create 2 network adapter, one “NAT” and one  “host only”, that way the centos instance can only share files to the host machine. Using vboxsf sharing option is way TOO SLOWWW.

6. Set up LAMP or any other web server in the vm instance. To access the sites in the vm instance, configure the host file in the host to point to the instance. To access the files in the vm instance, just connect to the vm via samba.

7. Now, there is a flexibility of development in host machine or vm (Up to the developer). The vm instance can run the httpd server while changes to the files can be done in any OS.