Commit 4670ccd10645fdd227f3851ccea502b7ad93bdf7
Committed by
Sergio Oliveira
1 parent
f45571a2
Exists in
master
and in
39 other branches
improving rvm management in gitlab script
Showing
1 changed file
with
19 additions
and
31 deletions
Show diff stats
scripts/gitlab.sh
... | ... | @@ -4,28 +4,29 @@ |
4 | 4 | set -x |
5 | 5 | |
6 | 6 | DATABASE_HOST=$1 |
7 | +LOCALHOST=$2 | |
7 | 8 | |
8 | -if [[ ! "$DATABASE_HOST" ]] | |
9 | +if [[ ! "$DATABASE_HOST" && ! "$LOCALHOST" ]] | |
9 | 10 | then |
10 | - echo "Uso: ./gitlab.sh <DATABASE_HOST>" | |
11 | + echo "Uso: ./gitlab.sh <DATABASE_HOST> <EXTERNAL_IP>" | |
11 | 12 | exit -1 |
12 | 13 | fi |
13 | 14 | |
14 | -[ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm" | |
15 | +# [ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm" | |
15 | 16 | |
16 | -sudo yum install -y wget yum-utils vim | |
17 | +sudo yum install -y wget yum-utils | |
17 | 18 | |
18 | 19 | sudo wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 https://www.fedoraproject.org/static/0608B895.txt |
19 | 20 | sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 |
20 | - | |
21 | + | |
21 | 22 | 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 |
22 | 23 | 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 |
23 | 24 | sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias |
24 | 25 | sudo yum-config-manager --enable epel --enable PUIAS_6_computational |
25 | - | |
26 | + | |
26 | 27 | sudo yum -y groupinstall 'Development Tools' |
27 | -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 | |
28 | - | |
28 | +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 postfix zlib-devel perl-CPAN gettext curl-devel gettext-devel openssl-devel perl-Time-HiRes.x86_64 | |
29 | + | |
29 | 30 | sudo chkconfig redis on |
30 | 31 | sudo service redis start |
31 | 32 | |
... | ... | @@ -38,49 +39,36 @@ cd git-1.9.0/ |
38 | 39 | ./configure |
39 | 40 | make |
40 | 41 | sudo make prefix=/usr/local install |
41 | - | |
42 | -sudo adduser --system --shell /bin/bash --comment 'GitLab' --create-home --home-dir /home/git/ git | |
43 | 42 | |
44 | -sudo echo 'git ALL=(ALL) ALL' >> /etc/sudoers.d/git | |
45 | -################################################# | |
46 | - | |
47 | -#sudo sh -c "curl -L get.rvm.io | bash -s stable" | |
48 | -sudo usermod -a -G rvm git | |
49 | -#source /etc/profile.d/rvm.sh | |
50 | -#sudo -iu git source '/usr/local/rvm/scripts/rvm' | |
51 | -#sudo -iu git rvm install 2.0.0 | |
52 | -#sudo -iu git rvm gemset create gitlab | |
43 | +sudo adduser --system --shell /bin/bash --comment 'GitLab' --create-home --home-dir /home/git/ git | |
44 | +sudo bash -c "echo 'git ALL=(ALL) ALL' > /etc/sudoers.d/git" | |
53 | 45 | sudo -iu git rvm use 2.0.0@gitlab --default |
54 | 46 | |
55 | -################################################# | |
56 | - | |
57 | -#sudo -iu git gem install bundler --no-ri --no-rdoc | |
58 | 47 | sudo -iu git /usr/local/bin/git clone https://gitlab.com/gitlab-org/gitlab-shell.git |
59 | 48 | 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 |
60 | -sudo -u git cp /home/git/gitlab-shell/config.yml.example /home/git/gitlab-shell/config.yml | |
49 | +sudo -iu git cp /home/git/gitlab-shell/config.yml.example /home/git/gitlab-shell/config.yml | |
61 | 50 | sudo -iu git ruby /home/git/gitlab-shell/bin/install |
62 | 51 | sudo restorecon -Rv /home/git/.ssh |
63 | 52 | |
64 | 53 | sudo -iu git /usr/local/bin/git clone https://github.com/colab-community/gitlabhq.git -b spb-stable /home/git/gitlab |
65 | -sudo -u git cp /home/git/gitlab/config/gitlab.yml.example /home/git/gitlab/config/gitlab.yml | |
66 | - | |
54 | +sudo -iu git cp /home/git/gitlab/config/gitlab.yml.example /home/git/gitlab/config/gitlab.yml | |
67 | 55 | sudo -iu git mkdir /home/git/gitlab-satellites |
68 | 56 | sudo chmod u+rwx,g+rx,o-rwx /home/git/gitlab-satellites |
69 | -sudo -u git cp /home/git/gitlab/config/unicorn.rb.example /home/git/gitlab/config/unicorn.rb | |
70 | -sudo -u git cp /home/git/gitlab/config/initializers/rack_attack.rb.example /home/git/gitlab/config/initializers/rack_attack.rb | |
71 | -sudo sed -i "s/gitlab_url: \"http:\/\/localhost\/\"/gitlab_url: \"http:\/\/$2:8090\/gitlab\//" /home/git/gitlab-shell/config.yml | |
57 | +sudo -iu git cp /home/git/gitlab/config/unicorn.rb.example /home/git/gitlab/config/unicorn.rb | |
58 | +sudo -iu git cp /home/git/gitlab/config/initializers/rack_attack.rb.example /home/git/gitlab/config/initializers/rack_attack.rb | |
59 | +sudo sed -i "s/gitlab_url: \"http:\/\/localhost\/\"/gitlab_url: \"http:\/\/$LOCALHOST:8090\/gitlab\//" /home/git/gitlab-shell/config.yml | |
72 | 60 | |
73 | 61 | sudo -iu git /usr/local/bin/git config --global user.name "GitLab" |
74 | 62 | sudo -iu git /usr/local/bin/git config --global user.email "gitlab@localhost" |
75 | 63 | sudo -iu git /usr/local/bin/git config --global core.autocrlf input |
76 | -sudo chmod o-rwx /home/git/gitlab/config/database.yml | |
77 | -sudo -u git -H bash -c 'echo "production: | |
64 | +sudo su - git -c "echo 'production: | |
78 | 65 | adapter: postgresql |
79 | 66 | encoding: unicode |
80 | 67 | database: gitlabhq_production |
81 | 68 | pool: 10 |
82 | 69 | username: git |
83 | - host: $DATABASE_HOST" > /home/git/gitlab/config/database.yml' | |
70 | + host: $DATABASE_HOST' > /home/git/gitlab/config/database.yml" | |
71 | +sudo -iu git -H chmod o-rwx /home/git/gitlab/config/database.yml | |
84 | 72 | |
85 | 73 | # Baixando as dependencias, criando o banco, instalando de fato |
86 | 74 | sudo su - git -c 'cd /home/git/gitlab && bundle config build.pg' | ... | ... |