Wednesday, September 30, 2009

Subversion + LDAP read only and read write

Image via Wikipedia
Here follows the Apache configuration I found working to set a repository read-only and read-write permissions. Consider read-write permissions are given by adding a user to both read-allowed and write-allowed LDAP groups, while read-only permissions are given through the read-allowed LDAP group.

  AuthType basic
  AuthBasicProvider ldap
  AuthBasicAuthoritative On
  AuthName "SmartLab Directory Server"
  AuthLDAPURL ldap://ldap/ou=people,dc=smartlab,dc=net
  AuthLDAPGroupAttributeIsDN off
  AuthLDAPGroupAttribute memberUid
    Require ldap-group cn=read-allowed,ou=groups,dc=smartlab,dc=net

    Require ldap-group cn=write-allowed,ou=groups,dc=smartlab,dc=net

Reblog this post [with Zemanta]

Thursday, September 24, 2009

Subversion merge after refactor

I recently discovered the popular Subversion VCS has a problem to apply differences to moved files. Unfortunately I discovered this after a big and time consuming refactor process so I had to find out an "easy-to-apply" solution to this problem.

Image via Wikipedia

My repository layout is something like:

+-- trunk
+-- branches
+-- refactoring

The target operation is to merge the refactoring branch onto the trunk, but to avoid blocking all other people I decide to perform the inverse: apply all updates on the trunk to the refactoring branch. On merge completion I'm going to switch the twos.

First of all I started merging the trunk onto the branch ignoring all the "Skipped missing target" messages which whould occur for each file you moved/renamed: in my case this was happening for 99% percent of the files, as it was a massive refactor, and only downloading added files (which you may still need to review).

svn merge -r 3855:HEAD

Then I moved on the trunk working copy and performed a huge diff starting from the revision in which I created the branch and stopping to the HEAD revision:

svn diff -r 3855:HEAD . > rev.3855-HEAD.diff

Next step was to open the diff file both in eclipse (right click on the checkout folder, Team/Apply patch...) and within a text editor (I used gedit, but vi or notepad++ should get you to the same results): I used eclipse to easily find unmatched entries (shown with a red cross) and applied a textual search & replace on the diff file in the text editor.

At the end of my process I had a diff file I could use to patch my branch to have it up to date against the trunk, with a few missing/unappliable patches against those files I had removed definitely from my branch.

The process was easy, but needed time and the results depends on the accuracy you perform it. But at least all my work has not been void!

BTW: if you are not mass refactorying you can use the Eclipse support to select an unmatched diff entry and move it to another file, this can be really usefull if you have moved only a few files.

Thursday, September 3, 2009

RTMPT on Tomat + Red5 as a war

I'm recently developing a Flex application and, as an Open Source addicted, I choosen to use Red5 as streaming server.

The network architecture actually is a Tomcat 6 servlet container with some wars deployed within, one of which is the Red5 streaming server.

To ensure my application could be used through internet the default RTMP protocol is not the best choice as some firewalls blocks its port, so I opted for the RTMP over HTTP, also known as RTMPT (notice the final additional T) which is able to tunnel RTMP inside HTTP.

I found a bit of confusion when I googled to configure my Red5 war so I'm going to report here the simple four steps I did to make my configuration working.

  1. Open your WEB-INF/web.xml file and add the RTMPT servlet definition and mappings (if RTMP is going to be tunneled inside HTTP we need an HTTP endpoint able to forward packets)







  2. Inside your WEB/lib you should have a Red5 jar (well, this is not my case as I use Maven for build, but Maven users will understand what I mean, right?) and you need to open it up and edit the file it contains:

    http.port = 8080

  3. Open your Tomcat 6 folder and edit the file conf/server.xml adding, if needed, an HTTP/1.1 connector for the port you want to use for RTMPT (the default port is 80, but you can set it accordingly to your needs):

    <!-- RTMPT connector redirecting to your HTTP port -->
    <Connector port="8088" protocol="HTTP/1.1"
    maxThreads="150" connectionTimeout="20000"
    redirectPort="8080" />

  4. The last and very bothering part is you need to have your streaming server war binded to the root context, so you can simply rename it to ROOT.war