lunedì 25 giugno 2012

Convert HG to Git repository






On Ubuntu:


~# ls
repository.hg
~# apt-get install hg-fast-export
~# git init new_repository.git



~# ls
repository.hg new_repository.git
~# cd new_repository.git
~/new_repository.git# hg-fast-export -r ../repository.hg



You will recieve a summary text in the end, like


git-fast-import statistics:
---------------------------------------------------------------------
Alloc'd objects: 5000
Total objects: 478 ( 14 duplicates )
blobs : 133 ( 14 duplicates 54 deltas of 133 attempts)
trees : 216 ( 0 duplicates 194 deltas of 196 attempts)
commits: 129 ( 0 duplicates 0 deltas of 0 attempts)
tags : 0 ( 0 duplicates 0 deltas of 0 attempts)
Total branches: 4 ( 1 loads )
marks: 1024 ( 129 unique )
atoms: 16
Memory total: 2344 KiB
pools: 2110 KiB
objects: 234 KiB
---------------------------------------------------------------------
pack_report: getpagesize() = 4096
pack_report: core.packedGitWindowSize = 1073741824
pack_report: core.packedGitLimit = 8589934592
pack_report: pack_used_ctr = 901
pack_report: pack_mmap_calls = 215
pack_report: pack_open_windows = 1 / 1
pack_report: pack_mapped = 331971 / 331971
---------------------------------------------------------------------


In the end do:


~/new_repository.git# git checkout HEAD



Test your repo with git log.

giovedì 14 giugno 2012

Migrate PhpBB3 on Ubuntu server

PhpBB version: 3.0.9
Backend: Mysql
Mode: Fcgi



Dump the database

ubuntu~# mysqldump -u root -p phpbb3 > /tmp/phpbb3.sql


On the new machine

new~# apt-get update && apt-get install phpbb3


During the installation, choose to configure mysql/phpbb3 via debconf and answer about passwords in this order
* Mysql root password
* Phpbb3 database password
* Phpbb3 admin interface password

Afterwords, setup the web server. You have a configuration example in /etc/phpbb3/apache2.conf; you can directly copy this file in your /etc/apache2/sites-available directory and run

new:/etc/phpbb3# cp apache2.conf /etc/apache2/sites-available/phpbb3
new:/etc/phpbb3# cd /etc/apache2/sites-available/
new:/etc/apache2/sites-available# a2ensite phpbb3 && service apache2 reload


Try to login and surf the admin interface (APC). If you had a custom theme in the previous server, do the follow:

ubuntu~# scp -r /srv/phpbb3/theme/ (or wherever it is) new:/usr/share/phpbb3/styles


Important , make a sym link in /etc/phpbb3/styles directory to make phpbb see the custom theme

new~# cd /etc/phpbb3/styles
new:/etc/phpbb3/styles# ln -s /usr/share/phpbb3/styles/theme theme


Once the link is ok, configure the new theme in the APC (administrative panel)

If everything seems to be fine, move on and restore the database

new~# mysql -u root -p phpbb3 < phpbb3.sql


Configure FCGI

new~# apt-get install php5-cgi
new~# cd /etc/apache2/
new:/etc/apache2/# a2dismod php5
new:/etc/apache2/# service apache2 restart


Setup fcgi environment

new~# cd /srv (or wherever you'll locate it)
new:/srv# mkdir php-fcgi
new:/srv# cd (alt+.)
new:/srv/php-fcgi# ls
phpbb.fcgi
phpbbrc -> /etc/php5/cgi/


phpbb.fcgi

#!/bin/sh
PHP_FCGI_MAX_REQUESTS=10000
PHP_FCGI_CHILDREN=0
export PHPRC=/srv/php-fcgi/php53rc
export PHP_FCGI_MAX_REQUESTS PHP_FCGI_CHILDREN
# Replace with the path to your FastCGI-enabled PHP executable
exec /usr/bin/php-cgi


NOTE: phpbbrc is a link to /etc/php5/cgi/ directory

The virtualhost section should be something like

<VirtualHost *:80>
    ServerName forum.example.org
    DocumentRoot /usr/share/phpbb3/www
    ErrorLog /var/log/apache2/forum_error.log
    CustomLog /var/log/apache2/forum_access.log combined
    Alias / /usr/share/phpbb3/www/

   <Directory>
      Order allow,deny
      Allow from all
      Options +ExecCGI
      AddHandler fcgid-script .php
      FcgidWrapper /srv/php-fcgi/phpbb.fcgi .php
   </Directory>
</VirtualHost>



Try to load a forum page and check with

new~# ps ax | grep cg[i]
2248 ? S 0:00 /usr/bin/php-cgi


that php-cgi is running ..