Commit 99bae883 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg

Merge branch 'master' into fedora

parents d4696364 35a669d9
......@@ -20,3 +20,12 @@ gitlab-openldap/openldap-2.4.40/
gitlab-openldap/sbin/
gitlab-openldap/share/
.vagrant/
gitlab-workhorse/
nginx/logs
nginx/conf/nginx.conf
nginx/tmp
nginx/client_body_temp
nginx/fastcgi_temp
nginx/proxy_temp
nginx/scgi_temp
nginx/uwsgi_temp
The MIT License (MIT)
Copyright (c) 2014-2015 GitLab B.V.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
gitlab_repo = https://gitlab.com/gitlab-org/gitlab-ce.git
gitlab_shell_repo = https://gitlab.com/gitlab-org/gitlab-shell.git
gitlab_ci_repo = https://gitlab.com/gitlab-org/gitlab-ci.git
gitlab_runner_repo = https://gitlab.com/gitlab-org/gitlab-ci-runner.git
gitlab_workhorse_repo = https://gitlab.com/gitlab-org/gitlab-workhorse.git
gitlab_development_root = $(shell pwd)
postgres_bin_dir = $(shell pg_config --bindir)
all: gitlab-setup gitlab-shell-setup gitlab-ci-setup gitlab-runner-setup support-setup
all: gitlab-setup gitlab-shell-setup gitlab-runner-setup gitlab-workhorse-setup nginx-setup support-setup
# Set up the GitLab Rails app
......@@ -26,6 +26,8 @@ gitlab/config/database.yml:
gitlab/config/unicorn.rb:
cp gitlab/config/unicorn.rb.example.development gitlab/config/unicorn.rb
echo "listen '${gitlab_development_root}/gitlab.socket'" >> $@
echo "listen '127.0.0.1:8080'" >> $@
gitlab/config/resque.yml:
sed "s|/home/git|${gitlab_development_root}|" redis/resque.yml.example > $@
......@@ -50,34 +52,6 @@ gitlab-shell/config.yml:
gitlab-shell/.bundle:
cd ${gitlab_development_root}/gitlab-shell && bundle install --without production --jobs 4
# Set up gitlab-ci
gitlab-ci-setup: gitlab-ci/.git gitlab-ci-config gitlab-ci/.bundle
gitlab-ci/.git:
git clone ${gitlab_ci_repo} gitlab-ci
gitlab-ci-config: gitlab-ci/config/application.yml gitlab-ci/config/database.yml gitlab-ci/config/resque.yml gitlab-ci/config/unicorn.rb
gitlab-ci/config/application.yml:
cp gitlab-ci/config/application.yml.example.development $@
gitlab-ci/config/database.yml:
sed -e "s|gitlabhq|gitlabci|"\
-e "s|/home/git|${gitlab_development_root}|"\
database.yml.example > $@
gitlab-ci/config/resque.yml:
sed "s|/home/git|${gitlab_development_root}|" redis/resque.yml.example > $@
gitlab-ci/config/unicorn.rb:
cp gitlab-ci/config/unicorn.rb.example.development $@
gitlab-ci/.bundle:
cd ${gitlab_development_root}/gitlab-ci && bundle install --without mysql production --jobs 4
gitlab-ci-clean:
rm -rf gitlab-ci
# Set up gitlab-runner
gitlab-runner-setup: gitlab-runner/.git gitlab-runner/.bundle
......@@ -90,9 +64,9 @@ gitlab-runner/.bundle:
gitlab-runner-clean:
rm -rf gitlab-runner
# Update gitlab, gitlab-shell, gitlab-ci and gitlab-runner
# Update gitlab, gitlab-shell and gitlab-runner
update: gitlab-update gitlab-shell-update gitlab-ci-update gitlab-runner-update
update: gitlab-update gitlab-shell-update gitlab-runner-update
gitlab-update: gitlab/.git/pull
cd ${gitlab_development_root}/gitlab && \
......@@ -103,26 +77,17 @@ gitlab-shell-update: gitlab-shell/.git/pull
cd ${gitlab_development_root}/gitlab-shell && \
bundle install --without production --jobs 4
gitlab-ci-update: gitlab-ci/.git/pull
cd ${gitlab_development_root}/gitlab-ci && \
bundle install --without mysql production --jobs 4 && \
bundle exec rake db:migrate
gitlab-runner-update: gitlab-runner/.git/pull
cd ${gitlab_development_root}/gitlab-runner && \
bundle install
gitlab/.git/pull:
cd ${gitlab_development_root}/gitlab && git checkout -- db/schema.rb && \
cd ${gitlab_development_root}/gitlab && git checkout -- Gemfile.lock db/schema.rb && \
git pull --ff-only
gitlab-shell/.git/pull:
cd ${gitlab_development_root}/gitlab-shell && git pull --ff-only
gitlab-ci/.git/pull:
cd ${gitlab_development_root}/gitlab-ci && git checkout -- db/schema.rb && \
git pull --ff-only
gitlab-runner/.git/pull:
cd ${gitlab_development_root}/gitlab-runner && git pull --ff-only
......@@ -133,7 +98,7 @@ support-setup: Procfile redis postgresql .bundle
@echo "*********************************************"
@echo "************** Setup finished! **************"
@echo "*********************************************"
sed -n '/^### Post-installation/,/^END Post-installation/p' README.md
sed -n '/^## Post-installation/,/^END Post-installation/p' README.md
@echo "*********************************************"
Procfile:
......@@ -149,7 +114,37 @@ redis/redis.conf:
postgresql: postgresql/data/PG_VERSION
postgresql/data/PG_VERSION:
${postgres_bin_dir}/initdb -E utf-8 postgresql/data
${postgres_bin_dir}/initdb --locale=C -E utf-8 postgresql/data
.bundle:
bundle install --jobs 4
gitlab-workhorse-setup: gitlab-workhorse/gitlab-workhorse
gitlab-workhorse/gitlab-workhorse: gitlab-workhorse/.git
cd gitlab-workhorse && make
gitlab-workhorse/.git:
git clone ${gitlab_workhorse_repo} gitlab-workhorse
nginx-setup: nginx/conf/nginx.conf nginx/logs nginx/tmp
nginx/conf/nginx.conf:
sed -e "s|/home/git|${gitlab_development_root}|" nginx/conf/nginx.conf.example > $@
nginx/logs:
mkdir -p $@
nginx/tmp:
mkdir -p $@
clean-config:
rm -f \
gitlab/config/gitlab.yml \
gitlab/config/database.yml \
gitlab/config/unicorn.rb \
gitlab/config/resque.yml \
gitlab-shell/config.yml \
redis/redis.conf \
Procfile \
nginx/conf/nginx.conf
redis: redis-server /home/git/redis/redis.conf
postgresql: postgres -D /home/git/postgresql/data -k /home/git/postgresql -h ''
#openldap: cd gitlab-openldap && libexec/slapd -F slapd.d -d2 -h "ldap://127.0.0.1:3890"
nginx: nginx -p /home/git/nginx -c conf/nginx.conf
gitlab-workhorse: /home/git/gitlab-workhorse/gitlab-workhorse -listenNetwork unix -listenAddr /home/git/gitlab-workhorse.socket /home/git/repositories
This diff is collapsed.
# -*- mode: ruby -*-
# vi: set ft=ruby :
# rubocop:disable all
# Please see the Vagrant section in the readme for caveats and tips
# https://gitlab.com/gitlab-org/gitlab-development-kit/tree/master#vagrant
Vagrant.require_version ">= 1.6.0"
VAGRANTFILE_API_VERSION = "2"
def enable_shares(config, nfs)
# paths must be listed as shortest to longest per bug: https://github.com/GM-Alex/vagrant-winnfsd/issues/12#issuecomment-78195957
config.vm.synced_folder ".", "/vagrant", type: "rsync", rsync__exclude: ['gitlab/', 'gitlab-shell', 'gitlab-runner'], rsync__auto: false
config.vm.synced_folder "gitlab/", "/vagrant/gitlab", :create => true, :nfs => nfs
config.vm.synced_folder "gitlab-shell/", "/vagrant/gitlab-shell", :create => true, :nfs => nfs
config.vm.synced_folder "gitlab-runner/", "/vagrant/gitlab-runner", :create => true, :nfs => nfs
end
def running_in_admin_mode?
return false unless Vagrant::Util::Platform.windows?
(`reg query HKU\\S-1-5-19 2>&1` =~ /ERROR/).nil?
end
if Vagrant::Util::Platform.windows? && !running_in_admin_mode?
raise Vagrant::Errors::VagrantError.new, "You must run the GitLab Vagrant from an elevated command prompt"
end
required_plugins = %w(vagrant-share)
required_plugins_non_windows = %w(facter)
required_plugins_windows = %w() # %w(vagrant-winnfsd) if https://github.com/GM-Alex/vagrant-winnfsd/issues/50 gets fixed
if Vagrant::Util::Platform.windows?
required_plugins.concat required_plugins_windows
else
required_plugins.concat required_plugins_non_windows
end
# thanks to http://stackoverflow.com/a/28801317/1233435
required_plugins.each do |plugin|
need_restart = false
unless Vagrant.has_plugin? plugin
system "vagrant plugin install #{plugin}"
need_restart = true
end
exec "vagrant #{ARGV.join(' ')}" if need_restart
end
$apt_reqs = <<EOT
apt-get update
apt-get -y install git g++ pkg-config
apt-get -y install postgresql libpq-dev phantomjs redis-server libicu-dev cmake libkrb5-dev
apt-get -y install git postgresql libpq-dev phantomjs redis-server libicu-dev cmake g++ nodejs libkrb5-dev curl ruby ed golang nginx
EOT
# CentOS 6 kernel doesn't suppose UID mapping (affects vagrant-lxc mostly).
......@@ -22,20 +61,80 @@ else
DEV_USER=vagrant
fi
sudo -u $DEV_USER -i bash -c "gpg --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3"
sudo -u $DEV_USER -i bash -c "curl -sSL https://get.rvm.io | bash -s stable --ruby"
sudo -u $DEV_USER -i bash -c "curl -sSL https://get.rvm.io | bash -s stable --ruby=2.1.6"
sudo -u $DEV_USER -i bash -c "gem install bundler"
sudo chown -R $DEV_USER:$DEV_USER /home/vagrant
sudo ln -s /vagrant /home/vagrant/gitlab-development-kit
# automatically move into the gitlab-development-kit folder, but only add the command
# if it's not already there
sudo -u $DEV_USER -i bash -c "grep -q 'cd /home/vagrant/gitlab-development-kit/' /home/vagrant/.bash_profile || echo 'cd /home/vagrant/gitlab-development-kit/' >> /home/vagrant/.bash_profile"
EOT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.provision "shell", inline: $apt_reqs
config.vm.provision "shell", inline: $user_setup
if !Vagrant::Util::Platform.windows?
# NFS setup
config.vm.network "private_network", type: "dhcp"
end
config.vm.network "forwarded_port", guest: 3000, host: 3000
config.vm.provider "docker" do |d,override|
d.build_dir = "docker"
d.has_ssh = true
d.remains_running = true
enable_shares(override, false)
end
config.vm.provider "lxc" do |v, override|
override.vm.box = "fgrehm/trusty64-lxc"
enable_shares(override, true)
end
config.vm.provider "virtualbox" do |vb|
vb.customize ["modifyvm", :id, "--memory", "2048"]
config.vm.provider "virtualbox" do |vb,override|
override.vm.box = "ubuntu/trusty64"
if Vagrant::Util::Platform.windows?
# thanks to https://github.com/rdsubhas/vagrant-faster/blob/master/lib/vagrant/faster/action.rb
# current bug in Facter requires detecting Windows core count seperately - https://tickets.puppetlabs.com/browse/FACT-959
cpus = `wmic cpu Get NumberOfCores`.split[1].to_i
# current bug in Facter requires detecting Windows memory seperately - https://tickets.puppetlabs.com/browse/FACT-960
mem = `wmic computersystem Get TotalPhysicalMemory`.split[1].to_i / 1024 / 1024
enable_shares(override, false)
else
cpus = Facter.value('processors')['count']
if facter_mem = Facter.value('memory')
mem = facter_mem.slice! " GiB".to_i * 1024
elsif facter_mem = Facter.value('memorysize_mb')
mem = facter_mem.to_i
else
raise "unable to determine total host RAM size"
end
# disables NFS on OS X to prevent UID / GID issues with mounted shares
enable_nfs = Vagrant::Util::Platform.platform =~ /darwin/ ? false : true
enable_shares(override, enable_nfs)
end
# use 1/4 of memory or 2 GB, whichever is greatest
mem = [mem / 4, 2048].max
# performance tweaks
# per https://www.virtualbox.org/manual/ch03.html#settings-processor set cpus to real cores, not hyperthreads
vb.cpus = cpus
vb.memory = mem
vb.customize ["modifyvm", :id, "--nestedpaging", "on"]
vb.customize ["modifyvm", :id, "--largepages", "on"]
if cpus > 1
vb.customize ["modifyvm", :id, "--ioapic", "on"]
end
# uncomment if you don't want to use all of host machines CPU
#vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
# uncomment if you need to troubleshoot using a GUI
#vb.gui = true
end
end
FROM ubuntu:trusty
MAINTAINER Gitlab.com
RUN apt-get update ;\
apt-get -y install openssh-server supervisor ;\
rm -rf /var/lib/apt/lists/* ;\
mkdir /var/run/sshd
#password is vagrant
RUN useradd -m -p '$6$UFLdXsV4$hnP4J2l8w02eCoj7ogsQZ0wdEImAKtzIoQqmrNLEXkyI1UsuPPofdpf4DMViq4QPdFVOz0yekQ35lgaFUB6SF/' -s /bin/bash vagrant
COPY assets /
RUN chown -R vagrant:vagrant /home/vagrant; \
chmod 600 /home/vagrant/.ssh/authorized_keys
CMD supervisord -c /etc/supervisord.conf
EXPOSE 22
This docker image is used as a Vagrant image for development of Gitlab
vagrant ALL=(ALL) NOPASSWD: ALL
[supervisord]
nodaemon=true
user=root
group=root
[program:sshd]
command=/usr/local/sbin/sshd_foreground
autorestart=true
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
#!/bin/sh
#
# Lets start openssh in background to allow multiple connections
# (otherwise sshd -D is handling one connection only)
# and run a wrapper around to provide the foreground behaviour for docker
#
#start the daemon
# for the case somebody is using ssh-agent with many keys we would like to allow 10 login tries
# and disable reverse DNS lookup for speed optimization
/usr/sbin/sshd -o MaxAuthTries=10 -o UseDNS=no
#signal handler, clean termination
trap "kill `cat /var/run/sshd.pid`; exit 0" TERM INT QUIT HUP
#wait for termination or crash
cnt=1
while [ $cnt -eq 1 ]; do
cnt=$(ps -ax | grep `cat /var/run/sshd.pid` | grep -v grep | wc -l)
sleep 2
done
#some crash or similar thing
exit 1
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}
worker_processes 1;
daemon off;
pid tmp/nginx.pid;
error_log stderr;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
access_log logs/access.log;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
proxy_temp_path proxy_temp;
client_body_temp_path client_body_temp;
uwsgi_temp_path uwsgi_temp;
fastcgi_temp_path fastcgi_temp;
scgi_temp_path scgi_temp;
client_max_body_size 0;
upstream gitlab {
server unix:/home/git/gitlab.socket fail_timeout=0;
}
upstream gitlab-workhorse {
server unix:/home/git/gitlab-workhorse.socket fail_timeout=0;
}
server {
listen 3000;
server_name localhost;
location / {
try_files $uri $uri/index.html @uri.html @gitlab;
}
location ~ ^/[\w\.-]+/[\w\.-]+/(info/refs|git-upload-pack|git-receive-pack)$ {
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^/[\w\.-]+/[\w\.-]+/repository/archive {
error_page 418 = @gitlab-workhorse;
return 418;
}
location ~ ^/api/v3/projects/.*/repository/archive {
error_page 418 = @gitlab-workhorse;
return 418;
}
location @gitlab-workhorse {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://gitlab-workhorse;
}
location @gitlab {
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frame-Options SAMEORIGIN;
proxy_pass http://gitlab;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment