Installing Bonobo Git Server under Windows 7 with HTTPS and Windows authentication (user side)

This post is the second part (and final) about how to install Bonobo Git Server under Windows 7 over HTTPS with Windows authentication. In this post I will explain how to connect and download a project as user. As prerequisite, you need an already installed and configured Git server, see my previous post.

Create your user at the server and check permissions

  1. Open your web browser and type:
    https://<server_ip>/Bonobo.Git.Server.Interface

    1. As explained when installing the server, the Git server uses a self-signed certificate for secure transfer protocol (HTTPS) that can not be validated. This kind of certificates are ONLY acceptable for intranet pourposes (never for public servers). Your web browser will show an error screen about not being able to validate the identity of the SSL certificate owner (that is the Git server administrator). You must add a permanent exception to access the Git server web page.
    2. You will be prompted to enter your user and password. Use your windows domain user and password:
      User: <your_domain>\<your_user>
      Pass: <your_user_password>
  2. Once you are logged in for the first time, nothing will be available to your user. The reason is that you do not have any permissions, associated repositories or groups. The administrator of the Git server has to set up your account. However, this test has three objectives. First, you have checked the availability of the server to your computer. Second, this first log in has created you account. Finally, if you click on your user name (top right corner), you can edit your user information. You should take a few seconds to enter valid information: real name and surname, and your e-mail account, since this data will be used to store your credentials while pushing to repositories.

Install Git

  1. Download (and install) the latest version of Git at:
    http://git-scm.com/download/win

    1. Click next on every screen. If you don’t want to pollute your context menu, be sure to uncheck “Windows Explorer Integration” at the program features screen.
    2. If you are really brave ;), use the Git Bash console to work with the repositories. Otherwise, install a user-friendly GUI client as explained below. I usually use both, each one has its own advantages and disadvantages.

Install a Git Client with graphical user interface

There are several Git clients with GUI, see here. I recommend you to use SmartGit/Hg for non-commercial projects, because it is free, frequently updated, and plenty of features.

  1. Install the Java Runtime Environment 8 update 25 (or higher). You can download it from here. I recommend to install both x86 (32 bits) and x64 (64 bits) versions under a 64 bits Windows operative system.
  2. Download SmartGit. Choose the “Installer without JRE”, since you have already installed Java in the previous step.

Creating the folder for cloning a repository

  1. As explained before in step 1, the Git server uses a self-signed certificate. SmartGit or any other client will complain about not being able to validate the identity of the server. Therefore, it is mandatory to disable SSL validation for each new repository manually. A bare “git clone” command will not work.
    Solution:

    1. Create a new directory called <project_name> anywhere on your hard drive. The repository will be cloned inside.
    2. Create a file named “gitclone.sh”. Edit the file and copy the code at the end of of this post. Copy “gitclone.sh” to the previously created folder.
    3. Open Git Bash and browse to that folder (with linux-like commands ‘cd’ and ‘ls’). If you selected during the installation shell integration, right-Click on the new directory and select “Git Bash Here”.
    4. Once Git Bash is inside the folder, type in the terminal:
      gitclone <project_name> <your_domain_user_name>
      and hit enter.
  2. In SmartGit, open the existing local repository (Repository -> Add or Create), and click the Pull button.
  3. If you are able to successfully open the project an pull the repository, remove the “gitclone.sh” file, which is no longer needed.
  4. Always use your Windows credentials (user and password), following username scheme: DOMAIN\<username> for pulling and pushing to the server.

Resources

It is advisable to take a look at some online tutorials to grasp the surface of what can be done with Git. You may start with these ones:

gitclone.sh



#!/bin/sh

function usage
{
echo -e "usage:\t\tgitclone <git_project_name> <your_windows_login_username>"
echo -e "example:\tgitclone MyProject xmellado"
exit
}

