Create a file with the extension .reg and double click on it. If you didn’t use the default username in Gitosis’s installation, you will have to adapt the script.

The result will be this :

Changed Gitosis path

One thing that I had to do, was to move Gitosis repository path. I installed Gitosis in the default home of the user git. (/home/git/…) The problem was that I didn’t have enough free space on that hard drive.

To solve that problem, I moved the home folder of git to my “D” drive.

All the magic start by editing : /etc/passwd logged with you Administrator user. You will have to change the path (/home/git) to a new path. In my case, I changed it to : /cygdrive/d/gitosis-repo

In this guide, I’ll describe raw problems that I found with the solution. Before I came with this guide, I try to install Gitosis on 3 computers and 4 Virtualbox installation by follow tutorial that I found. I kept the errors that I made and I’ll explain that I found in this guide.

To save you lot of trouble, be sure that you put this line “loglevel = DEBUG” in gitosis.conf .

The errors are not shown in order.

If you can’t connect by ssh, be sure that you open the sh port in your firewall. By default it’s the port 22.

There could be multiple reason for that one. Mostly is because you don't have the permission to write. Start by looking into gitosis.conf if your user have the permission for the repository. Also check if you put your ssh-rsa key into keydir. There another possible reason, and it was really hard to find. Check the file /home/git/.ssh/authorized_keys . One error that I made was to add my Windows user into this file and after that I add my key into keydir. The result was when I pushed, Gitosis found my key, but it didn't have the command : " command="gitosis-serve xxx" ". If you have twice your key in that file, remove the line that wasn't generated by Gitosis.

Here it's what authorized_keys look like after adding key into keydir.

If you are here, it’s because you’re lost or you have problems installing a git repository server on Windows. I really hope it’s for the second reason .

I choose the wrote this blog even if I know there are a lot of blogs about this subject, because none of them worked for me. Before I came with this guide, I try to install Gitosis on 3 computers and 4 Virtualbox installation by follow tutorial that I found.

I’ll keep this blog as simple as possible. You won’t need to understand the steps that we will do (It won’t hurt, if you try). I’ll give you the steps to do it right the first time and do a second blog about troubleshooting : Git Repository Server Gitosis on Win7 : Troubleshooting.

You will start by downloading and installing/configuring your Windows computer and after that we will configure Gitosis. I’ll do a quick overview how to setup your client computer (could be on the same computer) to connect to your git repository on Windows. To keep it simple, I’ll call that computer your “server” or “git server”.

Setuptools for cygwin : Allow us to install Python applications (Gitosys) easily : download from here or here and be sure to select the 2.5 version (.egg)

Before installing these softwares, we have to open Windows Firewall. If you have another firewall, be sure to apply the same change that we will do.

I found a really good guide how to do that, so I’ll give credit to the guy who wrote it. Just follow this guide, step by step, but at the end just change the port for 22 instead of 80 (you can change the description HTTP for SSHD). Go here

Cygwin’s installation

Launch setup.exe . You will have to add these applications. (Enter there name in the search box and select them)

python -> python 2.5.x (Don’t select versions over 2.5.x)

ssh -> openssh

git -> git , gitgui, git-completion

vim -> vim

