Commit 61415161 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'master' of https://dev.gitlab.org/gitlab/gitlabhq

Conflicts:
	VERSION
parents 348653bc 7daf3947
...@@ -19,7 +19,6 @@ config/gitlab.yml ...@@ -19,7 +19,6 @@ config/gitlab.yml
config/database.yml config/database.yml
config/initializers/omniauth.rb config/initializers/omniauth.rb
config/unicorn.rb config/unicorn.rb
config/puma.rb
config/resque.yml config/resque.yml
config/aws.yml config/aws.yml
db/data.yml db/data.yml
......
...@@ -23,7 +23,7 @@ gem 'omniauth-github' ...@@ -23,7 +23,7 @@ gem 'omniauth-github'
# Extracting information from a git repository # Extracting information from a git repository
# Provide access to Gitlab::Git library # Provide access to Gitlab::Git library
gem "gitlab_git", '2.0.1' gem "gitlab_git", '2.1.0'
# Ruby/Rack Git Smart-HTTP Server Handler # Ruby/Rack Git Smart-HTTP Server Handler
gem 'gitlab-grack', '~> 1.0.1', require: 'grack' gem 'gitlab-grack', '~> 1.0.1', require: 'grack'
...@@ -77,8 +77,7 @@ gem "github-markup", "~> 0.7.4", require: 'github/markup' ...@@ -77,8 +77,7 @@ gem "github-markup", "~> 0.7.4", require: 'github/markup'
# Asciidoc to HTML # Asciidoc to HTML
gem "asciidoctor" gem "asciidoctor"
# Servers # Application server
gem "puma", '~> 2.3.1', group: :puma
gem "unicorn", '~> 4.6.3', group: :unicorn gem "unicorn", '~> 4.6.3', group: :unicorn
# State machine # State machine
......
...@@ -186,7 +186,7 @@ GEM ...@@ -186,7 +186,7 @@ GEM
gitlab-pygments.rb (0.3.2) gitlab-pygments.rb (0.3.2)
posix-spawn (~> 0.3.6) posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0) yajl-ruby (~> 1.1.0)
gitlab_git (2.0.1) gitlab_git (2.1.0)
activesupport (~> 3.2.13) activesupport (~> 3.2.13)
github-linguist (~> 2.3.4) github-linguist (~> 2.3.4)
gitlab-grit (~> 2.6.0) gitlab-grit (~> 2.6.0)
...@@ -331,8 +331,6 @@ GEM ...@@ -331,8 +331,6 @@ GEM
coderay (~> 1.0.5) coderay (~> 1.0.5)
method_source (~> 0.8) method_source (~> 0.8)
slop (~> 3.4) slop (~> 3.4)
puma (2.3.1)
rack (>= 1.1, < 2.0)
pygments.rb (0.4.2) pygments.rb (0.4.2)
posix-spawn (~> 0.3.6) posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.1.0) yajl-ruby (~> 1.1.0)
...@@ -578,7 +576,7 @@ DEPENDENCIES ...@@ -578,7 +576,7 @@ DEPENDENCIES
gitlab-gollum-lib (~> 1.0.1) gitlab-gollum-lib (~> 1.0.1)
gitlab-grack (~> 1.0.1) gitlab-grack (~> 1.0.1)
gitlab-pygments.rb (~> 0.3.2) gitlab-pygments.rb (~> 0.3.2)
gitlab_git (= 2.0.1) gitlab_git (= 2.1.0)
gitlab_meta (= 6.0) gitlab_meta (= 6.0)
gitlab_omniauth-ldap (= 1.0.3) gitlab_omniauth-ldap (= 1.0.3)
gon gon
...@@ -609,7 +607,6 @@ DEPENDENCIES ...@@ -609,7 +607,6 @@ DEPENDENCIES
pg pg
poltergeist (~> 1.3.0) poltergeist (~> 1.3.0)
pry pry
puma (~> 2.3.1)
quiet_assets (~> 1.0.1) quiet_assets (~> 1.0.1)
rack-mini-profiler rack-mini-profiler
rails (= 3.2.13) rails (= 3.2.13)
......
6.0.0-ee.beta 6.0.0-ee.rc1
...@@ -89,7 +89,7 @@ $ -> ...@@ -89,7 +89,7 @@ $ ->
if (flash = $(".flash-container")).length > 0 if (flash = $(".flash-container")).length > 0
flash.click -> $(@).fadeOut() flash.click -> $(@).fadeOut()
flash.show() flash.show()
setTimeout (-> flash.fadeOut()), 9000 setTimeout (-> flash.fadeOut()), 5000
# Disable form buttons while a form is submitting # Disable form buttons while a form is submitting
$('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) -> $('body').on 'ajax:complete, ajax:beforeSend, submit', 'form', (e) ->
......
...@@ -64,7 +64,7 @@ class Wall ...@@ -64,7 +64,7 @@ class Wall
template = template.replace('{{text}}', simpleFormat(note.body)) template = template.replace('{{text}}', simpleFormat(note.body))
if note.attachment if note.attachment
file = '<i class="icon-paper-clip"/><a href="/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>' file = '<i class="icon-paper-clip"/><a href="' + gon.relative_url_root + '/files/note/' + note.id + '/' + note.attachment + '">' + note.attachment + '</a>'
else else
file = '' file = ''
template = template.replace('{{file}}', file) template = template.replace('{{file}}', file)
......
...@@ -51,6 +51,10 @@ table a code { ...@@ -51,6 +51,10 @@ table a code {
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 14px; font-size: 14px;
position: fixed;
bottom: 0;
width: 100%;
opacity: 0.8;
.flash-notice { .flash-notice {
background: #49C; background: #49C;
......
...@@ -95,15 +95,15 @@ ...@@ -95,15 +95,15 @@
width: 20px; width: 20px;
} }
} }
ul { ul {
margin-bottom: 5px;
.avatar { .avatar {
width: 18px; width: 18px;
margin: 2px 4px; margin: 2px 4px;
} }
} }
padding: 14px 0px; padding: 12px 0px;
&:last-child { border:none } &:last-child { border:none }
.event_commits { .event_commits {
......
...@@ -89,6 +89,10 @@ class WikiPage ...@@ -89,6 +89,10 @@ class WikiPage
@page.versions.map { |v| Commit.new(Gitlab::Git::Commit.new(v)) } @page.versions.map { |v| Commit.new(Gitlab::Git::Commit.new(v)) }
end end
def commit
versions.first
end
# Returns the Date that this latest version was # Returns the Date that this latest version was
# created on. # created on.
def created_at def created_at
......
...@@ -21,7 +21,7 @@ class AttachmentUploader < CarrierWave::Uploader::Base ...@@ -21,7 +21,7 @@ class AttachmentUploader < CarrierWave::Uploader::Base
end end
def secure_url def secure_url
"/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}" Gitlab.config.gitlab.relative_url_root + "/files/#{model.class.to_s.underscore}/#{model.id}/#{file.filename}"
end end
def file_storage? def file_storage?
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
- if event.push? - if event.push?
= render "events/event/push", event: event = render "events/event/push", event: event
.clearfix
- elsif event.note? - elsif event.note?
= render "events/event/note", event: event = render "events/event/note", event: event
- else - else
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
= link_to_project event.project = link_to_project event.project
- else - else
= event.project_name = event.project_name
.event-body - if event.target.respond_to?(:title)
.event-body
.event-note .event-note
- if event.target.respond_to?(:title)
= event.target.title = event.target.title
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
%option{:value => "deletions"} Deletions %option{:value => "deletions"} Deletions
%h3#date_header.page-title %h3#date_header.page-title
%p.light %p.light
Commits to #{@project.default_branch}, excluding merge commits. Limited by 8,000 commits Commits to #{@project.default_branch}, excluding merge commits. Limited by 6,000 commits
%input#brush_change{:type => "hidden"} %input#brush_change{:type => "hidden"}
.graphs .graphs
#contributors-master #contributors-master
......
...@@ -44,4 +44,3 @@ ...@@ -44,4 +44,3 @@
%hr %hr
= link_to @project.gitlab_ci_service.builds_path do = link_to @project.gitlab_ci_service.builds_path do
= image_tag @project.gitlab_ci_service.status_img_path, alt: "build status" = image_tag @project.gitlab_ci_service.status_img_path, alt: "build status"
%span.pull-right %span.pull-right
- if (@wiki && @wiki.persisted?) - if (@wiki && @wiki.persisted?)
= link_to history_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do = link_to history_project_wiki_path(@project, @wiki), class: "btn grouped" do
Page History Page History
- if can?(current_user, :write_wiki, @project) - if can?(current_user, :write_wiki, @project)
= link_to edit_project_wiki_path(@project, @wiki), class: "btn btn-small grouped" do = link_to edit_project_wiki_path(@project, @wiki), class: "btn grouped" do
%i.icon-edit %i.icon-edit
Edit Edit
= render 'nav' = render 'nav'
%h3.page-title %h3.page-title
%span.light History for %span.light History for
= @wiki.title.titleize = link_to @wiki.title.titleize, project_wiki_path(@project, @wiki)
= render 'main_links'
%br
%table %table
%thead %thead
%tr %tr
......
= render 'nav' = render 'nav'
%h3.page-title %h3.page-title
All Pages All Pages
= render 'main_links' %ul.bordered-list
%br
%table
%thead
%tr
%th Title
%th Format
%th Last updated
%th Updated by
%tbody
- @wiki_pages.each do |wiki_page| - @wiki_pages.each do |wiki_page|
%tr %li
%td %h4
%strong= link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page) = link_to wiki_page.title.titleize, project_wiki_path(@project, wiki_page)
%td %small (#{wiki_page.format})
%strong= wiki_page.format .pull-right
%td %small Last edited #{time_ago_in_words(wiki_page.commit.created_at)} ago
= wiki_page.created_at.to_s(:short) do
(#{time_ago_in_words(wiki_page.created_at)}
ago)
%td
= commit_author_link(wiki_page.version, avatar: true, size: 24)
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
= preserve do = preserve do
= render_wiki_content(@wiki) = render_wiki_content(@wiki)
%p.time Last edited by #{commit_author_link(@wiki.version, avatar: true, size: 16)} #{time_ago_in_words @wiki.created_at} ago %p.time Last edited by #{commit_author_link(@wiki.commit, avatar: true, size: 16)} #{time_ago_in_words @wiki.commit.created_at} ago
...@@ -67,5 +67,14 @@ module Gitlab ...@@ -67,5 +67,14 @@ module Gitlab
# Version of your assets, change this if you want to expire all your assets # Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0' config.assets.version = '1.0'
# Uncomment and customize the last line to run in a non-root path
# WARNING: This feature is no longer supported
# Note that three settings need to be changed for this to work.
# 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT']
#
# config.relative_url_root = "/gitlab"
end end
end end
...@@ -18,9 +18,14 @@ production: &base ...@@ -18,9 +18,14 @@ production: &base
host: localhost host: localhost
port: 80 port: 80
https: false https: false
# Uncomment and customize the last line to run in a non-root path
# WARNING: This feature is no longer supported # WARNING: This feature is no longer supported
# Uncomment and customize to run in non-root path # Note that three settings need to be changed for this to work.
# Note that ENV['RAILS_RELATIVE_URL_ROOT'] in config/puma.rb may need to be changed # 1) In your application.rb file: config.relative_url_root = "/gitlab"
# 2) In your gitlab.yml file: relative_url_root: /gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT']
#
# relative_url_root: /gitlab # relative_url_root: /gitlab
# Uncomment and customize if you can't use the default user to run GitLab (default: 'git') # Uncomment and customize if you can't use the default user to run GitLab (default: 'git')
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
Gitlab::Application.config.session_store :cookie_store, key: '_gitlab_session', Gitlab::Application.config.session_store :cookie_store, key: '_gitlab_session',
secure: Gitlab::Application.config.force_ssl, secure: Gitlab::Application.config.force_ssl,
httponly: true httponly: true,
path: (Rails.application.config.relative_url_root.nil?) ? '/' : Rails.application.config.relative_url_root
# Use the database for sessions instead of the cookie-based default, # Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information # which shouldn't be used to store highly confidential information
......
#!/usr/bin/env puma
# Start Puma with next command:
# RAILS_ENV=production bundle exec puma -C ./config/puma.rb
# uncomment and customize to run in non-root path
# note that config/gitlab.yml web path should also be changed
# ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
application_path = '/home/git/gitlab'
directory application_path
environment 'production'
daemonize true
pidfile "#{application_path}/tmp/pids/puma.pid"
state_path "#{application_path}/tmp/pids/puma.state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
# Configure “min” to be the minimum number of threads to use to answer
# requests and “max” the maximum.
#
# The default is “0, 16”.
#
# threads 0, 16
# Bind the server to “url”. “tcp://”, “unix://” and “ssl://” are the only
# accepted protocols.
#
# The default is “tcp://0.0.0.0:9292”.
#
# bind 'tcp://0.0.0.0:9292'
# bind 'unix:///var/run/puma.sock'
# bind 'unix:///var/run/puma.sock?umask=0777'
# bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'
bind "unix://#{application_path}/tmp/sockets/gitlab.socket"
# Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you
# can also use the “ssl_bind” option.
#
# ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
# Code to run before doing a restart. This code should
# close log files, database connections, etc.
#
# This can be called multiple times to add code each time.
#
# on_restart do
# puts 'On restart...'
# end
# Command to use to restart puma. This should be just how to
# load puma itself (ie. 'ruby -Ilib bin/puma'), not the arguments
# to puma, as those are the same as the original process.
#
# restart_command '/u/app/lolcat/bin/restart_puma'
# === Cluster mode ===
# How many worker processes to run.
#
# The default is “0”.
#
# workers 2
# GitLab cluster mode recommendations
# If you have more than 1 GB RAM, uncomment one of the following lines:
#
# workers 2 # if you have at least 1.5 GB RAM
# workers 3 # if you have at least 2 GB RAM
# workers 4 # if you have at least 2.5 GB RAM
# Code to run when a worker boots to setup the process before booting
# the app.
#
# This can be called multiple times to add hooks.
#
# on_worker_boot do
# puts 'On worker boot...'
# end
# === Puma control rack application ===
# Start the puma control rack application on “url”. This application can
# be communicated with to control the main server. Additionally, you can
# provide an authentication token, so all requests to the control server
# will need to include that token as a query parameter. This allows for
# simple authentication.
#
# Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
# to see what the app has available.
#
# activate_control_app 'unix:///var/run/pumactl.sock'
# activate_control_app 'unix:///var/run/pumactl.sock', { auth_token: '12345' }
# activate_control_app 'unix:///var/run/pumactl.sock', { no_token: true }
...@@ -29,7 +29,7 @@ Check if any of these changed since last release (~22nd of last month depending ...@@ -29,7 +29,7 @@ Check if any of these changed since last release (~22nd of last month depending
* https://github.com/gitlabhq/gitlabhq/commits/master/lib/support/nginx/gitlab * https://github.com/gitlabhq/gitlabhq/commits/master/lib/support/nginx/gitlab
* https://github.com/gitlabhq/gitlab-shell/commits/master/config.yml.example * https://github.com/gitlabhq/gitlab-shell/commits/master/config.yml.example
* https://github.com/gitlabhq/gitlabhq/commits/master/config/gitlab.yml.example * https://github.com/gitlabhq/gitlabhq/commits/master/config/gitlab.yml.example
* https://github.com/gitlabhq/gitlabhq/commits/master/config/puma.rb.example * https://github.com/gitlabhq/gitlabhq/commits/master/config/unicorn.rb.example
* https://github.com/gitlabhq/gitlabhq/commits/master/config/database.yml.mysql * https://github.com/gitlabhq/gitlabhq/commits/master/config/database.yml.mysql
* https://github.com/gitlabhq/gitlabhq/commits/master/config/database.yml.postgresql * https://github.com/gitlabhq/gitlabhq/commits/master/config/database.yml.postgresql
......
...@@ -15,7 +15,15 @@ module Grack ...@@ -15,7 +15,15 @@ module Grack
@auth = Request.new(env) @auth = Request.new(env)
# Need this patch due to the rails mount # Need this patch due to the rails mount
# Need this if under RELATIVE_URL_ROOT
unless Gitlab.config.gitlab.relative_url_root.empty?
# If website is mounted using relative_url_root need to remove it first
@env['PATH_INFO'] = @request.path.sub(Gitlab.config.gitlab.relative_url_root,'')
else
@env['PATH_INFO'] = @request.path @env['PATH_INFO'] = @request.path
end
@env['SCRIPT_NAME'] = "" @env['SCRIPT_NAME'] = ""
auth! auth!
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# GITLAB # GITLAB
# Maintainer: @randx # Maintainer: @randx
# App Version: 5.2 # App Version: 6.0
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: gitlab # Provides: gitlab
...@@ -17,11 +17,10 @@ ...@@ -17,11 +17,10 @@
APP_ROOT="/home/git/gitlab" APP_ROOT="/home/git/gitlab"
APP_USER="git" APP_USER="git"
DAEMON_OPTS="-C $APP_ROOT/config/puma.rb" DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production"
PID_PATH="$APP_ROOT/tmp/pids" PID_PATH="$APP_ROOT/tmp/pids"
SOCKET_PATH="$APP_ROOT/tmp/sockets" SOCKET_PATH="$APP_ROOT/tmp/sockets"
SOCKET_FILE="$SOCKET_PATH/gitlab.socket" WEB_SERVER_PID="$PID_PATH/unicorn.pid"
WEB_SERVER_PID="$PID_PATH/puma.pid"
SIDEKIQ_PID="$PID_PATH/sidekiq.pid" SIDEKIQ_PID="$PID_PATH/sidekiq.pid"
STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop" STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop"
START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start" START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start"
...@@ -52,8 +51,8 @@ start() { ...@@ -52,8 +51,8 @@ start() {
exit 1 exit 1
else else
if [ `whoami` = root ]; then if [ `whoami` = root ]; then
! [ -e $SOCKET_FILE ] || execute "rm $SOCKET_FILE" execute "rm -f $SOCKET_PATH/gitlab.socket"
execute "RAILS_ENV=production bundle exec puma $DAEMON_OPTS" execute "RAILS_ENV=production bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &"
execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
echo "$DESC started" echo "$DESC started"
fi fi
...@@ -66,13 +65,12 @@ stop() { ...@@ -66,13 +65,12 @@ stop() {
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
## Program is running, stop it. ## Program is running, stop it.
kill -QUIT `cat $WEB_SERVER_PID` kill -QUIT `cat $WEB_SERVER_PID`
! [ -e $SOCKET_FILE ] || execute "rm $SOCKET_FILE"
execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
rm "$WEB_SERVER_PID" >> /dev/null rm "$WEB_SERVER_PID" >> /dev/null
echo "$DESC stopped" echo "$DESC stopped"
else else
## Program is not running, exit with error. ## Program is not running, exit with error.
echo "Error! $DESC is not started!" echo "Error! $DESC not started!"
exit 1 exit 1
fi fi
} }
...@@ -83,7 +81,7 @@ restart() { ...@@ -83,7 +81,7 @@ restart() {
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
echo "Restarting $DESC..." echo "Restarting $DESC..."
kill -USR2 `cat $WEB_SERVER_PID` kill -USR2 `cat $WEB_SERVER_PID`
execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1" execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
if [ `whoami` = root ]; then if [ `whoami` = root ]; then
execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
fi fi
...@@ -98,7 +96,7 @@ status() { ...@@ -98,7 +96,7 @@ status() {
cd $APP_ROOT cd $APP_ROOT
check_pid check_pid
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
echo "$DESC / Puma with PID $PID is running." echo "$DESC / Unicorn with PID $PID is running."
echo "$DESC / Sidekiq with PID $SPID is running." echo "$DESC / Sidekiq with PID $SPID is running."
else else
echo "$DESC is not running." echo "$DESC is not running."
......
#! /bin/bash
# GITLAB
# Maintainer: @randx
# App Version: 6.0
### BEGIN INIT INFO
# Provides: gitlab
# Required-Start: $local_fs $remote_fs $network $syslog redis-server
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: GitLab git repository management
# Description: GitLab git repository management
### END INIT INFO
APP_ROOT="/home/git/gitlab"
APP_USER="git"
DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production"
PID_PATH="$APP_ROOT/tmp/pids"
SOCKET_PATH="$APP_ROOT/tmp/sockets"
WEB_SERVER_PID="$PID_PATH/unicorn.pid"
SIDEKIQ_PID="$PID_PATH/sidekiq.pid"
STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop"
START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start"
NAME="gitlab"
DESC="GitLab service"
check_pid(){
if [ -f $WEB_SERVER_PID ]; then
PID=`cat $WEB_SERVER_PID`
SPID=`cat $SIDEKIQ_PID`
STATUS=`ps aux | grep $PID | grep -v grep | wc -l`
else
STATUS=0
PID=0
fi
}
execute() {
sudo -u $APP_USER -H bash -l -c "$1"
}
start() {
cd $APP_ROOT
check_pid
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
# Program is running, exit with error code 1.
echo "Error! $DESC $NAME is currently running!"
exit 1
else
if [ `whoami` = root ]; then
execute "rm -f $SOCKET_PATH/gitlab.socket"
execute "RAILS_ENV=production bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &"
execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
echo "$DESC started"
fi
fi
}
stop() {
cd $APP_ROOT
check_pid
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
## Program is running, stop it.
kill -QUIT `cat $WEB_SERVER_PID`
execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
rm "$WEB_SERVER_PID" >> /dev/null
echo "$DESC stopped"
else
## Program is not running, exit with error.
echo "Error! $DESC not started!"
exit 1
fi
}
restart() {
cd $APP_ROOT
check_pid
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
echo "Restarting $DESC..."
kill -USR2 `cat $WEB_SERVER_PID`
execute "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
if [ `whoami` = root ]; then
execute "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
fi
echo "$DESC restarted."
else
echo "Error, $NAME not running!"
exit 1
fi
}
status() {
cd $APP_ROOT
check_pid
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
echo "$DESC / Puma with PID $PID is running."
echo "$DESC / Sidekiq with PID $SPID is running."
else
echo "$DESC is not running."
exit 1
fi
}
## Check to see if we are running as root first.
## Found at http://www.cyberciti.biz/tips/shell-root-user-check-script.html
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root"
exit 1
fi
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
reload|force-reload)
echo -n "Reloading $NAME configuration: "
kill -HUP `cat $PID`
echo "done."
;;
status)
status
;;
*)
echo "Usage: sudo service gitlab {start|stop|restart|reload}" >&2
exit 1
;;
esac
exit 0
desc "GITLAB | Migrate Global Projects to Namespaces" desc "GITLAB | Migrate Global Projects to Namespaces"
task migrate_global_projects: :environment do task migrate_global_projects: :environment do
puts "This will move all projects without namespace to owner namespace" found = Project.where(namespace_id: nil).count
if found > 0
puts "Global namespace is deprecated. We found #{found} projects stored in global namespace".yellow
puts "You may abort this task and move them to group/user namespaces manually."
puts "If you want us to move this projects under owner namespaces then continue"
ask_to_continue ask_to_continue
else
puts "No global projects found. Proceed with update.".green
end
Project.where(namespace_id: nil).find_each(batch_size: 20) do |project| Project.where(namespace_id: nil).find_each(batch_size: 20) do |project|
begin begin
......
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