Commit 475d39be2d4b8e3816e07f9d7e86571274e553cf

Authored by Macartur Carvalho
2 parents be6f1ae6 5271a9f1

atualizando scripts

script/gitlab.sh
@@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
2 2
3 # Coloque aqui os ips do gitlab e do redmine 3 # Coloque aqui os ips do gitlab e do redmine
4 IP_GITLAB="localhost" 4 IP_GITLAB="localhost"
5 -IP_REDMINE="localhost"  
6 -IP_LDAP="localhost"  
7 -PASSWORD_LDAP="12345678" #"cfl5OcVJ" 5 +IP_REDMINE=$1
  6 +IP_LDAP=$2
  7 +PASSWORD_LDAP=$3
8 8
9 while [ -e $IP_GITLAB ] 9 while [ -e $IP_GITLAB ]
10 do 10 do
@@ -46,30 +46,31 @@ do @@ -46,30 +46,31 @@ do
46 fi 46 fi
47 done 47 done
48 48
49 -  
50 -  
51 -  
52 -  
53 # Atualizar o sistema 49 # Atualizar o sistema
54 sudo yum update -y 50 sudo yum update -y
55 51
56 -# Instalar dependencias 52 +#1. Instalar dependencias
  53 +
57 sudo yum install wget vim postfix openssh-server -y 54 sudo yum install wget vim postfix openssh-server -y
58 55
59 -# Fazer o download do gitlab 56 +#2. Fazer o download do gitlab
  57 +
60 sudo wget https://downloads-packages.s3.amazonaws.com/centos-6.5/gitlab-7.0.0_omnibus-1.el6.x86_64.rpm 58 sudo wget https://downloads-packages.s3.amazonaws.com/centos-6.5/gitlab-7.0.0_omnibus-1.el6.x86_64.rpm
61 59
62 -# Instale o Gitlab 60 +#3. Instale o Gitlab
  61 +
63 echo "Instalando gitlab, leva alguns minutos" 62 echo "Instalando gitlab, leva alguns minutos"
64 sudo rpm -i gitlab-7.0.0_omnibus-1.el6.x86_64.rpm 63 sudo rpm -i gitlab-7.0.0_omnibus-1.el6.x86_64.rpm
65 64
66 -# Criar o arquivo de configuracao do gitlab 65 +#4. Criar o arquivo de configuracao do gitlab
  66 +
67 echo "Criando arquivo de configuracao do gitlab" 67 echo "Criando arquivo de configuracao do gitlab"
68 sudo mkdir -p /etc/gitlab 68 sudo mkdir -p /etc/gitlab
69 sudo touch /etc/gitlab/gitlab.rb 69 sudo touch /etc/gitlab/gitlab.rb
70 sudo chmod 600 /etc/gitlab/gitlab.rb 70 sudo chmod 600 /etc/gitlab/gitlab.rb
71 71
72 -# Adicionar configuracoes para o gitlab 72 +#5. Adicionar configuracoes para o gitlab
  73 +
73 echo "Editando as configuracoes do gitlab" 74 echo "Editando as configuracoes do gitlab"
74 sudo echo "redis['port'] = 1234" >> /etc/gitlab/gitlab.rb 75 sudo echo "redis['port'] = 1234" >> /etc/gitlab/gitlab.rb
75 sudo echo "postgresql['port'] = 2345" >> /etc/gitlab/gitlab.rb 76 sudo echo "postgresql['port'] = 2345" >> /etc/gitlab/gitlab.rb
@@ -77,14 +78,15 @@ sudo echo "unicorn['port'] = 3456" >> /etc/gitlab/gitlab.rb @@ -77,14 +78,15 @@ sudo echo "unicorn['port'] = 3456" >> /etc/gitlab/gitlab.rb
77 sudo echo "gitlab_rails['internal_api_url'] = 'http://localhost:3456'" >> /etc/gitlab/gitlab.rb 78 sudo echo "gitlab_rails['internal_api_url'] = 'http://localhost:3456'" >> /etc/gitlab/gitlab.rb
78 sudo echo "external_url \"http://$IP_GITLAB\"" >> /etc/gitlab/gitlab.rb 79 sudo echo "external_url \"http://$IP_GITLAB\"" >> /etc/gitlab/gitlab.rb
79 80
80 -# Adicionar integracao com redmine 81 +#6. Adicionar integracao com redmine
  82 +