When the installation is completed, run Cygwin with the Administrator rights. (Starts menu, Cygwin, Cygwin Bash (right click)

You must see this screen

Configuring Git Server

GOOD. The fun starts here. We have to properly setup the server in Cygwin before installing Gitosis. We will configure Python and setup a sshd server (Gitosis use ssh). In the next steps, you will see that I used a user named : “bob”, in your case it will be your Windows account.

Installing Setuptools

Go to the folder where you download the application. In my case I choose the default folder c:\Users\bob\Downloads

You will have few questions to answer. I put the answer after each questions in the description below.

bob@bob-PC ~/.ssh
$ ssh-host-config
*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_key
*** Info: Creating default /etc/ssh_config file
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/READ
ME.privsep.
*** Query: Should privilege separation be used? (yes/no) yes
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges. Should this script attempt to create a
*** Query: new local account 'sshd'? (yes/no) yes
*** Info: Updating /etc/sshd_config file
*** Warning: The following functions require administrator privileges!
*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
*** Query: Enter the value of CYGWIN for the daemon: [] ntsec tty
*** Info: On Windows Server 2003, Windows Vista, and above, the
*** Info: SYSTEM account cannot setuid to other users -- a capability
*** Info: sshd requires. You need to have or to create a privileged
*** Info: account. This script will help you do so.
*** Info: You appear to be running Windows 2003 Server or later. On 2003
*** Info: and later systems, it's not possible to use the LocalSystem
*** Info: account for services that can change the user id without an
*** Info: explicit password (such as passwordless logins [e.g. public key
*** Info: authentication] via sshd).
*** Info: If you want to enable that functionality, it's required to create
*** Info: a new account with special privileges (unless a similar account
*** Info: already exists). This account is then used to run these special
*** Info: servers.
*** Info: Note that creating a new user requires that the current account
*** Info: have Administrator privileges itself.
*** Info: No privileged account could be found.
*** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** Query: Do you want to use a different name? (yes/no) no
*** Query: Create new privileged user account 'cyg_server'? (yes/no) yes
*** Info: Please enter a password for new user cyg_server. Please be sure
*** Info: that this password matches the password rules given on your system.
*** Info: Entering no password will exit the configuration.
*** Query: Please enter the password:
*** Query: Reenter:
*** Info: User 'cyg_server' has been created with password 'encore00'.
*** Info: If you change the password, please remember also to change the
*** Info: password for the installed services which use (or will soon use)
*** Info: the 'cyg_server' account.
*** Info: Also keep in mind that the user 'cyg_server' needs read permissions
*** Info: on all users' relevant files for the services running as 'cyg_server'.
*** Info: In particular, for the sshd server all users' .ssh/authorized_keys
*** Info: files must have appropriate permissions to allow public key
*** Info: authentication. (Re-)running ssh-user-config for each user will set
*** Info: these permissions corrently. [Similary restrictions apply, for
*** Info: instance, for .rhosts files if the rshd server is running, etc].
*** Info: The sshd service has been installed under the 'cyg_server'
*** Info: account. To start the service now, call `net start sshd' or
*** Info: `cygrunsrv -S sshd'. Otherwise, it will start automatically
*** Info: after the next reboot.
*** Info: Host configuration finished. Have fun!
bob@bob-PC ~/.ssh
$

Now we start the service.

bob@bob-PC ~/.ssh
$ net start sshd
The CYGWIN sshd service is starting.
The CYGWIN sshd service was started successfully.
bob@bob-PC ~/.ssh
$

Let’s test it. We will connect and exit. You must have something like describe below.

Gitosis is a service that will allow us to create multiple git repositories. There are other alternatives to Gitosis like MSysGit, but Gitosis is a more complete solution. You only need one unix account to handle your multiple git users with Gitosis, instead of having one account by user.

Let’s create that git user. I’ll create a user named “git” with a password “userspassword”. It will create a Windows user.

We have to connect through ssh using this new user : git to continue Gitosis’s configuration

bob@bob-PC ~/sources/gitosis
$ ssh git@localhost
git@localhost's password:
Could not chdir to home directory /home/git: No such file or directory
Copying skeleton files.
These files are for the user to personalise their cygwin experience.
They will never be overwritten nor automatically updated.
`./.bashrc' -> `/home/git//.bashrc'
`./.bash_profile' -> `/home/git//.bash_profile'
`./.inputrc' -> `/home/git//.inputrc'
git@bob-PC ~
$

Because Gitosis use only one account (git), Gitosis need a way to handle permissions. There is a config file for this purpose named : "gitosis-conf" and a folder named "keydir". Each time you want to modify, add or update permissions or change repositories, you will have to make changes in the repository : gitosis-admin. That repository came with Gitosis and it's a git repository, so you have to clone that repository and push back the changes.

For this time only, you will have to specify the complete path where gitosis-admin is.
git clone localhost:/home/git/repositories/gitosis-admin.git

That file was generated with gitosis-init command. We will add a line to show debug message when we do git commands. You can remove it later when you will be familiar with Gitosis, but right now it will be useful to debug problems. To add text with Vim, use the letter "i" , enter your text and "espace" to exit insert mode. To save the file, just press "espace" key and enter : wq . That will write and quit.

At this point our Windows user bob should have Administrator rights. You shouldn't have to use the user git to edit gitosis-admin anymore. To be sure that the config was updated in Gitosis, run this command :

OH YA ! It's done ! We got our first repository created and added to Gitosis.

In this guide, the client and server are on the same computer. If you used this guide to setup your company repositories, there are few alternatives you could use to setup your clients. You can install cygwin or MSysGit or TortoiseGit. I prefer cygwin because all the tools are included in the same installation.

I want to let you know that since the release of Caucho Resin 4.0, Atmosphere applications can be deploy on Resin and will be supported natively. Resin 4.0 implements Servlet 3.0.

That’s really good. Another web server that is supported.

What about the Websocket’s Caucho implementation… nah ! There implementation is too buggy right now. I suppose the code it using a early release of the Websocket specs, and never updated it. Anyway, Websocket application won’t work on Resin 4.0

Just a little note that we try to add Websphere native support for Atmosphere. We work really hard to find an API that could allow us to do that, but is simply impossible.

We were able to get in touch with the dev team of Websphere and the dev team of WebSphere Application Server Feature Pack for Web 2.0. They have demo that used bayeux for comet application or JMS to simulate asynchronous connections, but it’s not a complete asynchronous solution.

Even with the addon WebSphere Application Server Feature Pack for Web 2.0, you can’t suspend and resume a connection. Websphere server doesn’t support that. It’s not supported in WAS 7.0, but in 8.0 alpha there should be Servlet 3.0 support.

Until IBM do something about that, or wait for WAS 8.0, you will still be able to deploy Atmosphere application on WAS but it will use BlockingIO (one blocking thread by connection).

If that is not enough for you, I suggest Glassfish as alternative. Of course, we will continue to monitor the situation. Maybe the community call could be enough to wakeup them

Usage: com.sun.grizzly.http.servlet.deployer.GrizzlyWebServerDeployer
-a, --application=[path] Application(s) path(s).
Application(s) deployed can be :
Servlet(s), war(s) and expanded war folder(s).
To deploy multiple applications
use File.pathSeparator
Example : -a /app.war:/servlet/web.xml:/warfolder/
-p, --port=[port] Runs Servlet on the specified port.
Default: 8080
-c, --context=[context] Force the context for a servlet.
Only valid for servlet deployed using
-a [path]/[filename].xml
--dontstart=[true/false] Won't start the server.
You will need to call the start method.
Useful for Unit testing.
Default : false
--libraryPath=[path] Add a libraries folder to the classpath.
You can append multiple folders using
File.pathSeparator
Example : --libraryPath=/libs:/common_libs
--autodeploy=[path] AutoDeploy to each applications.
You could add JSP support.
Just add a web.xml that contains Jasper
Example : --autodeploy=/autodeploy
--webdefault=[path] webdefault to be used by all applications, can be file or dir with multipe web.xmls.
If you want to add only one webdefault point it to web.xml file,
If you want multiple files to be included put them in one dir and provide this location here.
Example : --webdefault=webdefault.xml
--cometEnabled=[true/false] Starts the AsyncFilter for Comet.
You need to active this for comet applications.
Default : false
--websocketsEnabled=[true/false] Starts the AsyncFilter for Websockets.
You need to active this for websockets applications.
Default : false
--forceWar=[true/false] Force war's deployment over a expanded folder.
Will deploy the war instead of the folder.
Default : false
--ajpEnabled=[true/false] Enable mod_jk.
Default : false
--watchInterval=[seconds] Watch interval to scan for new applications to deploy in work folder.
Default : -1 ; disabled
--watchFolder=[path] Folder to scan for new applications to deploy in work folder
Default : none

Websocket support

The first feature added was Websockets support. It can be enabled at command line by using the parameter –websocketEnabled=true . That will allow you to deploy Websocket applications.

Watch folder

This feature is interesting, because most of the web container have it. Grizzly Deployer will watch a specific folder to applications to deploy. When this feature was added, I remove the need to specify a application to deploy by command line.
To enable this feature you need to use the command line parameter –watchFolder=[path]. It can be used with this other parameter : –watchInterval=[seconds].

The parameter –watchInterval is used to create a watchdog that will monitor the watch folder. If the parameter –watchInterval is not present, when Grizzly Deployer starts, it will check
all applications that are in the watch folder at launch time and will deploy them, but it won’t monitor the folder after that.

When both of theses parameters are used, it will create a watchdog that will deploy and undeploy application put in the watch folder, and remove from that folder. If you deploy an application at command line and put another application with the
same context name in the watch folder, the application in the watch folder won’t be deploy twice.

Embedded Grizzly Deployer

Grizzly Deployer could already be embedded trough his API, but we got few feedback about to make it simplier. The problem wasn’t the API, it just that most people will only use the main part of Grizzly Deployer : deploy a war.

So to make it easier and faster to implement, I did a little refactoring. We now have 2 main config classes we could use to launch an Embedded Grizzly Deployer : DeployerServerConfiguration and DeployableConfiguration.

DeployerServerConfiguration

That file is used to launch Grizzly Deployer. It contains the same command line parameters. In fact, at runtime, the command line parser use that classe.

I want to share a problem that we had in our project. We were doing a real-time “Profits and Loss” server (P&L). The server sends stock updates to all the users subscribed to the stocks, basically as Google Finance or Yahoo Finance.

SIMPLE IMPLEMENTATION

I will used a basic approach (no aggregation and no optimization) to explain the problem that we had with Serialization and Hessian.

The server always keep the last value on the stocks, because when a user ask for a quote we want to send back as soon as possible the
last value (from the cache) that we had on that stock).

We kept the stock prices (BID and ASK) in a simple object : SymbolSerializable.

When a update is received for a stock, we update the values in his SymbolSerializable and send back the updated values to all
client subscribed to this stock.