Get A Sys Admin

sysadmin linux open source centos redhat rhel ubuntu apache mysql amazon ec2 s3 tutorial

Nov 29, 2008

Zend Framework + SVN + ZF Tools on CentOS part 2

This is the 2nd part of my attempt to write a tutorial about using svn and ZF to create a working environment for a small team of developers. It assumes you have followed the instructions provided here.

The following notations will be used in this part:
project is the name of your project, wherever you see project written with italics replace it with your actual project name. It should be one word.
developer is the name of the developer that is part of the team working on this project. For example john.
example.com is the name of your domain, replace it with the real name.
A # in front of the line means you have to execute those commands as root, while $ means you have to be a normal user.

1. Create the repository for the project

# mkdir -pv /var/svn
# svnadmin create /var/svn/project

2. Create project layout

# cd /tmp
# mkdir project
# cd project
# mkdir branches tags trunk

If you want to create a standard zf project:

# cd trunk
# zf create project
# ls

ATTENTION: zf create project is a command, so do not replace the word project.
You should have the standard structure now for a Zend Framework project.

3. Import the project files to repository

# svn import /tmp/project file:///var/svn/project -m "initial import"
# chown -R apache:apache /var/svn/project

4.1 Creating a user for the developer

# adduser -g users developer
# passwd developer

Repeat the above steps for each developer you want to add.

4.2 Creating a user for the project

# adduser project
# passwd project

5.1 Add a virtual host for each developer in apache conf file

You will have to figure out where your virtual hosts are defined in apache conf files. Most likely you can add the following lines to /etc/http/conf/httpd.conf

# developer sandbox
<VirtualHost *:80>
ServerAdmin someone@example.com
DocumentRoot /home/developer/www
ServerName developer.example.com
ErrorLog /home/developer/logs/error_log
CustomLog /home/developer/logs/access_log combined
<Directory "/home/developer/www/">
Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

5.2 Add a virtual host for the project

# project sandbox
<VirtualHost *:80>
ServerAdmin someone@example.com
DocumentRoot /home/project/www
ServerName project.example.com
ErrorLog /home/project/logs/error_log
CustomLog /home/project/logs/access_log combined
CustomLog /home/project/logs/svn_logfile "%t %u %{SVN-ACTION}e" env=SVN-ACTION
<Directory "/home/project/www/">
Options -Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
<Location /svn>
Options +Indexes
DAV svn
SVNParentPath /var/svn
SVNPathAuthz off
SVNIndexXSLT "/svnindex.xsl"
Require valid-user
AuthType Basic
AuthName "Subversion repository"
AuthUserFile /var/svn/project/conf/passwd
</Location>
</VirtualHost>

* Depending on your DNS settings you may have to manually add the needed records for developer.example.com/project.example.com to properly work.

7.1 Checking out to dev boxes

# su - developer
$ mkdir svn
$ cd svn
$ svn checkout http://project.example.com/svn/project/trunk .
$ cd ..
$ rm www
$ ln -s /home/developer/svn/public www

7.2 Exporting the latest version of the project

# su - project
$ mkdir svn
$ cd svn
$ svn export http://project.example.com/svn/project/trunk . --force
$ cd ..
$ rm www
$ ln -s /home/project/svn/public www

See the project page at http://project.example.com

Next time you want to update the page remove the svn directory, and re-export it as above.

8.1 Working as a developer

To update you dev box to latest version:
$ cd svn
$ svn up

Whenever you add a NEW file/directory to the project use:
$ svn add filename

Of course you replace filename with the real name of the file. The reverse of this is svn del.

When you are satisfied with your changes don't forget to commit:
$ svn commit -m "something meaningful for that idiot project manager"

8.2 Working as a project manager(?)

$ su - project
$ rm -rf svn
Repeat the steps from 7.2
Check logs for svn commits at /logs/svn_logfile

<< EOF

Labels: , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home