81 sudo echo "gitlab_rails['issues_tracker_redmine'] = 'redmine'" >> /etc/gitlab/gitlab.rb 83 sudo echo "gitlab_rails['issues_tracker_redmine'] = 'redmine'" >> /etc/gitlab/gitlab.rb
82 sudo echo "gitlab_rails['issues_tracker_redmine_title'] = 'Redmine'" >> /etc/gitlab/gitlab.rb 84 sudo echo "gitlab_rails['issues_tracker_redmine_title'] = 'Redmine'" >> /etc/gitlab/gitlab.rb
83 sudo echo "gitlab_rails['issues_tracker_redmine_project_url'] = 'http://$IP_REDMINE/projects/:issues_tracker_id'" >> /etc/gitlab/gitlab.rb 85 sudo echo "gitlab_rails['issues_tracker_redmine_project_url'] = 'http://$IP_REDMINE/projects/:issues_tracker_id'" >> /etc/gitlab/gitlab.rb
84 sudo echo "gitlab_rails['issues_tracker_redmine_issues_url'] = 'http://$IP_REDMINE/issues/:id'" >> /etc/gitlab/gitlab.rb 86 sudo echo "gitlab_rails['issues_tracker_redmine_issues_url'] = 'http://$IP_REDMINE/issues/:id'" >> /etc/gitlab/gitlab.rb
85 sudo echo "gitlab_rails['issues_tracker_redmine_new_issue_url'] = 'http://$IP_REDMINE/projects/:issues_tracker_id/issues/new'" >> /etc/gitlab/gitlab.rb 87 sudo echo "gitlab_rails['issues_tracker_redmine_new_issue_url'] = 'http://$IP_REDMINE/projects/:issues_tracker_id/issues/new'" >> /etc/gitlab/gitlab.rb
86 88
87 -# Liberando firewall para servisos http e ssh 89 +#7. Liberando firewall para servisos http e ssh
88 echo "Adicionando regras no firewall para habilitar http e ssh, caso estejam desabilitados" 90 echo "Adicionando regras no firewall para habilitar http e ssh, caso estejam desabilitados"
89 sudo lokkit -s http -s ssh 91 sudo lokkit -s http -s ssh
90 92
@@ -116,7 +118,9 @@ echo "Iniciando gitlab" @@ -116,7 +118,9 @@ echo "Iniciando gitlab"
116 sudo gitlab-ctl reconfigure 118 sudo gitlab-ctl reconfigure
117 sudo gitlab-ctl restart 119 sudo gitlab-ctl restart
118 120
119 -# Mostrando os dados do gitlab 121 +#8. Mostrando os dados do gitlab
  122 +
120 echo "Sucesso! Para acessar o gitlab, abra no navegador o ip $IP_GITLAB" 123 echo "Sucesso! Para acessar o gitlab, abra no navegador o ip $IP_GITLAB"
121 echo "Usuario: root" 124 echo "Usuario: root"
122 echo "Senha: 5iveL!fe" 125 echo "Senha: 5iveL!fe"
  126 +
script/ldap.sh
@@ -186,7 +186,7 @@ ou: oldusers " > base.ldif @@ -186,7 +186,7 @@ ou: oldusers " > base.ldif
186 186
187 cd /tmp/ldap 187 cd /tmp/ldap
188 188
189 -echo "alimentando lda" 189 +echo "Inicializando ldap"
190 sleep 10 190 sleep 10
191 echo "ldapadd -x -D \"cn=admin,${DC}\" -w ${PASSWORD} -f base.ldif" 191 echo "ldapadd -x -D \"cn=admin,${DC}\" -w ${PASSWORD} -f base.ldif"
192 ldapadd -x -D "cn=admin,${DC}" -w ${PASSWORD} -f base.ldif 192 ldapadd -x -D "cn=admin,${DC}" -w ${PASSWORD} -f base.ldif
script/ldap_register.sh
  1 +
