I’m just documenting this since I just made it work(again) in my test server, but need to implement this in my work.
I just had some headache since I lost the first server I implemented this, and didn’t have it documented anywhere, so now I’ll post here what worked for me, and some problems that I faced, and maybe this will help somebody else.
But, after I started writting this post I just asked myself: “Why not make a Script that does all that I need?”. And so I did:
The idea of this script is prepare a ambient with:
- TRAC 0.12(with locale)
- GIT server (Using Gitolite)
- New Trac Project and Git Repository
- Working Post-receive Hook integration for the new Repository and TRAC Tickets
You’ll need root permission to the Server or simillar.
SSH acess to the server (OpenSSH for example)
A working station (Another machine apart from the server, preferably your desktop or laptop).
Preparing the Script to Run
First you’ll need to copy your’s workstation RSA key to your Server(you can copy anywhare, ex: “/tmp/”)
scp ~/.ssh/id_rsa.pub root@DOMAIN_NAME:/tmp/myNewUser.pub
Note that the name of the RSA key must be the SAME name of the user you whant to have as the admin for the GIT server and the TRAC Project that will be created.
After this you can download the script into anywhere, ex:
cd /tmp wget https://github.com/arruda/TRAC-GIT-HOOKS/tarball/master tar -zxvf master cd master
Running the Script
First of all the script is divided in two parts. That’s because you have to do some manual configurations in the workinstation in the middle of the process.
./install_1.sh PROJECT_NAME REPO_NAME DOMAIN_NAME USER_NAME USER_PSSWD RSA_FOLDER_PATH
Replacing with your own configurations as follow:
- PROJECT_NAME: is the name of your project, ex: MyTrac
- REPO_NAME: is the name of your repository, ex: mynewrepo
- DOMAIN_NAME: your domain, ex: mysite.com
- USER_NAME: your username, ex: myNewUser (THIS MUST BE THE SAME USER NAME OF THE RSA KEY BEFORE!)
- USER_PSSWD: your password, ex: mystrongpass
- RSA_FOLDER_PATH: the path to the folder where you put the rsa pub key, ex: /tmp
Using the example above this would be a possible usage:
./install_1.sh MyTrac mynewrepo mysite.com myNewUser mystrongpass /tmp
Configuring the GIT server
This has to be done in your workstation after the fist part of the install:
git clone git@DOMAIN_NAME:gitolite-admin
replacing DOMAIN_NAME with your server domain.
Open the conf/gitolite.conf file, and add this lines to the end of it:
repo REPO_NAME RW+ = USER_NAME
replacing REPO_NAME and USER_NAME with the ones used in the execution of the script, ex: myNewUser.
Save, commit and push it.
git add . git commit -m 'new repo' git push origin master
Finishing the Install
After this execute install_2.sh, using the same parameters as before! Ex:
./install_2.sh MyTrac mynewrepo mysite.com myNewUser mystrongpass /tmp
This will finish the TRAC project creation and the GIT configuration for the new repository.
Also will install and configure the post-receive hook that allows you to close and reference tickects in the commit messages.
If you want to help, feel free to fork the project on github:
That’s all folks