Posts

Showing posts from 2014

Continuous Integration with Jenkins

# Install Jenkins wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add - sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' sudo apt-get update sudo apt-get install jenkins OR java -jar xxx.war # Create jobs from config.xml file - Can create config.xml file directly from the '/Users/Shared/Jenkins/Home/jobs/<job folder name>/config.xml - Then, need to reload the configurations from, Manage Jenkins->Reload Configuration from Disk # Notes: - In Mac, Jenkings home folder: /Users/Shared/Jenkins/Home

Important Debian commands

#  echo "test" | mail -s "test" your@email.com : to check sendmail working # sudo service --status-all # find /etc -name "NAME_OF_FILE" # sudo passwd : to change root password # sudo apt-get autoremove # sudo adduser USER # sudo userdel USER # sudo df -h : to get hard disk usage info # tree : to list down the folder structure. apt-get install tree for installation # sudo netstat -tulpn : to see what services are runing # sudo netstat -tapen | grep ":8000 ": check what port 8000 running # log file reading tail, less, last, lastlog # sudo apt-cache : to get more information about repositories # sudo add-apt-repository : to update your system with unsupported packages. Ex. add-apt-repository ppa:nginx/stable =============== File permission ========================================= permission groups Owner | group | all users Permission types read | write | execute ls -l or ll - to see the file permission granted

Ant based YUI Javascript CSS compressor

How install ant on Debian: >sudo apt-get install ant Setup compressor: # Download the pre-setup bundle from the following location,  https://github.com/dilumdarshana/YUI # You may update the latest YUI jar file from,  https://github.com/yui/yuicompressor/releases # Change the build.xml file as necessary with all the CSS and JS files to be merged and compressed. # The pre-setup compressor will make compressed JS and CSS files to the root location.

PHPUnit

Installation on Debian/Unix: wget https://phar.phpunit.de/phpunit.phar chmod +x phpunit.phar mv phpunit.phar /usr/local/bin/phpunit phpunit --version Or install from composer, {     "require-dev": {         "phpunit/phpunit": "^5.4"     } } OR composer global require-dev phpunit/phpunit For global access, composer global install Files will be downloaded to ~/.composer/vendor/bin/ So, we need to set the PATH variable for global access, export PATH=~/.composer/vendor/bin:$PATH For update package, composer global update How phpunit works in Yii: All the test files need to be follow the unique naming convension, file name should be end up with 'Test' : databaseTest.php class name shoud be the same as filename and it should extends from phpunit testcase class, ex: include_once  ('framework/database.php'); - The original class file class databaseTest extends PHPUnit_Framework_TestCase { protected $connec

xdebug on Debian

Installation: sudo apt-get install php5-xdebug Can check whethere it installed or not by looking at phpinfo() We can change any initial configuration settings by changing xdebug specific ini files located at /etc/php5/fpm/conf.d/20-xdebug.ini Can find the exact ini location by looking at the phpinfo() OR just run find command from command line, find /etc -name "xdebug.ini" Profiling: Need to change xdebug.ini file as follow, xdebug.profiler_enable = On xdebug.profiler_output_dir="/tmp/xdebug" More info at: http://devzone.zend.com/1139/profiling-php-applications-with-xdebug/ Debug codes with break points: Netbeans 8 comes with native support with xdebug. The following config needs to be done on xdebug.ini or set it on run time, xdebug.remote_connect_back = On So, the final configuration changes as bellow, xdebug.remote_enable = On xdebug.profiler_enable = On xdebug.profiler_output_dir = "/tmp/xdebug" xdebug.dump_undefined

GIT Help

################### Configurations #################### # Make ssh connection with github (from Debian) - Generate public/private key pair on local computer cd ~/.ssh ssh-keygen -t rsa -C "your_email@example.com" - Add private key to the local ssh-agent eval `ssh-agent -s` ssh-add ~/.ssh/id_rsa - Copy public key to clipboard clip < ~/.ssh/id_rsa.pub - Linux pbcopy < ~/.ssh/id_rsa.pub - Unix - Add public key to Github https://github.com/settings/ssh - Check ssh connection with github ssh -T git@github.com # When git asking username and password every time you commit, then you have cloned the repository using https rather using ssh. To correct that mistake git remote set-url origin git@github.com:dilumdarshana/AngularJS.git # When git contribution does not show on the profile graph do this, git config --global user.email " YOUR EMAIL ADDRESS " #  git config : To config settings eg. git config --global user.name = 'Dilum Darshana

Samba on Ubuntu

Installation: sudo apt-get install samba It should install and run both smbd and nmbd Configurations: sudo nano /etc/samba/smb.conf Make the following changes, workgroup = WORKGROUP security = user [share] comment = Ubuntu file server share path = /var/www browsable = yes guest ok = yes read only = no create mask = 0755 Change nmbd config (netBIOS name server), sudo nano /etc/init/nmbd.conf disable the following lines # NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/nu$ # [ "x$NMBD_DISABLED" = xYes ] && { stop; exit 0; } Then restart nmbd demons, sudo restart nmbd General commands: sudo restart smbd

Nginx with php-fpm (on Debian)

Nginx installation sudo apt-get install nginx Basic server commands sudo service nginx start sudo service nginx stop sudo service nginx restart Configurations The main configuration file located in /etc/nginx/nginx.conf And, keep all the virtual host files inside the sites-available folder located at /etc/nginx/. Should make symlink with sites-enabled folder. ln -s /etc/nginx/sites-available/test  /etc/nginx/sites-enabled/test  where test is the virtual host config file. Sample virtual host with PHP supports: server {     listen 80;     server_name 192.168.18.129;     rewrite_log on;     #access_log /var/log/nginx/local.access.log;     #error_log /var/log/nginx/local.error.log;     root /var/www;     gzip on;     gzip_min_length 1000;     location / { autoindex on;         index index.php index.html;     }       # different location directive     location /laravel {         alias /var/www/laravel/public;         index index.php;