1 #!/bin/bash 2 #!/bin/bash
2 3
3 ################################################### Configuração ##################################################### 4 ################################################### Configuração #####################################################
@@ -40,4 +41,3 @@ echo "redmine: ${ADDRESS_REDMINE}" > /opt/Ldap-Register/config/references.yml @@ -40,4 +41,3 @@ echo "redmine: ${ADDRESS_REDMINE}" > /opt/Ldap-Register/config/references.yml
40 echo "gitlab: ${ADDRESS_GITLAB} " >> /opt/Ldap-Register/config/references.yml 41 echo "gitlab: ${ADDRESS_GITLAB} " >> /opt/Ldap-Register/config/references.yml
41 42
42 sudo unicorn_rails -c /opt/Ldap-Register/config/unicorn.rb -E production -l 0.0.0.0:3000 -D 43 sudo unicorn_rails -c /opt/Ldap-Register/config/unicorn.rb -E production -l 0.0.0.0:3000 -D
43 -  
script/postgresql.sh
@@ -3,10 +3,8 @@ @@ -3,10 +3,8 @@
3 # Pré-requisitos 3 # Pré-requisitos
4 4
5 sudo yum update -y 5 sudo yum update -y
6 -# Todas as máquinas devem ter o usuário colab  
7 -# O usuário colab das maquinas devem estar no arquivo ``sudoers``  
8 6
9 -# Instalação do Postgres 9.3 7 +# Instalação do Postgres 3
10 8
11 # Siga todas as instruções a seguir na máquina destinada ao banco de dados Postgres 9 # Siga todas as instruções a seguir na máquina destinada ao banco de dados Postgres
12 # *NOTE:* 10 # *NOTE:*
@@ -39,62 +37,16 @@ sudo sh -c "source /root/.bashrc" @@ -39,62 +37,16 @@ sudo sh -c "source /root/.bashrc"
39 37
40 sudo sed -i 's/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/pgsql-9.3\/bin/' /etc/sudoers 38 sudo sed -i 's/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/pgsql-9.3\/bin/' /etc/sudoers
41 39
42 -# sudo vim /etc/sudoers  
43 -# Dentro do arquivo mude a seguinte linha  
44 -# Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin  
45 -# para  
46 -# Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/pgsql-9.3/bin/  
47 -# Salve e feche o arquivo  
48 -# [ESC]:wq!  
49 -  
50 # 8. Crie todos os usuários e banco de dados necessários para o funcionamento correto do colab. 40 # 8. Crie todos os usuários e banco de dados necessários para o funcionamento correto do colab.
51 41
52 sudo -u postgres psql -c "CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity';" 42 sudo -u postgres psql -c "CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity';"
53 sudo -u postgres psql -c "CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;" 43 sudo -u postgres psql -c "CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;"
54 44
55 -#sudo -u postgres psql  
56 -#  
57 -# CREATE USER colab SUPERUSER INHERIT CREATEDB CREATEROLE;  
58 -# ALTER USER colab PASSWORD 'colab';  
59 -# CREATE USER git;  
60 -# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'redmine' NOINHERIT VALID UNTIL 'infinity';  
61 -#  
62 -# CREATE DATABASE gitlabhq_production OWNER git;  
63 -# CREATE DATABASE "colab" WITH OWNER "colab" ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE=template0;  
64 -# CREATE DATABASE "trac_colab" WITH OWNER "colab" ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE=template0;  
65 -# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;  
66 -# \q  
67 -  
68 # 9. Altere o pg_hba.conf para conceder as permissões corretas aos usuários 45 # 9. Altere o pg_hba.conf para conceder as permissões corretas aos usuários
69 46
70 -sudo wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/postgres/pg_hba.conf -O /var/lib/pgsql/9.3/data/pg_hba.conf  
71 -  
72 -# sudo vi /var/lib/pgsql/9.3/data/pg_hba.conf  
73 -  
74 -# As permissõe devem ser as que estão abaixo, que serão encontradas no final do arquivo, ou seja, as linhas do fim do arquivo devem ser substituidas.  
75 -  
76 - # TYPE DATABASE USER ADDRESS METHOD  
77 -  
78 - # "local" is for Unix domain socket connections only  
79 -# local all postgres peer  
80 -# local redmine redmine md5  
81 -# local trac_colab colab md5  
82 -# local colab colab md5  
83 -# local gitlabhq_production git trust  
84 - # IPv4 local connections:  
85 -# host all postgres 127.0.0.1/32 ident  
86 -# host redmine redmine 127.0.0.1/32 md5  
87 -# host trac_colab colab 127.0.0.1/32 md5  
88 -# host colab colab 127.0.0.1/32 md5  
89 -# host gitlabhq_production git 127.0.0.1/32 trust  
90 - # IPv6 local connections:  
91 -# host all postgres ::1/128 ident  
92 -# host redmine redmine ::1/128 md5  
93 -# host trac_colab colab ::1/128 md5  
94 -# host colab colab ::1/128 md5  
95 -# host gitlabhq_production git ::1/128 trust  
96 -# [ESC]:wq! 47 +sudo wget https://gitlab.com/softwarepublico/labsei/raw/master/arquivos/postgres/pg_hba.conf -O /var/lib/pgsql/9.3/data/pg_hba.conf
97 48
98 # 10. Reinicie o postgresql 49 # 10. Reinicie o postgresql
99 50
100 sudo service postgresql-9.3 restart 51 sudo service postgresql-9.3 restart
  52 +
