How to setup automatic git repository (Bitbucket) updates with our development environment

How to setup automatic git repository (Bitbucket) updates with our development environment

1. clone with bitbucket manually .
clone  mybitbucket_bkp
Note:mybitbucket_bkp is the folder which is updated with bitbucket directly.

2.Write a shell script and set a cron-job as given below ( .
#sync with bitbucket
# we get the update from bitbucket to mybitbucket_bkp
cd /mnt/www/mybitbucket_bkp/
git pull

# we use rsync to update our development folder (my_dev_store) with excluded files and with excluded folders
rsync -avz –exclude app/config/database.php –exclude app/routes.php –exclude app/storage /mnt/www/mybitbucket_bkp/ /mnt/www/my_dev_store/

#we do composer update if need
sudo composer dumpautoload


3.set the cron job for every 5 minutes
*/5 * * * * cd /mnt/www/test_script/; ./





SVN,GIT and Mongo -Ubuntu

How to do SVN backup 
svn dump /home/testuser/svn/phpcode/ | gzip -9 > php_7_04_2014.dump.gz

Secure copy remote to local
scp ubuntuuser@ipaddress:’/home/location/php_7_04_2014.dump.gz’ /home/user/mybackup

Add SVN user
sudo htpasswd /etc/subversion/passwd test

clone with git(bitbucket) branch
sudo git clone -b phpcodebr_1.22 phpcodebr_1.22

GIT commit history  : git log -1

Creating tag from a previous commit
1. sudo git tag reponame_v_1.2.0.0 9170d1b
note:9170d1b is SHA1 ,we can see in the commit-log
2.sudo git push –tags


mongo conection with auth
mongo ipaddress -u myadmin -p 123456 –authenticationDatabase admin

Create a mongoDB user with authentication
… {
… user :”testUser” ,
… pwd : “testUser123” ,
… roles :[“readWrite”, “dbAdmin” ]
… }
… )

Mongo dump with authentication
sudo mongodump -h -u username -p password –db dbaname

Mongo restore

Mongo database copy with authentication

Override local copy by the repository copy.

git fetch origin
git reset --hard origin/master

Elastic MemCache

What is Elastic Cache :

Elastic cache is a web service that makes it easy to manage and scale a distributed in memory cache environment in the cloud.


How it works:



1.Configuraton with AWS console

2.Need to Configure the Elastic-Cache Cluster Client in the server.

   In order to take advantage of auto discovery .


3. Sample PHP application code.



  * Sample PHP code to show how to integrate with the Amazon ElastiCcache
  * Auto Discovery feature.
  * @author         Azeem
function cache_test()
echo “Hi ,This is elastic memcache clastering system sample<br>”;
$server_endpoint=’‘; //this is  elastic memcache
$server_port=11211; //this is the prot we have configured
$client =  new Memcached();
$client->addServer($server_endpoint, $server_port); //initializing the server configuration
$client->set(‘my_key’, ‘My Value is at   elastic memcache ‘.time()); //setting the key with value

echo ‘Data in the cluster: [‘ . $client->get(‘my_key’) . ‘]’; //getting the value