msgbartop
MAC OS X, Linux, Windows and other IT Tips and Tricks
msgbarbottom

09 Dec 14 Installing GITLAB-Omnibus in Debian Wheezy

Introduction:

The instructions here have been based on the site: //about.gitlab.com/downloads/.
I did what is shown there but it didn’t work immediately. I had to do the following tweaks and then it all worked fine so far.
IMPORTANT: In order to stay updated see the last par at the end of this article for instruction son how to Upgrade.

In these examples I use the domain example.com. Replace it with your own domain.

Steps

Run the following commands to install GitLab.
apt-get install postfix
wget --no-check-certificate //downloads-packages.s3.amazonaws.com/debian-7.6/gitlab_7.5.3-omnibus.5.2.1.ci-1_amd64.deb
dpkg -i gitlab_7.5.3-omnibus.5.2.1.ci-1_amd64.deb
nano /etc/gitlab/gitlab.rb

Content:
# Check and change the external_url to the address your users will type in their browser
external_url '//gitlab.example.com'
gitlab_rails['gitlab_email_from'] = 'git@gitlab.example.com'

Create the following certificate files:
/etc/gitlab/ssl/gitlab.example.com.crt
/etc/gitlab/ssl/gitlab.example.com.key

Start the last installation procedure:
gitlab-ctl reconfigure
Here is what you see in logs if you don’t make the following changes:
WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1'
to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

So, edit /etc/sysctl.conf and add:vm.overcommit_memory = 1
Run:sysctl vm.overcommit_memory=1
Make sure your DNS settings of gitlab.example.com are pointing to the IP of this host. Login at : //gitlab.example.com
Login: root
Passowrd: 5iveL!fe

– Change password of Administrator(root)
– Create new user(s)
…. and you’re up and running GitLab.
——————————————————————
Some extra information regarding the administration of GitLab:

The gitlab-ctl Command:
Info: (/usr/bin/gitlab-ctl -> /opt/gitlab/bin/gitlab-ctl)
This command should be run as root or under sudo:
Syntax:
gitlab-ctl SubCommand [ProcessName]
SubCommand Description:
cleanse Delete *all* gitlab data, and start from scratch.
deploy-page Put up the deploy page
graceful-kill Attempt a graceful stop, then SIGKILL the entire process group.
help Print this help message.
hup Send the services a HUP.
int Send the services an INT.
kill Send the services a KILL.
once Start the services if they are down. Do not restart them if they stop.
reconfigure Reconfigure the application.
restart Stop the services if they are running, then start them again.
service-list List all the services (enabled services appear with a *.)
show-config Show the configuration that would be generated by reconfigure.
start Start services if they are down, and restart them if they stop.
status Show the status of all the services.
stop Stop the services, and do not restart them.
tail Watch the service logs of all enabled services.
term Send the services a TERM.
uninstall Kill all processes and uninstall the process supervisor (data will be preserved).

ProcessName valid values:
logrotate
nginx
postgresql
redis
sidekiq
unicorn

For more information on GitLab see:
//doc.gitlab.com/ci/
Use the manual mode to install GitLab shown at:
//www.digitalocean.com/community/tutorials/how-to-set-up-gitlab-as-your-very-own-private-github-clone
Use LDAP to login:
//github.com/gitlabhq/omniauth-ldap
Or used Windows ADS to login:
//doc.gitlab.com/ee/integration/ldap.html
and //gitlab.com/gitlab-org/gitlab-ce/blob/master/config/gitlab.yml.example
The some extra info/troubleshooting:
//gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md
//stackoverflow.com/questions/15321532/setting-up-gitlab-ldap-authentication-without-special-gitlab-user
and
//stackoverflow.com/questions/25046982/gitlab-ldap-authentication-settings
And the support Forum:
//groups.google.com/forum/#!forum/gitlabhq

Troubleshooting

Problem:
Reference:

I can push by clone project using ssh, but it doesn’t work when I clone project with https. it shows message error as below.
server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
Solution 1:
You need to check the web certificate used for your gitLab server, and add it to your (git_intallation_folder)/bin/curl-ca-bundle.crt.
To get that certificate (that you would need to ad to your curl-ca-bundle.crt file), run:
echo -n | openssl s_client -showcerts -connect yourGitLabServer:YourHttpGilabPort 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
To check the CA (Certificate Authority issuer), run:
echo -n | openssl s_client -showcerts -connect yourGitLabServer:YourHttpGilabPort 2>/dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'| openssl x509 -noout -text | grep "CA Issuers" | head -1
Findekano adds in the comments: to identify the location of curl-ca-bundle.crt, you could use the command:
curl-config --ca

Solution 2 (not really recommended for production servers):
To check if at least the clone works without checking said certificate, you can set:
export GIT_SSL_NO_VERIFY=1
or
git config --global http.sslverify false

But that would be for testing only, as illustrated in “SSL works with browser, wget, and curl, but fails with git”.

Creating a new repository/project with Linux clients

Example: creating the project gitrepo1

Git global setup
git config --global user.name "Administrator"
git config --global user.email "joe.doe@mydomain.com"

Create a new repository
mkdir gitrepo1
cd gitrepo1
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin git@gitlab.example.com:joe-doe/gitrepo1.git
git push -u origin master

Push an existing Git repository
cd existing_git_repo
git remote add origin git@gitlab.example.com:joe-doe/gitrepo1.git
git push -u origin master

Note: The ownername is the username of the person who created the project. If that username has already a Dot ‘.’ in it, it should be replaced by a Dash’-‘ in the above commands.

Instructions on how to create a new user on GitLab

– Login with your company login in LDAP Authentication at //gitlab.mydomain.net. The new user will automatically be created in GitLab system.
– Add your public SSH key in the page //gitlab.mydomain.net/profile/keys
– Remember your username in the page: //gitlab.mydomain.net/profile/account under ‘Change Username’ field.
– Remember your email in the page: //gitlab.mydomain.net/profile under ‘Email’ field.
– For linux users using the git command line, run the following commands(assuming that you want your git workspace in ~/gitlab/ directory)
Note: Make sure you replace the above remembered username and email below shown as <USERNAME> and <EMAIL>
– Initializing a workspace for gitlab repositories
mkdir ~/gitlab/ ; cd ~/gitlab/
git config --global user.name <USERNAME>

– Then verify that you have the correct username:
git config --global user.name
– To set your email address, type the following command:
git config --global user.email <EMAIL>
– To verify that you entered your email correctly, type:
git config --global user.email
git config --global --list

– Change to simple push default format
git config --global push.default simple
– Create a new repository as new project in the gitlab web interface run the following command to clone the repository in your local git workspace(assuming here ~/gitlab/)
cd ~/gitlab/
git clone git@gitlab.mydomain.net:/<USERNAME>/<PROJECTNAME>.git

– To commit the first file(special push case for the first file):
cd <PROJECTNAME>
echo "first file content" > first_file
git add first_file
git commit -m 'test commit 1'
git push origin master

– Now all the other files will be pushed normally as follows:
echo "second file content" > second_file
git add second_file
git commit -m 'test commit 2'
git push

Upgrading GitLab Omnibus

Here are the instructions on how to upgrade GitLab Omnibus Community Edition.
Reference: //packages.gitlab.com/gitlab/gitlab-ce
curl -s //packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | bash
apt-get install gitlab-ce=7.14.1-ce.0

And let the screen roll while watching for errors. đŸ™‚

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: