From 63f06439852d246487e757cac9c3ceccb619cdb0 Mon Sep 17 00:00:00 2001 From: Charles Oliveira <18oliveira.charles@gmail.com> Date: Tue, 12 Aug 2014 09:40:05 -0300 Subject: [PATCH] Added instalation scripts --- scripts/Arquivos/colab/ipconfig.yml | 5 +++++ scripts/Arquivos/gitlab-unicorn | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/Arquivos/mailman/list.conf | 23 +++++++++++++++++++++++ scripts/Arquivos/mailman/mailman_list_conf.conf | 3 +++ scripts/Arquivos/postgres/ipconfig.sh | 4 ++++ scripts/Arquivos/postgres/pg_hba.conf | 23 +++++++++++++++++++++++ scripts/Arquivos/redmine/routes.rb | 358 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/Arquivos/redmine/unicorn.rb | 25 +++++++++++++++++++++++++ scripts/Arquivos/remote-user-auth.py | 17 +++++++++++++++++ scripts/Arquivos/solr/schema.xml | 245 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/Arquivos/solr/solrconfig.xml | 1821 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/Arquivos/solr/solrinit | 45 +++++++++++++++++++++++++++++++++++++++++++++ scripts/Arquivos/solr/start.sh | 20 ++++++++++++++++++++ scripts/colab.sh | 204 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/gitlab.sh | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/mailman.sh | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/postgres.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/redmine.sh | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/solr.sh | 38 ++++++++++++++++++++++++++++++++++++++ scripts/trac.sh | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 20 files changed, 3370 insertions(+), 0 deletions(-) create mode 100644 scripts/Arquivos/colab/ipconfig.yml create mode 100644 scripts/Arquivos/gitlab-unicorn create mode 100644 scripts/Arquivos/mailman/list.conf create mode 100644 scripts/Arquivos/mailman/mailman_list_conf.conf create mode 100644 scripts/Arquivos/postgres/ipconfig.sh create mode 100644 scripts/Arquivos/postgres/pg_hba.conf create mode 100644 scripts/Arquivos/redmine/routes.rb create mode 100644 scripts/Arquivos/redmine/unicorn.rb create mode 100644 scripts/Arquivos/remote-user-auth.py create mode 100644 scripts/Arquivos/solr/schema.xml create mode 100644 scripts/Arquivos/solr/solrconfig.xml create mode 100755 scripts/Arquivos/solr/solrinit create mode 100755 scripts/Arquivos/solr/start.sh create mode 100755 scripts/colab.sh create mode 100755 scripts/gitlab.sh create mode 100755 scripts/mailman.sh create mode 100755 scripts/postgres.sh create mode 100755 scripts/redmine.sh create mode 100755 scripts/solr.sh create mode 100755 scripts/trac.sh diff --git a/scripts/Arquivos/colab/ipconfig.yml b/scripts/Arquivos/colab/ipconfig.yml new file mode 100644 index 0000000..2a130c9 --- /dev/null +++ b/scripts/Arquivos/colab/ipconfig.yml @@ -0,0 +1,5 @@ +COLAB_TRAC_IP=127.0.0.1 +COLAB_GITLAB_IP=127.0.0.1 +COLAB_REDMINE_IP=127.0.0.1 +COLAB_DATABASE_IP=10.1.0.41 +COLAB_SOLR_IP=10.1.0.42 diff --git a/scripts/Arquivos/gitlab-unicorn b/scripts/Arquivos/gitlab-unicorn new file mode 100644 index 0000000..355dbec --- /dev/null +++ b/scripts/Arquivos/gitlab-unicorn @@ -0,0 +1,124 @@ +#!/bin/bash +# +# GitLab +# Contributors : @elvanja, @troyanov, @eiyaya, @foyo23, @nielsbasjes, @relip, @JasonMing, @andronat, @axilleas, @mdirkse +# App Version : 6.x - 7.x + +# chkconfig: 2345 82 55 +# processname: unicorn +# processname: sidekiq +# description: Runs unicorn and sidekiq for nginx integration. + +# Related (kudos @4sak3n0ne): +# https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882 +# https://gist.github.com/3062860 + +# Include RedHat function library +. /etc/rc.d/init.d/functions + +# The name of the service +NAME=${0##*/} + +### Environment variables +RAILS_ENV="production" + +# The username and path to the gitlab source +USER=git +APP_PATH=/home/git/gitlab + +# The PID and LOCK files used by unicorn and sidekiq +UPID=$APP_PATH/tmp/pids/unicorn.pid +ULOCK=/var/lock/subsys/unicorn +SPID=$APP_PATH/tmp/pids/sidekiq.pid +SLOCK=/var/lock/subsys/sidekiq + +# Evaluate the real path for the user (should already have RVM) +PATH_PATCH="PATH=$(su $USER -s /bin/bash -l -c "echo \"\$PATH\"") && export PATH && " + +start() { + cd $APP_PATH + + # Start unicorn + echo -n $"Starting unicorn: " + daemon --pidfile=$UPID --user=$USER "$PATH_PATCH RAILS_ENV=$RAILS_ENV bin/web start" + unicorn=$? + [ $unicorn -eq 0 ] && touch $ULOCK + echo + + # Start sidekiq + echo -n $"Starting sidekiq: " + daemon --pidfile=$SPID --user=$USER "$PATH_PATCH RAILS_ENV=$RAILS_ENV bin/background_jobs start" + sidekiq=$? + [ $sidekiq -eq 0 ] && touch $SLOCK + echo + + retval=$unicorn || $sidekiq + return $retval +} + +stop() { + cd $APP_PATH + + # Stop unicorn + echo -n $"Stopping unicorn: " + killproc -p $UPID + unicorn=$? + [ $unicorn -eq 0 ] && rm -f $ULOCK + echo + + # Stop sidekiq + echo -n $"Stopping sidekiq: " + killproc -p $SPID + sidekiq=$? + [ $sidekiq -eq 0 ] && rm -f $SLOCK + echo + + retval=$unicorn || $sidekiq + return $retval +} + +restart() { + stop + start +} + +get_status() { + status -p $UPID unicorn + unicorn=$? + + status -p $SPID sidekiq + sidekiq=$? + + retval=$unicorn || $sidekiq + return $retval +} + +query_status() { + get_status >/dev/null 2>&1 + return $? +} + +case "$1" in + start) + query_status && exit 0 + start || exit 1 + ;; + stop) + query_status || exit 0 + stop || exit 1 + ;; + restart) + restart || exit 1 + ;; + status) + get_status + exit $? + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|status}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/scripts/Arquivos/mailman/list.conf b/scripts/Arquivos/mailman/list.conf new file mode 100644 index 0000000..611cacf --- /dev/null +++ b/scripts/Arquivos/mailman/list.conf @@ -0,0 +1,23 @@ + server { + server_name localhost; + listen 8025; + + location /mailman/cgi-bin { + root /usr/lib; + fastcgi_split_path_info (^/mailman/cgi-bin/[^/]*)(.*)$; + include /etc/nginx/fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + fastcgi_intercept_errors on; + fastcgi_pass unix:/var/run/fcgiwrap.socket; + } + location /images/mailman { + alias /usr/lib/mailman/icons; + } + location /pipermail { + alias /var/lib/mailman/archives/public; + autoindex on; + } + } + diff --git a/scripts/Arquivos/mailman/mailman_list_conf.conf b/scripts/Arquivos/mailman/mailman_list_conf.conf new file mode 100644 index 0000000..56a795e --- /dev/null +++ b/scripts/Arquivos/mailman/mailman_list_conf.conf @@ -0,0 +1,3 @@ +spb +arthurmde@gmail.com +admin diff --git a/scripts/Arquivos/postgres/ipconfig.sh b/scripts/Arquivos/postgres/ipconfig.sh new file mode 100644 index 0000000..454ffbf --- /dev/null +++ b/scripts/Arquivos/postgres/ipconfig.sh @@ -0,0 +1,4 @@ +TRAC_IP=127.0.0.1 +REDMINE_IP=127.0.0.1 +COLAB_IP=127.0.0.1 +GITLAB_IP=$COLAB_IP diff --git a/scripts/Arquivos/postgres/pg_hba.conf b/scripts/Arquivos/postgres/pg_hba.conf new file mode 100644 index 0000000..d5afed2 --- /dev/null +++ b/scripts/Arquivos/postgres/pg_hba.conf @@ -0,0 +1,23 @@ +# TYPE DATABASE USER ADDRESS METHOD + +# "local" is for Unix domain socket connections only + local redmine redmine md5 + local trac_colab colab md5 + local colab colab md5 + local gitlabhq_production git trust + local postgres git trust + local all postgres peer +# IPv4 local connections: + host redmine redmine 127.0.0.1/32 md5 + host trac_colab colab 127.0.0.1/32 md5 + host colab colab 127.0.0.1/32 md5 + host gitlabhq_production git 127.0.0.1/32 trust + host postgres git 127.0.0.1/32 trust + host all postgres 127.0.0.1/32 ident +# IPv6 local connections: + host redmine redmine ::1/128 md5 + host trac_colab colab ::1/128 md5 + host colab colab ::1/128 md5 + host gitlabhq_production git ::1/128 trust + host postgres git ::1/128 trust + host all postgres ::1/128 ident diff --git a/scripts/Arquivos/redmine/routes.rb b/scripts/Arquivos/redmine/routes.rb new file mode 100644 index 0000000..b0462d9 --- /dev/null +++ b/scripts/Arquivos/redmine/routes.rb @@ -0,0 +1,358 @@ +# Redmine - project management software +# Copyright (C) 2006-2013 Jean-Philippe Lang +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +Redmine::Utils::relative_url_root = "/redmine" + +RedmineApp::Application.routes.draw do + scope Redmine::Utils::relative_url_root do + root :to => 'welcome#index', :as => 'home' + + match 'login', :to => 'account#login', :as => 'signin', :via => [:get, :post] + match 'logout', :to => 'account#logout', :as => 'signout', :via => [:get, :post] + match 'account/register', :to => 'account#register', :via => [:get, :post], :as => 'register' + match 'account/lost_password', :to => 'account#lost_password', :via => [:get, :post], :as => 'lost_password' + match 'account/activate', :to => 'account#activate', :via => :get + + match '/news/preview', :controller => 'previews', :action => 'news', :as => 'preview_news', :via => [:get, :post, :put] + match '/issues/preview/new/:project_id', :to => 'previews#issue', :as => 'preview_new_issue', :via => [:get, :post, :put] + match '/issues/preview/edit/:id', :to => 'previews#issue', :as => 'preview_edit_issue', :via => [:get, :post, :put] + match '/issues/preview', :to => 'previews#issue', :as => 'preview_issue', :via => [:get, :post, :put] + + match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post + match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post] + + match 'boards/:board_id/topics/new', :to => 'messages#new', :via => [:get, :post], :as => 'new_board_message' + get 'boards/:board_id/topics/:id', :to => 'messages#show', :as => 'board_message' + match 'boards/:board_id/topics/quote/:id', :to => 'messages#quote', :via => [:get, :post] + get 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' + + post 'boards/:board_id/topics/preview', :to => 'messages#preview', :as => 'preview_board_message' + post 'boards/:board_id/topics/:id/replies', :to => 'messages#reply' + post 'boards/:board_id/topics/:id/edit', :to => 'messages#edit' + post 'boards/:board_id/topics/:id/destroy', :to => 'messages#destroy' + + # Misc issue routes. TODO: move into resources + match '/issues/auto_complete', :to => 'auto_completes#issues', :via => :get, :as => 'auto_complete_issues' + match '/issues/context_menu', :to => 'context_menus#issues', :as => 'issues_context_menu', :via => [:get, :post] + match '/issues/changes', :to => 'journals#index', :as => 'issue_changes', :via => :get + match '/issues/:id/quoted', :to => 'journals#new', :id => /\d+/, :via => :post, :as => 'quoted_issue' + + match '/journals/diff/:id', :to => 'journals#diff', :id => /\d+/, :via => :get + match '/journals/edit/:id', :to => 'journals#edit', :id => /\d+/, :via => [:get, :post] + + get '/projects/:project_id/issues/gantt', :to => 'gantts#show', :as => 'project_gantt' + get '/issues/gantt', :to => 'gantts#show' + + get '/projects/:project_id/issues/calendar', :to => 'calendars#show', :as => 'project_calendar' + get '/issues/calendar', :to => 'calendars#show' + + get 'projects/:id/issues/report', :to => 'reports#issue_report', :as => 'project_issues_report' + get 'projects/:id/issues/report/:detail', :to => 'reports#issue_report_details', :as => 'project_issues_report_details' + + match 'my/account', :controller => 'my', :action => 'account', :via => [:get, :post] + match 'my/account/destroy', :controller => 'my', :action => 'destroy', :via => [:get, :post] + match 'my/page', :controller => 'my', :action => 'page', :via => :get + match 'my', :controller => 'my', :action => 'index', :via => :get # Redirects to my/page + match 'my/reset_rss_key', :controller => 'my', :action => 'reset_rss_key', :via => :post + match 'my/reset_api_key', :controller => 'my', :action => 'reset_api_key', :via => :post + match 'my/password', :controller => 'my', :action => 'password', :via => [:get, :post] + match 'my/page_layout', :controller => 'my', :action => 'page_layout', :via => :get + match 'my/add_block', :controller => 'my', :action => 'add_block', :via => :post + match 'my/remove_block', :controller => 'my', :action => 'remove_block', :via => :post + match 'my/order_blocks', :controller => 'my', :action => 'order_blocks', :via => :post + + resources :users + match 'users/:id/memberships/:membership_id', :to => 'users#edit_membership', :via => :put, :as => 'user_membership' + match 'users/:id/memberships/:membership_id', :to => 'users#destroy_membership', :via => :delete + match 'users/:id/memberships', :to => 'users#edit_membership', :via => :post, :as => 'user_memberships' + + post 'watchers/watch', :to => 'watchers#watch', :as => 'watch' + delete 'watchers/watch', :to => 'watchers#unwatch' + get 'watchers/new', :to => 'watchers#new' + post 'watchers', :to => 'watchers#create' + post 'watchers/append', :to => 'watchers#append' + delete 'watchers', :to => 'watchers#destroy' + get 'watchers/autocomplete_for_user', :to => 'watchers#autocomplete_for_user' + # Specific routes for issue watchers API + post 'issues/:object_id/watchers', :to => 'watchers#create', :object_type => 'issue' + delete 'issues/:object_id/watchers/:user_id' => 'watchers#destroy', :object_type => 'issue' + + resources :projects do + member do + get 'settings(/:tab)', :action => 'settings', :as => 'settings' + post 'modules' + post 'archive' + post 'unarchive' + post 'close' + post 'reopen' + match 'copy', :via => [:get, :post] + end + + shallow do + resources :memberships, :controller => 'members', :only => [:index, :show, :new, :create, :update, :destroy] do + collection do + get 'autocomplete' + end + end + end + + resource :enumerations, :controller => 'project_enumerations', :only => [:update, :destroy] + + get 'issues/:copy_from/copy', :to => 'issues#new', :as => 'copy_issue' + resources :issues, :only => [:index, :new, :create] do + resources :time_entries, :controller => 'timelog' do + collection do + get 'report' + end + end + end + # issue form update + match 'issues/update_form', :controller => 'issues', :action => 'update_form', :via => [:put, :post], :as => 'issue_form' + + resources :files, :only => [:index, :new, :create] + + resources :versions, :except => [:index, :show, :edit, :update, :destroy] do + collection do + put 'close_completed' + end + end + get 'versions.:format', :to => 'versions#index' + get 'roadmap', :to => 'versions#index', :format => false + get 'versions', :to => 'versions#index' + + resources :news, :except => [:show, :edit, :update, :destroy] + resources :time_entries, :controller => 'timelog' do + get 'report', :on => :collection + end + resources :queries, :only => [:new, :create] + shallow do + resources :issue_categories + end + resources :documents, :except => [:show, :edit, :update, :destroy] + resources :boards + shallow do + resources :repositories, :except => [:index, :show] do + member do + match 'committers', :via => [:get, :post] + end + end + end + + match 'wiki/index', :controller => 'wiki', :action => 'index', :via => :get + resources :wiki, :except => [:index, :new, :create], :as => 'wiki_page' do + member do + get 'rename' + post 'rename' + get 'history' + get 'diff' + match 'preview', :via => [:post, :put] + post 'protect' + post 'add_attachment' + end + collection do + get 'export' + get 'date_index' + end + end + match 'wiki', :controller => 'wiki', :action => 'show', :via => :get + get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/} + delete 'wiki/:id/:version', :to => 'wiki#destroy_version' + get 'wiki/:id/:version/annotate', :to => 'wiki#annotate' + get 'wiki/:id/:version/diff', :to => 'wiki#diff' + end + + resources :issues do + collection do + match 'bulk_edit', :via => [:get, :post] + post 'bulk_update' + end + resources :time_entries, :controller => 'timelog' do + collection do + get 'report' + end + end + shallow do + resources :relations, :controller => 'issue_relations', :only => [:index, :show, :create, :destroy] + end + end + match '/issues', :controller => 'issues', :action => 'destroy', :via => :delete + + resources :queries, :except => [:show] + + resources :news, :only => [:index, :show, :edit, :update, :destroy] + match '/news/:id/comments', :to => 'comments#create', :via => :post + match '/news/:id/comments/:comment_id', :to => 'comments#destroy', :via => :delete + + resources :versions, :only => [:show, :edit, :update, :destroy] do + post 'status_by', :on => :member + end + + resources :documents, :only => [:show, :edit, :update, :destroy] do + post 'add_attachment', :on => :member + end + + match '/time_entries/context_menu', :to => 'context_menus#time_entries', :as => :time_entries_context_menu, :via => [:get, :post] + + resources :time_entries, :controller => 'timelog', :except => :destroy do + collection do + get 'report' + get 'bulk_edit' + post 'bulk_update' + end + end + match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/ + # TODO: delete /time_entries for bulk deletion + match '/time_entries/destroy', :to => 'timelog#destroy', :via => :delete + + get 'projects/:id/activity', :to => 'activities#index' + get 'projects/:id/activity.:format', :to => 'activities#index' + get 'activity', :to => 'activities#index' + + # repositories routes + get 'projects/:id/repository/:repository_id/statistics', :to => 'repositories#stats' + get 'projects/:id/repository/:repository_id/graph', :to => 'repositories#graph' + + get 'projects/:id/repository/:repository_id/changes(/*path(.:ext))', + :to => 'repositories#changes' + + get 'projects/:id/repository/:repository_id/revisions/:rev', :to => 'repositories#revision' + get 'projects/:id/repository/:repository_id/revision', :to => 'repositories#revision' + post 'projects/:id/repository/:repository_id/revisions/:rev/issues', :to => 'repositories#add_related_issue' + delete 'projects/:id/repository/:repository_id/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' + get 'projects/:id/repository/:repository_id/revisions', :to => 'repositories#revisions' + get 'projects/:id/repository/:repository_id/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :format => false, + :constraints => { + :action => /(browse|show|entry|raw|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ + } + + get 'projects/:id/repository/statistics', :to => 'repositories#stats' + get 'projects/:id/repository/graph', :to => 'repositories#graph' + + get 'projects/:id/repository/changes(/*path(.:ext))', + :to => 'repositories#changes' + + get 'projects/:id/repository/revisions', :to => 'repositories#revisions' + get 'projects/:id/repository/revisions/:rev', :to => 'repositories#revision' + get 'projects/:id/repository/revision', :to => 'repositories#revision' + post 'projects/:id/repository/revisions/:rev/issues', :to => 'repositories#add_related_issue' + delete 'projects/:id/repository/revisions/:rev/issues/:issue_id', :to => 'repositories#remove_related_issue' + get 'projects/:id/repository/revisions/:rev/:action(/*path(.:ext))', + :controller => 'repositories', + :format => false, + :constraints => { + :action => /(browse|show|entry|raw|annotate|diff)/, + :rev => /[a-z0-9\.\-_]+/ + } + get 'projects/:id/repository/:repository_id/:action(/*path(.:ext))', + :controller => 'repositories', + :action => /(browse|show|entry|raw|changes|annotate|diff)/ + get 'projects/:id/repository/:action(/*path(.:ext))', + :controller => 'repositories', + :action => /(browse|show|entry|raw|changes|annotate|diff)/ + + get 'projects/:id/repository/:repository_id', :to => 'repositories#show', :path => nil + get 'projects/:id/repository', :to => 'repositories#show', :path => nil + + # additional routes for having the file name at the end of url + get 'attachments/:id/:filename', :to => 'attachments#show', :id => /\d+/, :filename => /.*/, :as => 'named_attachment' + get 'attachments/download/:id/:filename', :to => 'attachments#download', :id => /\d+/, :filename => /.*/, :as => 'download_named_attachment' + get 'attachments/download/:id', :to => 'attachments#download', :id => /\d+/ + get 'attachments/thumbnail/:id(/:size)', :to => 'attachments#thumbnail', :id => /\d+/, :size => /\d+/, :as => 'thumbnail' + resources :attachments, :only => [:show, :destroy] + + resources :groups do + member do + get 'autocomplete_for_user' + end + end + + match 'groups/:id/users', :controller => 'groups', :action => 'add_users', :id => /\d+/, :via => :post, :as => 'group_users' + match 'groups/:id/users/:user_id', :controller => 'groups', :action => 'remove_user', :id => /\d+/, :via => :delete, :as => 'group_user' + match 'groups/destroy_membership/:id', :controller => 'groups', :action => 'destroy_membership', :id => /\d+/, :via => :post + match 'groups/edit_membership/:id', :controller => 'groups', :action => 'edit_membership', :id => /\d+/, :via => :post + + resources :trackers, :except => :show do + collection do + match 'fields', :via => [:get, :post] + end + end + resources :issue_statuses, :except => :show do + collection do + post 'update_issue_done_ratio' + end + end + resources :custom_fields, :except => :show + resources :roles do + collection do + match 'permissions', :via => [:get, :post] + end + end + resources :enumerations, :except => :show + match 'enumerations/:type', :to => 'enumerations#index', :via => :get + + get 'projects/:id/search', :controller => 'search', :action => 'index' + get 'search', :controller => 'search', :action => 'index' + + match 'mail_handler', :controller => 'mail_handler', :action => 'index', :via => :post + + match 'admin', :controller => 'admin', :action => 'index', :via => :get + match 'admin/projects', :controller => 'admin', :action => 'projects', :via => :get + match 'admin/plugins', :controller => 'admin', :action => 'plugins', :via => :get + match 'admin/info', :controller => 'admin', :action => 'info', :via => :get + match 'admin/test_email', :controller => 'admin', :action => 'test_email', :via => :get + match 'admin/default_configuration', :controller => 'admin', :action => 'default_configuration', :via => :post + + resources :auth_sources do + member do + get 'test_connection', :as => 'try_connection' + end + collection do + get 'autocomplete_for_new_user' + end + end + + match 'workflows', :controller => 'workflows', :action => 'index', :via => :get + match 'workflows/edit', :controller => 'workflows', :action => 'edit', :via => [:get, :post] + match 'workflows/permissions', :controller => 'workflows', :action => 'permissions', :via => [:get, :post] + match 'workflows/copy', :controller => 'workflows', :action => 'copy', :via => [:get, :post] + match 'settings', :controller => 'settings', :action => 'index', :via => :get + match 'settings/edit', :controller => 'settings', :action => 'edit', :via => [:get, :post] + match 'settings/plugin/:id', :controller => 'settings', :action => 'plugin', :via => [:get, :post], :as => 'plugin_settings' + + match 'sys/projects', :to => 'sys#projects', :via => :get + match 'sys/projects/:id/repository', :to => 'sys#create_project_repository', :via => :post + match 'sys/fetch_changesets', :to => 'sys#fetch_changesets', :via => :get + + match 'uploads', :to => 'attachments#upload', :via => :post + + get 'robots.txt', :to => 'welcome#robots' + + Dir.glob File.expand_path("plugins/*", Rails.root) do |plugin_dir| + file = File.join(plugin_dir, "config/routes.rb") + if File.exists?(file) + begin + instance_eval File.read(file) + rescue Exception => e + puts "An error occurred while loading the routes definition of #{File.basename(plugin_dir)} plugin (#{file}): #{e.message}." + exit 1 + end + end + end +end +end diff --git a/scripts/Arquivos/redmine/unicorn.rb b/scripts/Arquivos/redmine/unicorn.rb new file mode 100644 index 0000000..0f2ae66 --- /dev/null +++ b/scripts/Arquivos/redmine/unicorn.rb @@ -0,0 +1,25 @@ +# Set the working application directory +# working_directory "/path/to/your/app" +working_directory "/opt/redmine" + +# Unicorn PID file location +# pid "/path/to/pids/unicorn.pid" +pid "/opt/redmine/pids/unicorn.pid" + +# Path to logs +# stderr_path "/path/to/log/unicorn.log" +# stdout_path "/path/to/log/unicorn.log" +stderr_path "/opt/redmine/log/unicorn.log" +stdout_path "/opt/redmine/log/unicorn.log" + +# Unicorn socket +#listen "/tmp/unicorn.redmine.sock" +listen "/tmp/unicorn.redmine.sock" + +# Number of processes +# worker_processes 4 +worker_processes 2 + +# Time-out +timeout 30 + diff --git a/scripts/Arquivos/remote-user-auth.py b/scripts/Arquivos/remote-user-auth.py new file mode 100644 index 0000000..a6a64ae --- /dev/null +++ b/scripts/Arquivos/remote-user-auth.py @@ -0,0 +1,17 @@ + from trac.core import * + from trac.config import BoolOption + from trac.web.api import IAuthenticator + + class MyRemoteUserAuthenticator(Component): + + implements(IAuthenticator) + + obey_remote_user_header = BoolOption('trac', 'obey_remote_user_header', 'false', + """Whether the 'Remote-User:' HTTP header is to be trusted for user logins + (''since ??.??').""") + + def authenticate(self, req): + if self.obey_remote_user_header and req.get_header('Remote-User'): + return req.get_header('Remote-User') + return None + diff --git a/scripts/Arquivos/solr/schema.xml b/scripts/Arquivos/solr/schema.xml new file mode 100644 index 0000000..6bbb1c0 --- /dev/null +++ b/scripts/Arquivos/solr/schema.xml @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + id + + + text + + + + \ No newline at end of file diff --git a/scripts/Arquivos/solr/solrconfig.xml b/scripts/Arquivos/solr/solrconfig.xml new file mode 100644 index 0000000..38e94bb --- /dev/null +++ b/scripts/Arquivos/solr/solrconfig.xml @@ -0,0 +1,1821 @@ + + + + + + + + + 4.6 + + + + + + + + + + + + + + + + + + + + + ${solr.data.dir:} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ${solr.lock.type:native} + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + ${solr.autoCommit.maxTime:15000} + false + + + + + + ${solr.autoSoftCommit.maxTime:-1} + + + + + + + + + + + + + + + + + + 1024 + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + 20 + + + 200 + + + + + + + + + + + + static firstSearcher warming in solrconfig.xml + + + + + + false + + + 2 + + + + + + + + + + + + + + + + + + + + + + + explicit + 10 + text + + + + + + + + + + + + + + explicit + json + true + text + + + + + + + + true + json + true + + + + + + + + explicit + + + velocity + browse + layout + Solritas + + + edismax + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text + 100% + *:* + 10 + *,score + + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + title^10.0 description^5.0 keywords^5.0 author^2.0 resourcename^1.0 + + text,features,name,sku,id,manu,cat,title,description,keywords,author,resourcename + 3 + + + on + cat + manu_exact + content_type + author_s + ipod + GB + 1 + cat,inStock + after + price + 0 + 600 + 50 + popularity + 0 + 10 + 3 + manufacturedate_dt + NOW/YEAR-10YEARS + NOW + +1YEAR + before + after + + + on + content features title name + html + <b> + </b> + 0 + title + 0 + name + 3 + 200 + content + 750 + + + on + false + 5 + 2 + 5 + true + true + 5 + 3 + + + + + spellcheck + + + + + + + + + + + + + + application/json + + + + + application/csv + + + + + + + true + ignored_ + + + true + links + ignored_ + + + + + + + + + + + + + + + + + + + + + + solrpingquery + + + all + + + + + + + + + explicit + true + + + + + + + + + + + + + + + + text_general + + + + + + default + text + solr.DirectSolrSpellChecker + + internal + + 0.5 + + 2 + + 1 + + 5 + + 4 + + 0.01 + + + + + + wordbreak + solr.WordBreakSolrSpellChecker + name + true + true + 10 + + + + + + + + + + + + + + + + text + + default + wordbreak + on + true + 10 + 5 + 5 + true + true + 10 + 5 + + + spellcheck + + + + + + + + + + text + true + + + tvComponent + + + + + + + lingo + + + org.carrot2.clustering.lingo.LingoClusteringAlgorithm + + + clustering/carrot2 + + + + + stc + org.carrot2.clustering.stc.STCClusteringAlgorithm + + + + + kmeans + org.carrot2.clustering.kmeans.BisectingKMeansClusteringAlgorithm + + + + + + + true + true + + name + + id + + features + + true + + + + false + + + edismax + + text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0 manu^1.1 cat^1.4 + + *:* + 10 + *,score + + + clustering + + + + + + + + + + + true + false + + + terms + + + + + + + + string + elevate.xml + + + + + + explicit + text + + + elevator + + + + + + + + + + + 100 + + + + + + + + 70 + + 0.5 + + [-\w ,/\n\"']{20,200} + + + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + + + + ,, + ,, + ,, + ,, + ,]]> + ]]> + + + + + + 10 + .,!? + + + + + + + WORD + + + en + US + + + + + + + + + + + + + + + + + + + + + + text/plain; charset=UTF-8 + + + + + + + + + 5 + + + + + + + + + + + + + + + + + + *:* + + + diff --git a/scripts/Arquivos/solr/solrinit b/scripts/Arquivos/solr/solrinit new file mode 100755 index 0000000..bde927f --- /dev/null +++ b/scripts/Arquivos/solr/solrinit @@ -0,0 +1,45 @@ +#!/bin/bash +# chkconfig: 2345 95 20 +# description: Solr +# processname: myscript +# +#----------------------------------------------------- +# Script for running solr as a service. +# +# Usage: service solr {start|stop|restart|status}" +# +#----------------------------------------------------- +# This should be placed in /etc/init.d + +. /etc/rc.d/init.d/functions + +# Path to pid file +PIDFILE=/var/run/solr.pid + +# Service name +NAME="Solr" + +# Service description +DESC="start/stop Solr Server" + +SOLR_INIT="/usr/share/solr/start.sh" + +case $1 in + start) + action "Starting ${NAME}: " daemon --pidfile $PIDFILE $SOLR_INIT + ;; + stop) + action "Stopping ${NAME}: " killproc -p $PIDFILE + ;; + restart) + $0 stop + $0 start + ;; + status) + status -p $PIDFILE solr + ;; + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 3 + ;; +esac \ No newline at end of file diff --git a/scripts/Arquivos/solr/start.sh b/scripts/Arquivos/solr/start.sh new file mode 100755 index 0000000..0ee3435 --- /dev/null +++ b/scripts/Arquivos/solr/start.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +# Directory where solr is installed +SOLR_HOME=/usr/share/solr/example + +# Java options for Solr +OPTIONS="-Xmx1024m" + +# Path to pid file +PIDFILE=/var/run/solr.pid + +# Path to log file +LOG_FILE=/var/log/solr.log + +COMMAND="java $OPTIONS -jar start.jar" + +cd $SOLR_HOME +nohup $COMMAND > $LOG_FILE 2>&1 & +echo $! > $PIDFILE +exit $? diff --git a/scripts/colab.sh b/scripts/colab.sh new file mode 100755 index 0000000..cb9bef5 --- /dev/null +++ b/scripts/colab.sh @@ -0,0 +1,204 @@ +#!/bin/sh +#Instalação do Colab +#------------------- +# +#Siga os passo na máquina destinada ao Colab + +IP_HOSTS=$1 +COLAB_IP=$2 +COLAB_PORT=$3 + +if [[ ! "$IP_HOSTS" || ! "$COLAB_IP" || ! "$COLAB_PORT" ]] + then + echo " Parametros nao encontrados. Utiliza o caminho absoluto para o arquivo." + echo "" + echo " ./colab.sh " + echo "" + echo "Utilize o modelo de ips: + wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/colab/ipconfig.yml -O /tmp/ipconfig.yml + +Exemplo: ./colab.sh /tmp/ipconfig.yml 127.0.0.1 8000 +" + exit -1 +fi + + +# +#*NOTE:* +# +# Libere um acesso externo para esta máquina, pois o site do colab será acessado por esta máquina. +# +#Instale as ferramentas de desenvolvimento do python e algumas dependências para compilar o python +# +#.. code-block:: +# + sudo yum groupinstall "Development tools" -y + sudo yum install zlib-devel bzip2-devel openssl-devel ncurses-devel libxslt-devel vim -y +# +#Faça o download e compile o Python 2.7 +# +#.. code-block:: +# + cd /tmp + sudo wget --no-check-certificate https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz + sudo tar xf Python-2.7.6.tar.xz + cd Python-2.7.6 + sudo ./configure --prefix=/usr/local + sudo make +# +#Instale o python 2.7 como um python alternativo +# +#.. code-block:: +# + sudo make altinstall +# +#Atualize a variável PATH para executar o python2.7 +# +#.. code-block:: +# + sudo sh -c "echo 'export PATH=$PATH:/usr/local/bin/' >> ~/.bashrc" + sudo sh -c "source ~/.bashrc" +# +#Instale o easy_install para o python 2.7 +# +#.. code-block:: +# + cd /tmp + sudo wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py + sudo /usr/local/bin/python2.7 ez_setup.py +# +#Instale o pip 2.7 +# +#.. code-block:: +# + sudo /usr/local/bin/easy_install-2.7 pip +# +#Instale alguns pacotes adicionais do python +# +#.. code-block:: +# + sudo yum remove libevent -y + sudo yum install mercurial libevent-devel python-devel -y +# +#Edite o arquivo sudores para executar o ``python2.7`` como sudo +# +# +#Mude a linha +# +# + sudo sed -i 's/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/local\/bin/' /etc/sudoers +# +#Instalando o Django 1.6 +# +#Instale o django e o uwsgi +# +#.. code-block:: +# + sudo pip2.7 install django + sudo pip2.7 install uwsgi +# +#Instale o Colab +# +#Instale o git e clone o repositório do colab +# +#.. code-block:: + + #Verifica se git instalado para não conflitar com gitlab + git_loc=`type -p $1` + if [[ ! "$git_loc" ]] + then + sudo yum install git -y + fi + + cd /opt + sudo git clone https://github.com/colab-community/colab.git -b dev_spb +# +#Instale os pré-requisitos do colab +# +#.. code-block:: +# + sudo yum install postgresql-devel -y #Foi preciso adicionar esta linha quando o postgrsql não é instalado na mesma máquina + sudo pip2.7 install mimeparse + sudo pip2.7 install -r /opt/colab/requirements.txt +# +#Crie o arquivo local_settings na pasta src/colab +# +#.. code-block:: +# + sudo cp /opt/colab/src/colab/local_settings-dev.py /opt/colab/src/colab/local_settings.py +# +#Edite o arquivo local_settings criado, nele deverão ser alterados os IPs das máquinas utilizadas +# +#.. code-block:: +# + TRAC_IP=`sed -n 1p $1 | grep -Po "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"` + GITLAB_IP=`sed -n 2p $1 | grep -Po "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"` + REDMINE_IP=`sed -n 3p $1 | grep -Po "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"` + + +#Troque os IPs das seguintes linhas +# +#.. code-block:: +# + sudo sed -i "s/http:\/\/localhost:5000\/trac\//http:\/\/$TRAC_IP:5000\/trac\//g" /opt/colab/src/colab/local_settings.py + sudo sed -i "s/http:\/\/localhost:8090\/gitlab\//http:\/\/$GITLAB_IP:8090\/gitlab\//g" /opt/colab/src/colab/local_settings.py + sudo sed -i "s/http:\/\/localhost:9080\/redmine\//http:\/\/$REDMINE_IP:9080\/redmine\//g" /opt/colab/src/colab/local_settings.py + +#Na máquina do colab, sincronize e migre o banco de dados. +# +#.. code-block:: +# +#Passo adicionado: Recebendo o IP onde está instalado o Postgresql + + DATABASE_IP=`sed -n 4p $1 | grep -Po "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"` + + sudo sed -i "s/DATABASES\['default'\]\['HOST'\] = '[^']\+'/DATABASES\['default'\]\['HOST'\] = '$DATABASE_IP'/g" /opt/colab/src/colab/local_settings.py + sudo sed -i "s/DATABASES\['trac'\]\['HOST'\] = '[^']\+'/DATABASES\['trac'\]\['HOST'\] = '$DATABASE_IP'/g" /opt/colab/src/colab/local_settings.py + + cd /opt/colab/src + python2.7 manage.py syncdb + python2.7 manage.py migrate + +#Atualize o index com o solr, para executar esta ação o solr já deve estar funcionando na máquina voltada para o Solr +# +#.. code-block:: +# + SOLR_IP=`sed -n 5p $1 | grep -Po "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+"` + sudo sed -i "s/HAYSTACK_CONNECTIONS\['default'\]\['URL'\] = '[^']\+'/HAYSTACK_CONNECTIONS\['default'\]\['URL'\] = 'http:\/\/$SOLR_IP:8983\/solr\/'/g" /opt/colab/src/colab/local_settings.py + + cd /opt/colab/src + python2.7 manage.py update_index + +#Importe os e-mails do mailman +# +#.. code-block:: +# + sudo python2.7 /opt/colab/src/manage.py import_emails +# +#Crie os Cronjobs para rodar em background a importação de email e a atualização do index +# +#.. code-block:: +# + sudo sh -c "echo \"5 * * * * /usr/bin/python2.7 /opt/colab/src/manage.py import_emails +45 * * * * /usr/bin/python2.7 /opt/colab/src/manage.py update_index\" > /tmp/crontabs" + sudo crontab /tmp/crontabs + +#Instale a inicialização do colab como serviço +# Adicionando o repositório PUIAS(para o supervisor) +sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm +sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias + +sudo yum install supervisor -y + +sudo sh -c "echo \"[program:colab] +command=/usr/local/bin/python2.7 /opt/colab/src/manage.py runserver $2:$3 +directory=/opt/colab +user=colab +autostart=true +autorestart=false +redirect_stderr=true\" >> /etc/supervisord.conf" + + +## 12. Reinicie o supervisor + +sudo service supervisord restart diff --git a/scripts/gitlab.sh b/scripts/gitlab.sh new file mode 100755 index 0000000..271dbca --- /dev/null +++ b/scripts/gitlab.sh @@ -0,0 +1,98 @@ +#!/bin/bash + +DATABASE_HOST=$1 +THIS_HOST=$2 + +if [[ ! "$DATABASE_HOST" || ! "$THIS_HOST" ]] + then + echo " Parametros nao encontrados." + echo " ./mailman.sh " + exit -1 +fi + +[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm" + +sudo yum install -y wget yum-utils vim + +sudo wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 https://www.fedoraproject.org/static/0608B895.txt +sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 + +sudo wget -O /etc/yum.repos.d/PUIAS_6_computational.repo https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/install/centos/PUIAS_6_computational.repo +sudo wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-puias http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias +sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias +sudo yum-config-manager --enable epel --enable PUIAS_6_computational + +sudo yum -y groupinstall 'Development Tools' +sudo yum -y install readline readline-devel ncurses-devel gdbm-devel glibc-devel tcl-devel openssl-devel curl-devel expat-devel db4-devel byacc sqlite-devel libyaml libyaml-devel libffi libffi-devel libxml2 libxml2-devel libxslt libxslt-devel libicu libicu-devel system-config-firewall-tui redis crontabs logwatch logrotate perl-Time-HiRe postfix zlib-devel perl-CPAN gettext curl-develgettext-devel openssl-devel + +sudo chkconfig redis on +sudo service redis start + +sudo yum -y remove git + +mkdir /tmp/git && cd /tmp/git +wget https://git-core.googlecode.com/files/git-1.9.0.tar.gz +tar xzf git-1.9.0.tar.gz +cd git-1.9.0/ +./configure +make +sudo make prefix=/usr/local install + +sudo adduser --system --shell /bin/bash --comment 'GitLab' --create-home --home-dir /home/git/ git + +sudo echo 'git ALL=(ALL) ALL' >> /etc/sudoers.d/git +################################################# + +sudo sh -c "curl -L get.rvm.io | bash -s stable" +sudo usermod -a -G rvm git +source /etc/profile.d/rvm.sh +sudo -iu git source '/usr/local/rvm/scripts/rvm' +sudo -iu git rvm install 2.0.0 +sudo -iu git rvm gemset create gitlab +sudo -iu git rvm use 2.0.0@gitlab --default + +################################################# + +sudo -iu git gem install bundler --no-ri --no-rdoc +sudo -iu git /usr/local/bin/git clone https://gitlab.com/gitlab-org/gitlab-shell.git +sudo -iu git /usr/local/bin/git --git-dir=/home/git/gitlab-shell/.git --work-tree=/home/git/gitlab-shell/ reset --hard v1.9.3 +sudo su - git -c 'cat /home/git/gitlab-shell/config.yml.example > /home/git/gitlab-shell/config.yml' +sudo -iu git ruby /home/git/gitlab-shell/bin/install +sudo restorecon -Rv /home/git/.ssh + +sudo -iu git /usr/local/bin/git clone https://github.com/colab-community/gitlabhq.git -b spb-stable /home/git/gitlab +sudo su - git 'cat /home/git/gitlab/config/gitlab.yml.example > /home/git/gitlab/config/gitlab.yml' + +sudo -iu git mkdir /home/git/gitlab-satellites +sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites +sudo su - git -c 'cat /home/git/gitlab/config/unicorn.rb.example > /home/git/gitlab/config/unicorn.rb' +sudo su - git -c 'cat /home/git/gitlab/config/initializers/rack_attack.rb.example > /home/git/gitlab/config/initializers/rack_attack.rb' +sudo sed -i "s/gitlab_url: \"http:\/\/localhost\/\"/gitlab_url: \"http:\/\/$2:8090\/gitlab\//" /home/git/gitlab-shell/config.yml + +sudo -iu git /usr/local/bin/git config --global user.name "GitLab" +sudo -iu git /usr/local/bin/git config --global user.email "gitlab@localhost" +sudo -iu git /usr/local/bin/git config --global core.autocrlf input +sudo chmod o-rwx /home/git/gitlab/config/database.yml +sudo su - git -c "echo 'production: + adapter: postgresql + encoding: unicode + database: gitlabhq_production + pool: 10 + username: git + host: $DATABASE_HOST' > /home/git/gitlab/config/database.yml" + +# Baixando as dependencias, criando o banco, instalando de fato +sudo su - git -c 'cd /home/git/gitlab && bundle config build.pg' +sudo su - git -c 'cd /home/git/gitlab && bundle config build.nokogiri --use-system-libraries' +sudo su - git -c 'cd /home/git/gitlab && bundle install --deployment --without development test mysql aws' +sudo su - git -c 'cd /home/git/gitlab && echo yes | bundle exec rake db:create db:migrate RAILS_ENV=production' +sudo su - git -c 'cd /home/git/gitlab && echo yes | bundle exec rake gitlab:setup RAILS_ENV=production' +sudo su - git -c 'cd /home/git/gitlab bundle exec rake assets:precompile RAILS_ENV=production' + +# Configurando o servico do gitlab +sudo wget -O /etc/init.d/gitlab https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/gitlab-unicorn +sudo chmod +x /etc/init.d/gitlab +sudo chkconfig --add gitlab +sudo chkconfig gitlab on +sudo cat /home/git/gitlab/lib/support/logrotate/gitlab > /etc/logrotate.d/gitlab +sudo service gitlab restart diff --git a/scripts/mailman.sh b/scripts/mailman.sh new file mode 100755 index 0000000..a9bd8b0 --- /dev/null +++ b/scripts/mailman.sh @@ -0,0 +1,89 @@ +#!/bin/sh + +set -x + +if [[ ! "$1" || ! "$2" ]] + then + echo " Parametros nao encontrados." + echo " ./mailman.sh " + exit -1 +fi + +LIST_NAME="mailman" +ADMIN_MAIL=$1 +ADMIN_PASSWD=$2 + +sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm + +sudo echo '[nginx] +name=nginx repo +baseurl=http://nginx.org/packages/centos/6/$basearch/ +gpgcheck=0 +enabled=1' > /etc/yum.repos.d/nginx.repo + +sudo yum install nginx wget fcgi-devel git -y +sudo chkconfig nginx on + +cd /tmp +sudo git clone https://github.com/gnosek/fcgiwrap.git +sudo yum groupinstall "Development tools" -y +cd /tmp/fcgiwrap +sudo autoreconf -i +sudo ./configure +sudo make && make install + +sudo yum install spawn-fcgi -y + +sudo sh -c "echo 'FCGI_SOCKET=/var/run/fcgiwrap.socket' >> /etc/sysconfig/spawn-fcgi" +sudo sh -c "echo 'FCGI_PROGRAM=/usr/local/sbin/fcgiwrap' >> /etc/sysconfig/spawn-fcgi" +sudo sh -c "echo 'FCGI_USER=apache' >> /etc/sysconfig/spawn-fcgi" +sudo sh -c "echo 'FCGI_GROUP=apache' >> /etc/sysconfig/spawn-fcgi" +sudo sh -c "echo 'FCGI_EXTRA_OPTIONS=\"-M 0770\"' >> /etc/sysconfig/spawn-fcgi" +sudo sh -c "echo 'OPTIONS=\"-u \$FCGI_USER -g \$FCGI_GROUP -s \$FCGI_SOCKET -S \$FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- \$FCGI_PROGRAM\"' >> /etc/sysconfig/spawn-fcgi" + +sudo yum install mailman -y + +echo | sudo /usr/lib/mailman/bin/newlist $LIST_NAME $ADMIN_MAIL $ADMIN_PASSWD + +sudo sh -c "echo >> /etc/aliases" +sudo sh -c "echo '##$LIST_NAME mailing list' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME: \"|/usr/lib/mailman/mail/mailman post $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-admin: \"|/usr/lib/mailman/mail/mailman admin $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-bounces: \"|/usr/lib/mailman/mail/mailman bounces $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-confirm: \"|/usr/lib/mailman/mail/mailman confirm $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-join: \"|/usr/lib/mailman/mail/mailman join $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-leave: \"|/usr/lib/mailman/mail/mailman leave $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-owner: \"|/usr/lib/mailman/mail/mailman owner $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-request: \"|/usr/lib/mailman/mail/mailman request $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-subscribe: \"|/usr/lib/mailman/mail/mailman subscribe $LIST_NAME\"' >> /etc/aliases" +sudo sh -c "echo '$LIST_NAME-unsubscribe: \"|/usr/lib/mailman/mail/mailman unsubscribe $LIST_NAME\"' >> /etc/aliases" + +sudo newaliases + +sudo yum -y install postfix + +sudo /etc/init.d/postfix restart + +sudo chkconfig --levels 235 mailman on + +sudo /etc/init.d/mailman start +cd /usr/lib/mailman/cgi-bin/ +sudo ln -s ./ mailman + +sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/mailman/list.conf -O /etc/nginx/conf.d/list.conf + +sudo service nginx restart + +sudo sh -c "echo 'DEFAULT_URL_PATTERN = \"https://%s/mailman/cgi-bin/\"' >> /etc/mailman/mm_cfg.py" + +sudo /usr/lib/mailman/bin/withlist -l -a -r fix_url +sudo service mailman restart + +sudo usermod -a -G apache nginx + +sudo chkconfig --levels 235 spawn-fcgi on +sudo /etc/init.d/spawn-fcgi start + +sudo service mailman restart +sudo service nginx restart + diff --git a/scripts/postgres.sh b/scripts/postgres.sh new file mode 100755 index 0000000..8c72f5d --- /dev/null +++ b/scripts/postgres.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -x + +if [ ! "$1" ] + then + echo "Arquivo de configuracao nao encontrado." + echo "./postgres.sh " + exit -1 +fi + +CONFIG_FILE=$1 + +sudo yum localinstall http://yum.postgresql.org/9.3/redhat/rhel-6-x86_64/pgdg-centos93-9.3-1.noarch.rpm -y +sudo yum install postgresql-devel postgresql93 postgresql93-devel postgresql93-libs postgresql93-server vim wget -y + +sudo service postgresql-9.3 initdb + +sudo chkconfig postgresql-9.3 on + +sudo service postgresql-9.3 start + +echo "export PATH=$PATH:/usr/pgsql-9.3/bin/" >> ~/.bashrc +source ~/.bashrc +sudo sh -c "echo 'export PATH=$PATH:/usr/pgsql-9.3/bin/' >> ~/.bashrc" +sudo sh -c "source /root/.bashrc" + +sudo sed -i 's/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/pgsql-9.3\/bin/' /etc/sudoers + +sudo -u postgres psql -c "CREATE USER colab SUPERUSER INHERIT CREATEDB CREATEROLE;" +sudo -u postgres psql -c "ALTER USER colab PASSWORD 'colab';" +sudo -u postgres psql -c "CREATE USER git SUPERUSER INHERIT CREATEDB CREATEROLE;" +sudo -u postgres psql -c "CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity';" +sudo -u postgres psql -c "CREATE DATABASE colab WITH OWNER colab ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE=template0;" +sudo -u postgres psql -c "CREATE DATABASE trac_colab WITH OWNER colab ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE=template0;" +sudo -u postgres psql -c "CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;" + +sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/postgres/pg_hba.conf -O /var/lib/pgsql/9.3/data/pg_hba.conf + +source $CONFIG_FILE + +sudo sed -i "s/host redmine redmine 127.0.0.1\/32 md5/host redmine redmine $REDMINE_IP\/32 md5/" /var/lib/pgsql/9.3/data/pg_hba.conf +sudo sed -i "s/host trac_colab colab 127.0.0.1\/32 md5/host trac_colab colab $TRAC_IP\/32 md5/" /var/lib/pgsql/9.3/data/pg_hba.conf +sudo sed -i "s/host colab colab 127.0.0.1\/32 md5/host colab colab $COLAB_IP\/32 md5/" /var/lib/pgsql/9.3/data/pg_hba.conf +sudo sed -i "s/host gitlabhq_production git 127.0.0.1\/32 trust/host gitlabhq_production git $GITLAB_IP\/32 trust/" /var/lib/pgsql/9.3/data/pg_hba.conf + +sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /var/lib/pgsql/9.3/data/postgresql.conf + +sudo service postgresql-9.3 restart + diff --git a/scripts/redmine.sh b/scripts/redmine.sh new file mode 100755 index 0000000..f33f7ce --- /dev/null +++ b/scripts/redmine.sh @@ -0,0 +1,84 @@ +#!/bin/bash + +set -x + +if [ ! "$1" ] + then + echo "Por favor, passe como parâmetro o ip do banco de dados" + echo "./redmine.sh 127.0.0.1" + exit -1 +fi + +sudo rpm -iUvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm + +sudo yum -y install zlib-devel curl-devel httpd-devel apr-devel apr-util-devel subversion git postgresql-devel gcc gcc-c++.x86_64 make automake autoconf curl-devel openssl-devel httpd-devel apr-devel apr-util-devel sqlite-devel libxslt-devel libxml2-devel.x86_64 php-pear ImageMagick ImageMagick-devel ImageMagick-perl vim patch readline readline-devel zlib libffi-devel make bzip2 libtool bison wget libyaml-devel + + +curl -L get.rvm.io | bash -s stable + +source /etc/profile.d/rvm.sh + + +rvm install 2.0.0 +rvm use 2.0.0 --default + +rvm gemset create redmine +rvm gemset use redmine + +sudo chown -R $USER: /opt + +cd /opt +git clone https://github.com/redmine/redmine.git --branch 2.3-stable + +cd /opt/redmine +bundle install --without mysql sqlite +gem install unicorn --no-ri --no-rdoc +gem install pg -v '0.17.1' --no-ri --no-rdoc + +cd config/ + +echo "production: + adapter: postgresql + database: redmine + host: $1 + username: redmine + password: redmine + encoding: utf8" > database.yml + + +rake generate_secret_token + +RAILS_ENV=production rake db:migrate + +echo "pt-BR" | RAILS_ENV=production rake redmine:load_default_data + + +cd /opt/redmine +mkdir pids +wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/redmine/unicorn.rb -O config/unicorn.rb + +wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/redmine/routes.rb -O config/routes.rb + +ln -s /opt/redmine/public /opt/redmine/public/redmine + +cd /opt/redmine/plugins +git clone https://github.com/backlogs/redmine_backlogs.git + +cd redmine_backlogs +git checkout v1.0.6 + +RAILS_ENV=production +export RAILS_ENV +bundle install + +gem uninstall rack -v '1.5.2' + +cd /opt/redmine +bundle install --without mysql sqlite +bundle exec rake db:migrate +bundle exec rake redmine:backlogs:install story_trackers=2 task_tracker=1 + +cd /opt/redmine/plugins +git clone https://github.com/colab-community/single_auth.git + +unicorn_rails -c /opt/redmine/config/unicorn.rb -E production -p 9080 -D diff --git a/scripts/solr.sh b/scripts/solr.sh new file mode 100755 index 0000000..4538265 --- /dev/null +++ b/scripts/solr.sh @@ -0,0 +1,38 @@ +#Instalação do Solr 4.6.1 +#------------------------ + +## Atualizacao +sudo yum update -y + +##Instalacao das Dependencias +sudo yum install -y wget java-1.7.0-openjdk vim + +## 0. Libere a porta 8983 desta máquina para que máquina do colab possa ouvi-la +#sudo iptables -A INPUT -p tcp -dport 8983 -j ACCEPT +#sudo /sbin/service iptables save + +##Faça o download e descompacte o Solr no /tmp +sudo wget http://archive.apache.org/dist/lucene/solr/4.6.1/solr-4.6.1.tgz -O /tmp/solr-4.6.1.tgz +sudo tar xvzf /tmp/solr-4.6.1.tgz -C /usr/share +sudo mv /usr/share/solr-4.6.1 /usr/share/solr + +#Instale o Solr no diretório ``/usr/share`` +sudo cp /usr/share/solr/example/webapps/solr.war /usr/share/solr/example/solr/solr.war + +#Remova a tag ``updateLog`` no solrconfig.xml +sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/solr/solrconfig.xml -O /usr/share/solr/example/solr/collection1/conf/solrconfig.xml + +#Copiar o solr schema +sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/solr/schema.xml -O /usr/share/solr/example/solr/collection1/conf/schema.xml + +#Copiar script de inicialização +sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/solr/solrinit -O /etc/init.d/solr +sudo chmod +x /etc/init.d/solr + +sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/solr/start.sh -O /usr/share/solr/start.sh +sudo chmod +x /usr/share/solr/start.sh + +sudo chkconfig solr on + +#Inicie o solr +sudo service solr start \ No newline at end of file diff --git a/scripts/trac.sh b/scripts/trac.sh new file mode 100755 index 0000000..41165ee --- /dev/null +++ b/scripts/trac.sh @@ -0,0 +1,94 @@ +#!/bin/bash + +# Pré-requisitos + +# Atualizacao +sudo yum update -y + +## Instalação do Trac 0.12 + +# 0. Adicionando o repositório EPEL +sudo yum install -y wget +sudo wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 https://www.fedoraproject.org/static/0608B895.txt +sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 + +# 0. Adicionando o repositório PUIAS +sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm +sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias + +# 1. Libere a porta 5000 desta máquina para que máquina do colab possa ouvi-la +#sudo iptables -A INPUT -p tcp -dport 5000 -j ACCEPT +#sudo /sbin/service iptables save + +# 2. Instale as dependências + +sudo yum install gcc python-devel python-setuptools vim -y +sudo yum install postgresql-devel -y + +# 3. Instale o pacote python para a utilização do postgres + +sudo easy_install psycopg2 + +# 4. Instale o Trac + +sudo yum install -y trac + +# 5. Inicie o Trac + +sudo mkdir -p /opt/trac +sudo trac-admin /opt/trac initenv colab postgres://colab:colab@/trac_colab?host=$1 + +## 6. Instale o subversion + +sudo yum install subversion -y + +## 7. Crie uma pasta para os repositório SVN +# +#sudo mkdir /opt/repos +# +## 8. Edite o arquivo de configuração do Trac +# +##sudo vim /opt/trac/conf/trac.ini +# +##Mude a linha +# +## repository_dir = +# +## para +# +## repository_dir = /opt/repos/ +# +## Dentro da tag [trac] coloque +# +## obey_remote_user_header = true +# +## Insira as linhas a seguir no final do arquivo +# +## [components] +## tracopt.versioncontrol.svn.* = enabled +# +## [ESC]:wq! +# +# +## 9. Crie o plugin do remote user + +sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/remote-user-auth.py -O /opt/trac/plugins/remote-user-auth.py +sudo sed -i "s/\[trac\]/\[trac\]\nobey_remote_user_header = true/" /opt/trac/conf/trac.ini + +## 10. Instale o supervisor + +sudo yum install -y supervisor + +## 11. Modifique o arquivo de configuração + +sudo sh -c "echo \"[program:trac] +command=/usr/sbin/tracd --port 5000 /opt/trac +directory=/opt/trac +user=root +autostart=true +autorestart=false +redirect_stderr=True\" >> /etc/supervisord.conf" + +## 12. Reinicie o supervisor + +sudo service supervisord start -- libgit2 0.21.2