if [ $# -eq 0 ]; then
echo "Your command line does not contain arguments. Two arguments are expected."
usage
elif [ $# -eq 1 ]; then
echo "Your command line contains $# argument. Two arguments are expected."
usage
elif [ $# -gt 2 ]; then
echo "Your command line contains $# arguments. Only two arguments are expected."
usage
fi

GIT_PROJECT_NAME=$1
GIT_USER_NAME=$2

echo "Initializing empty Git repository"
git init
echo "Disabling SSL verification since the Git server uses a self-signed certificate"
git config http.sslVerify false
echo "Adding the remote server"
git remote add origin https://<your_domain&gt;\\$GIT_USER_NAME@<server_IP>/Bonobo.Git.Server/$GIT_PROJECT_NAME.git
echo "Increasing buffer size for large transfer operations (maximum 512 MB)"
git config http.postBuffer 524288000
echo "Pulling files from remote server"
git pull origin master
echo "Set local master branch to track origin/master branch"
git branch -u origin/master


 

Installing Bonobo Git Server under Windows 7 with HTTPS and Windows authentication (server side)

If you have at work, or at home, a Windows domain and you want to install your own Git server, Bonobo Git Server may be your choice, since it is easy to install, configure and administrate. I chose this Git server implementation at work, because it allowed us to use our Windows domain users and passwords without the need for creating new ones specially for the source control management tool.

Bonobo Git Server has a decent documentation, FAQ, and forum to help you while installing this software. I will include some steps from the installation guide, from the FAQ and I will add a few new steps for using HTTPS as communication protocol. Let’s start:

  1. Get the Bonobo Git Server from its website.
  2. Go to the installation guide and make sure that you have all the prerequisites properly installed and configured. In this case under Windows 7:
    1. Install IIS 7 on Windows Vista and Windows 7. When installing IIS7, leave the default options.
    2. .NET Framework 4.5. Install it using Windows Update.
    3. ASP.NET MVC 4. Install it using the standalone installer and don’t forget to register MVC framework with your IIS as explained in the prerequisite webpage:
      1. Windows 7. Following the same procedure that you used to install IIS 7, add the ASP.NET feature. IIS -> WWWS -> Application Development Features -> ASP.NET 4.5.
      2. Run from the command line with administrator privileges “%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -ir”.
  3. Now, install Bonobo Git Server following its instructions.
    1. To open IIS Manager, click Start, type “inetmgr” in the Search Programs and Files box, and then press ENTER.
    2. When converting the Bonobo Git Server into and application select as application pool: ASP.NET 4.0.
  4. Restart the computer and check that http://localhost/Bonobo.Git.Server is accessible.
  5. Now follow the Bonobo Git Server Windows Authentication instructions.
    1. In order to complete the section “How to configure IIS?”. Enable Windows and basic authentication. The complete path for Windows 7 and 8 is:
      Control panel
      Programs and Features
      Turn Windows Features on or off
      Expand: Internet Information Services => World Wide Web Services => Security
      Select “Basic Authentication”
      Select “Windows Authentication”
    2. Restart the computer.
    3. Follow the “How to configure IIS?” instructions.
    4. Test the interface website works with HTTP.
  6. If the webpage does not show images, follow the FAQ answers for “Bonobo Git Server doesn’t server CSS”.
  7. Once the first user, which will be the administrator, is logged in at the interface webpage, set:
    <add key=”ShouldImportWindowsUserAsAdministrator” value=”false” />
    in both, server and interface, to avoid that any new user will gain administrator privileges.
  8. If you want to secure your connection with HTTPS:
    1. Go to the ISS Manager and create a SSL certificate as explained in How to Set Up SSL on IIS 7  The Official Microsoft IIS Site. Section “IIS Manager” -> “Obtain a Certificate”.
      1. Launch “Internet Information Services (IIS) Manager” (execute inetmgr) -> Select the Server field -> Server Certificates.
        https_001
      2. Create Self-Signed Certificate. Use a descriptive name like “Git SSL certificate”.
        https_002
    2. Create an SSL Binding:
      1. Select the “Default Web Site” and click on “Bindings”.
        https_003
      2. Select “https” and your self-signed certificate at the bottom of the dialog.
        https_004
      3. The result should look like this:
        https_005
    3. Require SSL for the Bonobo Git applications.
      1. Select the Bonobo Git Server application in IIS7.
        https_006
      2. Click on SSL Certificates, requiere SSL and accept client certificates.
        https_007
      3. Click on apply (top right corner).
      4. Do the same for the Bonobo Git Interface application.
    4. Restart and you should be able to access the main Bonobo Git webpage with HTTP and HTTPS.
  9. Self-signed certificates can not be validated and are ONLY acceptable for intranet purposes (never for public servers, since man in the middle attacks may happen). Git bash or any other client will complain (for example, see SmartGit SSL Certificate Problem). The solution is to disable SSL validation for each new repository manually. I know, it is a bit painful.
    1. Create a new directory called <project_name>
    2. Open Git Bash and browse to that folder or right-Click on the new directory and select “Git Bash Here”.
    3. Enter the following command lines:
      git init
      git config http.sslVerify false
      git remote add origin https://<server_IP_address>/Bonobo.Git.Server/<git_project_name&gt;.git
      git config http.postBuffer 524288000 (see point 10)
      Alternatively, you can use a small script to make this process faster,  a bit better, and easier. Please, take a look at the user side post.
  10. To avoid crashes while making “big” pushes. Execute:
    git config http.postBuffer 524288000
    at the client side folder with Git Bash.  See Bonobo Git Server FAQ. Apply all the changes in the section Cloning Error – RPC failed.
  11. For uploading and downloading big chunks of data over SSL, you need to change (increase) your “uploadReadAheadSize”:
    1. Launch “Internet Information Services (IIS) Manager” (execute inetmgr)
    2. Expand the Server field -> Expand Sites -> Select the site you want to make the modification for (Bonobo.Git.Server).
    3. In the Features section, double click “Configuration Editor”
      snap008
    4. Under “Section” select: system.webServer/serverRuntime
    5. Modify the “uploadReadAheadSize” section (“The value must be between 0 and 2147483647.”). Set it to 2147483647 (2GB).
      snap009
    6. Click Apply and restart the web site.
  12. Finally, it is mandatory to open the HTTPS port (443) in the windows firewall for allowing the connection of other computers to the Git Server. Open the Control Panel -> System and Security -> Windows Firewall, click Allow a program or feature through Windows Firewall and scroll down to “Secure World Wide Web services (HTTPS)” and check Domain and/or Home network (the most restrictive that works).
  13. Under Windows 7, there is a bug in IIS7 regarding SSL. Install Windows 7 patch KB2634328, or you will not be able to push/pull big files over HTTPS. See Bonobo Git Server FAQ.

    Optional:
  14. Change repository location. As a general policy, I always save data in other partition than “C:”. Go to the Bonobo Git Server Interface, login and click on settings.
    1. Change the repository location.
    2. Make sure ISS_ISURS have read/write/modify access to the new folder. See Bonobo Git Server FAQ.
  15. If you have old repositories, place them inside the repository directory and restart the Git server. They will be discovered next time the application starts.

    Other problems:
  16. When login with your Windows user, it may not work. Try to access the web interface with your credentials. If you are successful, use them to push and clone. If the credentials don’t work, try the following username scheme: DOMAIN\username or username@DOMAIN, and note that DOMAIN is not the name of your git server instance, but your intranet/Windows/ActiveDirectory domain. See Ad Authentication and Push.

Installing Blender and Ogre scene and mesh exporter under Windows 7

If you are working with Ogre, you will need to model and export objects to build your scene. The following instructions will help you to install and configure Blender and the Ogre scene and mesh exporter (but don’t forget to read the official threads and readme files):

  1. Download the latest version of the Ogre scene and mesh exporter from the official Ogre forum thread. Unzip it and read carefully the documentation included.
  2. Download and install the exporter supported version of Blender.
  3. Find the Python version that Blender is using. Download it from the official page and install it.
  4. Add Python installation folder to the system variable PATH. Add a user or system variable named PYTHON pointing to the Python executable.
  5. Download and install the Ogre Command-line Tools. You may want to update OgreMeshUpgrader.exe and OgreXMLConverter.exe with the versions compiled from the latest Ogre sources. In this case, move the installed OgreMeshMagick.exe and OgreMain.dll to a sub or separate folder. Replace the mesh upgrader and XML converter executables and the OgreMain.dll with the ones you have compiled, as explained in another post. Add any created folder to the system variable PATH.
  6. Open Blender and go to File -> User Preferences. Click on Addons tab. At the bottom of the floating window, click on the “Install from file…” button and select the io_export_ogreDotScene.py script.
  7. Make sure that the check box at the right edge of the newly created addon is selected in order to activate it. Click on “Save it as default” for loading the addon each time Blender starts.
  8. Restart Blender and check that two new export formats have appear at File -> Export: Ogre3D and realXtend Tundra.
  9. Configure Ogre exporter options in Blender. Look for an “Ogre” checkbox at the end of the Blender menus (near “Ogre Help”), whose tooltip says “toggle Ogre UI”. Check it. Then, go to the tool box at the right, scene properties, and a new section “Ogre Configuration File” should have been appeared at the bottom. Make sure that, at least, the OGRETOOLS paths are pointing to the Ogre command-line executables.

    Ogre Exporter Options

    Ogre Exporter Options in Blender

  10. Download and install Ogre Meshy for being able to easily load, inspect and check your exported models. Add the executable path to the “Ogre Configuration File” section of the exporter.
  11. Download and install ImageMagick binaries for dealing with texture image conversions. Add the executable path to the “Ogre Configuration File”.
  12. Optional steps:
    If you need support for DDS texture files or realXtend Tundra, check the exporter readme file to download and install the utilities to support those formats.

The final step is to export the scene that Blender shows by default with a cube, a camera and a light, and check with Ogre Meshy that everything is properly exported.

CMake and the executable stack size in Visual Studio

Today I have been struggling with my first mystical error at my new job. The C++ project was able to compile and execute. At least, the screen was showing the 3D initial menu. However, when I tried to open any of the sub-applications where big 3D models where used, strange exceptions were thrown, such as out of memory when loading a texture, vertex buffer can not be allocated, and similar ones depending on the sub-application executed.

I have been porting the project from a manually maintained .sln file to CMake. So, the first step was to make sure that the original executable was working, and it was. Then, I compared the compilation and linking flags in the both project files, and I removed the new flags, which were not present in the original solution, one by one. Finally, I discovered (after 5 hours) that CMake (version 2.8.10) adds to the linker flags /STACK:10000000, which means that the heap size is initialized to 10MB, instead of the default 1MB. Adding the following lines to the main CMake file:
STRING(REGEX REPLACE “/STACK:[0-9]+[ ]” “” CMAKE_EXE_LINKER_FLAGS “${CMAKE_EXE_LINKER_FLAGS}”)
SET(CMAKE_EXE_LINKER_FLAGS “${CMAKE_EXE_LINKER_FLAGS}”
CACHE STRING “Flags used by the linker.”
FORCE
)

solved the problem. Note that a similar problem may occur if there are multiple threads in the application, since the total amount of memory used will be num_threads by stack_size.

Note that this flag must be also removed from all your project dependencies that use CMake for generating project files. Then, the modified dependencies must be rebuild and finally your project, too.

Compiling Bullet v2.81 rev2613 under Windows 7 with Visual Studio

My project uses the Bullet physics engine together with the Ogre graphics engine, so the compilation of Bullet must be done with certain settings to properly build the final executable. These settings are, fast floting point and, the most important, DLL runtime of C/C++ (that is, /MD in release and /MDd in debug).

  1. You can download the latest version of Bullet and in the download section of the project’s code webpage.
  2. Open the CMake GUI and select the folder where you decompressed the source files using the “Browse Source” button. Select a folder where the library will be built with the “Browse Build” button.
  3. You can modify the options at your will, but I used the following:
    • BUILD_CPU_DEMOS
    • BUILD_DEMOS
    • BUILD_EXTRAS
    • BUILD_MULTITHREADING
    • USE_DX11
    • USE_GLUT
    • USE_GRAPHICAL_BENCHMARK
    • USE_MSVC_FAST_FLOATINGPOINT (as Ogre graphic engine does)
    • USE_MSVC_RUNTIME_LIBRARY_DLL (as Ogre graphic engine does)
    • USE_MSVC_SSE
    • In my CMake project, some libraries have a different name only in the debug configuration. Therefore, make sure that CMAKE_RELWITHDEBINFO_POSTFIX is empty.
    • Remove the MinSizeRel configuration if you are not using it.
  4. Configure and generate the project.
  5. Build it in MSVC and run some of the tests.
  6. You are now ready to include this library in your project together with Ogre.

Compiling CEGUI under Windows 7 with Ogre support in Visual Studio

You can download the latest version of CEGUI, I used 0.7.7, and its dependencies in the download section of the webpage.

The compilation instructions can be found in the Main docs, section Supported systems and compilation. However, this documentation is not enough detailed to build this library with Ogre support.

Here are some additional steps and tips:

  1. Make sure that you have installed Ogre as an SDK. Unfortunately, CEGUI does not use CMake for generating the project files. As a consequence, an Ogre build with CMake must be installed in order to properly import headers and libraries in CEGUI.
  2. As explained in the documentation, unzip the sources. Then, the dependencies inside the sources folder.
  3. Go to projects/premake and edit the file config.lua. Make the following changes:
    1. WANT_RELEASE_WITH_SYMBOLS_BUILD = true
      WANT_STATIC_BUILD = false
      I need the release with debug symbols configuration, besides release and debug, and I want to generate only dlls.
    2. STATIC_BUILD_WITH_DYNAMIC_DEPS = true
      If you need the static versions of the libraries for using them with Ogre, make sure this is set to true, because Ogre links by default against the dynamic version of the C++ libraries. If you try to link an executable to a library that has C++ dynamic dependencies (/MD) and, at the same time, to another library that has C++ static dependencies (/MT), you will end up with a linking error 2005 in Visual Studio or potential errors passing CRT objects across DLL boundaries. Never mix C/C++ runtime libraries. Everything must be compiled with /MT or /MD (/MTd or /MDd for debugging).
    3. OGRE_PATHS = { “D:/Program Files (x86)/OGRE”, “include/OGRE”, “lib/$(Configuration)” }
      OIS_PATHS = { “D:/Program Files (x86)/OGRE”, “include/OIS”, “lib/$(Configuration)” }
      Make sure that this paths point to the Ogre SDK folder. The $(Configuration) in the linking path will be replaced in Visual Studio by the current configuration when building. Note: the release with debug info build will not work, because Ogre uses the typical RelWithDebInfo CMake name and CEGUI uses a different name, ReleaseWithSymbols. Open the solution file, choose the ReleaseWithSymbols configuration, right click on the CEGUIOgreRenderer project, go to properties, Configuration Properties, Linker, General, Additional Library Directories. Replace D:/Program Files (x86)/OGRE/lib/$(Configuration) by D:/Program Files (x86)/OGRE/lib/RelWithDebInfo.
    4. CEGUI_EXTRA_PATHS = {
      { “D:/Program Files (x86)/boost/boost_1_51”, “”, “lib”, “CEGUIOgreRenderer” },
      { “D:/Program Files (x86)/boost/boost_1_51”, “”, “lib”, “CEGUISampleHelper” },
      { “D:/Program Files (x86)/Microsoft DirectX SDK”, “Include”, “Lib/x86”, “CEGUIDirect3D9Renderer” }
      }
      Add the boost path for building the OgreRenderer and the SampleHelper. Besides, add the path to the DirectX SDK for the Direct3D9Renderer.

     

That’s all. Run the *.bat in the config.lua folder for your Visual Studio version. If your MSVC++ version is missing, use the nearest version. MSVC++ will take care of upgrading the project files.

Installing OpenNI 1.5 under Windows

The OpenNI 1.5 library for developing software with Kinect can be installed under Windows 7 x86-64 SP1 following this instructions:

  1. Download and install the drivers. Choose the proper version, x86 or x86-64, according to your OS version.
  2. Install OpenNI: openni-win32-1.5.2.23-dev.msi.
  3. Install NITE: nite-win32-1.5.2.21-dev.msi.
  4. Install SensorKinect: SensorKinect091-Bin-Win32-v5.1.0.25.msi

Note that the software for steps 1 and 4 comes from a GitHub repository, and the software for steps 2 and 3 should come from the official OpenNI website. Besides, note that the driver must match your system type (x86 or x86-64), but the OpenNI software should match your development environment type, which may be different, like in my case (x86 aka win32).

Never install the official OpenNI SensorKinect package (about 900KB), because Kinect will not work. Use the mentioned GitHub package (about 4MB).

Check your installation with any of the OpenNI demos.

Important: the official page has released OpenNI v2.0 (in beta stage), which completely breaks the compatibility with OpenNI 1.5.