Project

General

Profile

Install-log » History » Version 9

Anthony Mallet, 2014-07-15 13:03

1 1 Anthony Mallet
h1. Installation log
2
3
{{collapse(gitolite)
4
5
* Create a @git@ user
6
<pre>
7
# useradd -d /opt/git ... git
8
</pre>
9
10
* Get current gitolite code
11
<pre>
12
# su - git
13
% mkdir $HOME/bin $HOME/src
14
% cd $HOME/src
15
% git clone git://github.com/sitaramc/gitolite
16
% $HOME/src/gitolite/install -to $HOME/bin
17
</pre>
18
19
* Configure an admin key, will be used later by redmine
20
<pre>
21
% gitolite setup -pk /some/where/id_dsa.pub
22
</pre>
23
24 7 Anthony Mallet
* This patch in @$HOME/.gitolite/hooks/common/update@ is necessary for redmine/https commits
25
<pre>
26
--- update~     2013-12-10 17:30:12.000000000 +0100
27
+++ update      2014-02-06 16:55:54.116934730 +0100
28
@@ -1,5 +1,8 @@
29
 #!/usr/bin/perl
30
 
31
+BEGIN {
32
+    exit 0 if exists $ENV{GL_BYPASS_UPDATE_HOOK};
33
+}
34
 use strict;
35
 use warnings;
36
 
37 1 Anthony Mallet
</pre>
38 8 Anthony Mallet
}}
39 7 Anthony Mallet
40 1 Anthony Mallet
{{collapse(postgres)
41
* Create a redmine user and the database
42
<pre>
43
% psql -U ...
44
% create role redmine login encrypted password '...secret...' noinherit valid until 'infinity';
45
% create database redmine with encoding='UTF8' owner=redmine;
46
% [this is the default, but to be sure: ALTER DATABASE "redmine" SET datestyle="ISO,MDY";
47
</pre>
48
}}
49
50
{{collapse(redmine)
51 3 Anthony Mallet
52
There are two identical installations. One for redmine.laas.fr and one for openrobots.org. They are called @laas@ and @openrobots@ respectively. Only the @laas@ setup is detailed here. @openrobots@ setup is identical.
53
54 9 Anthony Mallet
* Install ruby 1.9
55
56
<pre>
57
# yum install centos-release-SCL
58
# yum install ruby193-ruby-devel
59
# echo source /opt/rh/ruby193/enable > /etc/profile.d/ruby193.sh
60
</pre>
61
62 1 Anthony Mallet
* Install dependencies
63
<pre>
64
% su -
65
# yum install curl-devel openssl-devel
66
# yum install httpd-devel apr-devel apr-util-devel
67 9 Anthony Mallet
# yum install ImageMagick-devel
68 1 Anthony Mallet
</pre>
69
70
* Create a redmine user
71
<pre>
72
% useradd -d /opt/redmine ... redmine
73
% su - redmine
74
# mkdir src gems files logs
75
</pre>
76
77
* Get current redmine code - hosted in the @redmine-laas@ project, branch @laas@.
78
<pre>
79
# cd src
80 3 Anthony Mallet
# git clone git://redmine.laas.fr/laas/redmine-laas/redmine laas
81
# cd laas
82 1 Anthony Mallet
# git checkout laas
83
</pre>
84
85
* Note that the @log@ and @plugin@ directories are symlinks to @$HOME@, for easier upgrades.
86
87
* Configure a few files, samples are provided in the @.example@ files at the same place.
88
<pre>
89
# emacs config/database.yml
90
# emacs config/configuration.yml
91
# emacs config/additional_environment.rb
92
</pre>
93
94
* Install some gems locally
95
<pre>
96 9 Anthony Mallet
# gem install bundler
97 1 Anthony Mallet
# bundle install --path /opt/redmine/gems --without development test
98
Your bundle is complete!
99
</pre>
100
101
* Setup PATHs etc.
102
<pre>
103
# emacs ~/.profile
104 9 Anthony Mallet
 + export PATH=opt/redmine/gems/ruby/1.9.1/bin:/bin:/sbin:/usr/bin:/usr/sbin
105
 + export GEM_PATH=/opt/redmine/gems/ruby/1.9.1
106
 + source /opt/rh/ruby193/enable
107 1 Anthony Mallet
</pre>
108
109 2 Anthony Mallet
* Some magic to setup rails/redmine etc.
110
<pre>
111
# rake generate_secret_token
112
# RAILS_ENV=production rake db:migrate
113
# RAILS_ENV=production rake redmine:load_default_data
114 1 Anthony Mallet
 + [en]
115 2 Anthony Mallet
</pre>
116
117
* Test everything is OK on @http://localhost:3000@. (not for production!)
118
<pre>
119
# ruby script/rails server webrick -e production
120
</pre>
121 1 Anthony Mallet
}}
122
123 2 Anthony Mallet
{{collapse(apache)
124
* Compile @passenger@ (installed as a gem thanks to @Gemfile.local@ in redmine (laas)
125
<pre>
126
% passenger-install-apache2-module
127
</pre>
128 1 Anthony Mallet
129 2 Anthony Mallet
* Configure httpd.conf as follow:
130
<pre>
131
# /etc/httpd/conf/httpd.conf
132
NameVirtualHost *:80
133
NameVirtualHost [::]:80
134
NameVirtualHost *:443
135
NameVirtualHost [::]:443
136
</pre>
137 1 Anthony Mallet
138 2 Anthony Mallet
 <pre>
139
# /etc/httpd/conf.d/redmine.conf
140 1 Anthony Mallet
<VirtualHost *:443 [::]:443>
141 2 Anthony Mallet
    SSLEngine on
142 1 Anthony Mallet
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
143 2 Anthony Mallet
    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
144 1 Anthony Mallet
145
    ServerName redmine.laas.fr
146
    ServerAdmin sysadmin@laas.fr
147 3 Anthony Mallet
    DocumentRoot /opt/redmine/src/laas/public
148 1 Anthony Mallet
    ErrorLog /opt/redmine/logs/httpd-errors
149
    CustomLog /opt/redmine/logs/httpd-access common
150
151 9 Anthony Mallet
    LoadModule passenger_module /opt/redmine/gems/ruby/1.9.1/gems/passenger-4.0.40/buildout/apache2/mod_passenger.so
152
    PassengerRoot /opt/redmine/gems/ruby/1.9.1/gems/passenger-4.0.40
153
    PassengerDefaultRuby /opt/rh/ruby193/root/usr/bin/ruby
154 2 Anthony Mallet
    PassengerDefaultUser redmine
155 9 Anthony Mallet
156
    SetEnv PATH /opt/rh/ruby193/root/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
157
    SetENV LD_LIBRARY_PATH /opt/rh/ruby193/root/usr/lib64
158 1 Anthony Mallet
159 3 Anthony Mallet
    <Directory /opt/redmine/src/laas/public>
160 2 Anthony Mallet
        AllowOverride all
161
        Options -MultiViews
162
        Allow from all
163
    </Directory>
164
</VirtualHost>
165 1 Anthony Mallet
166 2 Anthony Mallet
<VirtualHost *:80 [::]:80>
167
    ServerName redmine.laas.fr
168
    Redirect permanent / https://redmine.laas.fr/
169
</VirtualHost>
170
</pre>
171
172
* Reload
173
<pre>
174
# /etc/init.d/httpd reload
175
</pre>
176
}}
177
178
{{collapse(redmine plugins)
179 4 Anthony Mallet
* git hosting hosted in @redmine-laas/plugin@ project ...
180 2 Anthony Mallet
<pre>
181
% cd ~/plugins
182 1 Anthony Mallet
% git clone git://github.com/thorin/redmine_ldap_sync
183 2 Anthony Mallet
% git clone git://github.com/jbox-web/redmine_plugin_views_revisions
184 6 Anthony Mallet
% git clone https://github.com/cdwertmann/recaptcha.git
185 2 Anthony Mallet
</pre>
186
 <pre>
187 5 Anthony Mallet
% git clone git://localhost/laas/redmine-laas/redmine_git_hosting
188 2 Anthony Mallet
% cd redmine_git_hosting
189
</pre>
190
191
* Some magic to update redmine
192
<pre>
193
% cd ~/src/redmine
194
% bundle install
195
% RAILS_ENV=production rake redmine:plugins:migrate
196
% RAILS_ENV=production rake redmine:plugins:process_version_change
197
</pre>
198
199
* Setup gitolite
200
<pre>
201
# su - redmine
202
% mkdir .ssh
203
% ssh-keygen -N '' -f ~/.ssh/gitolite_admin_rsa # use the same key as already in gitolite
204
% emacs ~/.ssh/config
205 1 Anthony Mallet
 + Host localhost
206
 +  User git
207
 +  IdentityFile /opt/redmine/.ssh/gitolite_admin_rsa
208
 +  IdentitiesOnly yes
209 2 Anthony Mallet
</pre>
210 1 Anthony Mallet
211 2 Anthony Mallet
* Setup (manually) @RW+@ access to gitolite-admin for user @redmine@
212 1 Anthony Mallet
213 2 Anthony Mallet
* Allow @sudo@
214
<pre>
215
# sudo visudo
216 1 Anthony Mallet
 + redmine        ALL=(git)      NOPASSWD:ALL
217
 + git            ALL=(redmine)  NOPASSWD:ALL
218 2 Anthony Mallet
</pre>
219 1 Anthony Mallet
220 2 Anthony Mallet
* Setup redmine user name
221
<pre>
222
% git config --global user.email "redmine@laas.fr"
223
% git config --global user.name "Redmine"
224
</pre>
225 1 Anthony Mallet
226 2 Anthony Mallet
* Test
227
<pre>
228
% ssh localhost info
229
  R W    gitolite-admin
230
</pre>
231
}}
232 1 Anthony Mallet
233 2 Anthony Mallet
{{collapse(restart redmine)
234 1 Anthony Mallet
235 2 Anthony Mallet
* This works for any RoR software:
236
<pre>
237
% touch /opt/redmine/src/redmine/tmp/restart.txt
238
</pre>
239
}}