script/redmine.sh
@@ -3,19 +3,22 @@ @@ -3,19 +3,22 @@
3 # Pré-requisitos 3 # Pré-requisitos
4 4
5 # Atualizacao 5 # Atualizacao
6 -sudo yum update -y  
7 6
  7 +sudo yum update -y
8 8
9 ## Instalação do Redmine 2.3 9 ## Instalação do Redmine 2.3
10 10
11 # Instalando EPEL 11 # Instalando EPEL
  12 +
12 sudo yum install -y wget 13 sudo yum install -y wget
13 sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm 14 sudo rpm -Uvh https://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
14 15
15 # 1. Instale os requisitos 16 # 1. Instale os requisitos
  17 +
16 sudo yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel subversion git postgresql-devel gcc gcc-c++.x86_64 make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel libxslt-devel libxml2-devel.x86_64 php-pear ImageMagick ImageMagick-devel ImageMagick-perl vim 18 sudo yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel subversion git postgresql-devel gcc gcc-c++.x86_64 make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel libxslt-devel libxml2-devel.x86_64 php-pear ImageMagick ImageMagick-devel ImageMagick-perl vim
17 19
18 # 2. Compilando o ruby 20 # 2. Compilando o ruby
  21 +
19 mkdir /tmp/ruby && cd /tmp/ruby 22 mkdir /tmp/ruby && cd /tmp/ruby
20 sudo curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz | tar xz 23 sudo curl --progress ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p451.tar.gz | tar xz
21 cd ruby-2.0.0-p451 24 cd ruby-2.0.0-p451
@@ -24,24 +27,29 @@ make @@ -24,24 +27,29 @@ make
24 sudo make prefix=/usr/local install 27 sudo make prefix=/usr/local install
25 28
26 # 3. Instalando bundle 29 # 3. Instalando bundle
  30 +
27 sudo /usr/local/bin/gem install bundle --no-ri --no-rdoc 31 sudo /usr/local/bin/gem install bundle --no-ri --no-rdoc
28 32
29 # 4. Adicionando /usr/local/bin no path 33 # 4. Adicionando /usr/local/bin no path
  34 +
30 sudo sed -i 's/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/local\/bin/' /etc/sudoers 35 sudo sed -i 's/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin/\/sbin:\/bin:\/usr\/sbin:\/usr\/bin:\/usr\/local\/bin/' /etc/sudoers
31 36
32 # 5. Instalando o redmine 2.3-stable 37 # 5. Instalando o redmine 2.3-stable
  38 +
33 cd /opt 39 cd /opt
34 sudo svn co http://svn.redmine.org/redmine/branches/2.3-stable redmine 40 sudo svn co http://svn.redmine.org/redmine/branches/2.3-stable redmine
35 sudo mkdir -p tmp/pdf public/plugin_assets 41 sudo mkdir -p tmp/pdf public/plugin_assets
36 42
37 -## 6. Instalando gems 43 +# 6. Instalando gems
  44 +
