You'll need a new ssh user and a custom app setup before you do anything. Remember the port you're given for your custom port. You'll be doing all of this as the new ssh user that you've created.
Setup your ssh. On your client computer (your home machine):
| cd $HOME/.ssh
ssh-keygen -t rsa # When prompted for a name use your ssh username. DO NOT ENTER A PASSWORD!!!
scp ~/.ssh/ssh_username ssh_username@yourwebsite.com:ssh_username
scp ~/.ssh/ssh_username.pub ssh_username@yourwebsite.com:ssh_username.pub
|
Now go onto your server with your ssh user:
| chmod 600 $HOME/.ssh/authorized_keys
chmod 700 $HOME/.ssh
cp $HOME/ssh_username $HOME/.ssh/id_rsa
|
Now run this command to save yourself some headaches later:
| git config --global user.email "you@example.com"
git config --global user.name "Your Name"
|
Now install gitolite:
| git clone git://github.com/gitlabhq/gitolite
gitolite/src/gl-system-install
sh -c "PATH=/home/username/bin:$PATH; gl-setup ~/username.pub" # change the $REPO_UMASK value to 0007 from 0077 when the vi window comes up.
chmod -R g+rwX /home/username/repositories
chown -R username:username /home/username/repositories
vim .gitolite.rc # only do this if you didn't change the umask value earlier
setfacl -R -m u:<main-user>:rwx ~/repositories
|
Then install some non-standard libraries (sqlite3 and redis):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 | cd
mkdir src
cd src
wget http://www.sqlite.org/sqlite-autoconf-3070800.tar.gz
tar -zxvf sqlite-autoconf-3070800.tar.gz
cd sqlite-autoconf-3070800
./configure --prefix=$HOME
make
make install
export LD_LIBRARY_PATH=$HOME/lib
export C_INCLUDE_PATH=$HOME/include
cd ~/src
wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
tar -zxvf redis-2.4.8.tar.gz
cd redis-2.4.8
make
make test
make PREFIX=/home/username/ install # This will install it to bin
|
Now we need to configure redis:
| cp ~/src/redis-2.4.8/redis.conf ~/.
vim ~/redis.conf # Change the line that says daemonize no to daemonize yes
redis-server ~/redis.conf # This starts the redis-server daemonized
|
Install our ruby stuff and gitlab:
| echo "export PATH=$HOME/.rvm/bin:$PATH">>.bash_profile
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
rvm install 1.9.2-p290
mkdir -p lib/python2.7
easy_install-2.7 pip
pip install pygments
gem-ruby-1.9.2-p290 install bundler
git clone -b stable git://github.com/gitlabhq/gitlabhq.git
cd gitlabhq
cp config/database.yml.example config/database.yml
cp config/gitlab.yml.example config/gitlab.yml
|
Now we need to update our gitlab.yml file. Open the config/gitlab.yml editor (vim, emacs, nano): Change admin_uri to your ssh username and the urls you're using (eg gituser@git.asdf.com:gitolite-admin). Change the base path to reflect your ssh username (eg /home/gituser/repositories). Change your host to your host (eg git.asdf.com) and change your git_user to your ssh username. Uncomment the port.
Continue setting up the gitlab stuff:
| rvm --default use 1.9.2-p290
bundle install --without development test
bundle exec rake db:setup RAILS_ENV=production
bundle exec rake db:seed_fu RAILS_ENV=production
|
Now you'll need to run:
| bundle exec rails s -e production -p <your_custom_port> -d
$HOME/gitlabhq/resque.sh
|
Now that that's running you've got a running install of gitlab. You'll need to point that custom app to a domain name, but once that's done you'll be good to go.
Now just so you're aware after reading this, with 3 users logged into gitlab it takes up about 115mb of ram (just browsing no commits), so you need to be aware that it's a resource hog and you'll probably need to get extra ram (which is a problem with most RoR apps). Also, if you don't set the git config --global stuff and you add users, you'll screw up your install and have to re-install since it fails on that, but still adds the user.
This was all figured out with the help of some awesome folks at webfaction who put up with about 56 messages from me with all of my very long and detailed output. So big thanks to Neerav K, Ryan S, Björn M, Todor K and Ilias R. You guys rock.
Here's what the directory structure for gitlabhq looks like (ls -a):
app .bundle CHANGELOG config config.ru db doc .foreman Gemfile Gemfile.lock .git .gitignore lib LICENSE log Procfile Procfile.production public .rails_footnotes Rakefile README.md resque_dev.sh resque.sh .rspec script spec .travis.yml vendor VERSION
I think I have successfully installed gitlab, but I am struggling with the last part of making a website point to my custom app. Since this is installed in a whole new user outside of the ~/webapps directory, how to I enable one of my domains to point to gitlab?
As long as you are using a "Custom Application (listening on port)" application type, then this is actually very straightforward. There is no specific binding to your main user account, and the only thing that matters is the port which your application is listening on.
Specifically, a Custom Application (listening on port) works by forwarding all requests to a localhost port. If, for example, the assigned port for your Custom Application is 12345, then incoming requests will be forwarded to 127.0.0.1:12345, and any application listening on this address and port can receive and handle that request. So, it doesn't matter at all where your Gitlab is installed to or which user it's running under - as long as it's binding to 127.0.0.1 and listening on the appropriate port, then it will work.
So, to answer your question - all you need to do is use a website record in the control panel to point your domain to the custom application (listening on port), and then configure your gitlab application to bind to 127.0.0.1 on the port assigned by that custom application.