38 sudo chown -R $USER:$GROUP redmine 45 sudo chown -R $USER:$GROUP redmine
39 cd /opt/redmine 46 cd /opt/redmine
40 bundle install --without mysql sqlite 47 bundle install --without mysql sqlite
41 sudo gem install unicorn --no-ri --no-rdoc 48 sudo gem install unicorn --no-ri --no-rdoc
42 sudo gem install pg -v '0.17.1' --no-ri --no-rdoc 49 sudo gem install pg -v '0.17.1' --no-ri --no-rdoc
43 50
44 -## 7. Configurar database.yml no Redmine# 51 +# 7. Configurar database.yml no Redmine#
  52 +
45 cd config/ 53 cd config/
46 mv database.yml.example database.yml 54 mv database.yml.example database.yml
47 echo "production: 55 echo "production:
@@ -52,42 +60,51 @@ echo "production: @@ -52,42 +60,51 @@ echo "production:
52 password: redmine 60 password: redmine
53 encoding: utf8" > database.yml 61 encoding: utf8" > database.yml
54 62
55 -## 8. Populando Redmine 63 +# 8. Populando Redmine
  64 +
56 rake generate_secret_token 65 rake generate_secret_token
57 RAILS_ENV=production rake db:migrate 66 RAILS_ENV=production rake db:migrate
58 echo "pt-BR" | RAILS_ENV=production rake redmine:load_default_data 67 echo "pt-BR" | RAILS_ENV=production rake redmine:load_default_data
59 68
60 -## 9. Configurando Unicorn 69 +# 9. Configurando Unicorn
  70 +
61 cd /opt/redmine 71 cd /opt/redmine
62 mkdir pids 72 mkdir pids
63 -wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/redmine/unicorn.rb -O config/unicorn.rb 73 +wget https://gitlab.com/softwarepublico/labsei/raw/master/arquivos/redmine/unicorn.rb -O config/unicorn.rb
  74 +
  75 +# 10. Configurando routes.rb
64 76
65 -## 10. Configurando routes.rb  
66 -wget https://gitlab.com/softwarepublico/colabdocumentation/raw/master/Arquivos/redmine/routes.rb -O config/routes.rb 77 +wget https://gitlab.com/softwarepublico/labsei/raw/master/arquivos/redmine/routes.rb -O config/routes.rb
  78 +
  79 +# 11. Adicionando link simbólico
67 80
68 -## 11. Adicionando link simbólico  
69 ln -s /opt/redmine/public /opt/redmine/public/redmine 81 ln -s /opt/redmine/public /opt/redmine/public/redmine
70 82
71 -## 12. Instalando o plugin do backlogs 83 +# 12. Instalando o plugin do backlogs
  84 +
72 cd /opt/redmine/plugins 85 cd /opt/redmine/plugins
73 git clone https://github.com/backlogs/redmine_backlogs.git 86 git clone https://github.com/backlogs/redmine_backlogs.git
74 cd redmine_backlogs 87 cd redmine_backlogs
75 git checkout v1.0.6 88 git checkout v1.0.6
76 89
77 -## 13. Bundle install 90 +# 13. Bundle install
  91 +
78 RAILS_ENV=production 92 RAILS_ENV=production
79 export RAILS_ENV 93 export RAILS_ENV
80 bundle install 94 bundle install
81 95
82 -## 14. Corrigindo dependências 96 +# 14. Corrigindo dependências
  97 +
83 sudo /usr/local/bin/gem uninstall rack -v '1.5.2' 98 sudo /usr/local/bin/gem uninstall rack -v '1.5.2'
84 99
85 -## 15. Bundle install redmine 100 +# 15. Bundle install redmine
  101 +
86 cd /opt/redmine 102 cd /opt/redmine
87 bundle install --without mysql sqlite 103 bundle install --without mysql sqlite
88 bundle exec rake db:migrate 104 bundle exec rake db:migrate
89 bundle exec rake redmine:backlogs:install story_trackers=2 task_tracker=1 105 bundle exec rake redmine:backlogs:install story_trackers=2 task_tracker=1
90 106
  107 +# 16. Executando redmine
91 108
92 -## 16. Executando redmine  
93 sudo unicorn_rails -c /opt/redmine/config/unicorn.rb -E production -l 0.0.0.0:9080 -D 109 sudo unicorn_rails -c /opt/redmine/config/unicorn.rb -E production -l 0.0.0.0:9080 -D
  110 +