Project

General

Profile

Install-log » History » Version 10

Anthony Mallet, 2014-07-15 13:04

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
<pre>
56
# yum install centos-release-SCL
57
# yum install ruby193-ruby-devel
58
# echo source /opt/rh/ruby193/enable > /etc/profile.d/ruby193.sh
59
</pre>
60
61 1 Anthony Mallet
* Install dependencies
62
<pre>
63
% su -
64
# yum install curl-devel openssl-devel
65
# yum install httpd-devel apr-devel apr-util-devel
66 9 Anthony Mallet
# yum install ImageMagick-devel
67 1 Anthony Mallet
</pre>
68
69
* Create a redmine user
70
<pre>
71
% useradd -d /opt/redmine ... redmine
72
% su - redmine
73
# mkdir src gems files logs
74
</pre>
75
76
* Get current redmine code - hosted in the @redmine-laas@ project, branch @laas@.
77
<pre>
78
# cd src
79 3 Anthony Mallet
# git clone git://redmine.laas.fr/laas/redmine-laas/redmine laas
80
# cd laas
81 1 Anthony Mallet
# git checkout laas
82
</pre>
83
84
* Note that the @log@ and @plugin@ directories are symlinks to @$HOME@, for easier upgrades.
85
86
* Configure a few files, samples are provided in the @.example@ files at the same place.
87
<pre>
88
# emacs config/database.yml
89
# emacs config/configuration.yml
90
# emacs config/additional_environment.rb
91
</pre>
92
93
* Install some gems locally
94
<pre>
95 9 Anthony Mallet
# gem install bundler
96 1 Anthony Mallet
# bundle install --path /opt/redmine/gems --without development test
97
Your bundle is complete!
98
</pre>
99
100
* Setup PATHs etc.
101
<pre>
102
# emacs ~/.profile
103 9 Anthony Mallet
 + export PATH=opt/redmine/gems/ruby/1.9.1/bin:/bin:/sbin:/usr/bin:/usr/sbin
104
 + export GEM_PATH=/opt/redmine/gems/ruby/1.9.1
105
 + source /opt/rh/ruby193/enable
106 1 Anthony Mallet
</pre>
107
108 2 Anthony Mallet
* Some magic to setup rails/redmine etc.
109
<pre>
110
# rake generate_secret_token
111
# RAILS_ENV=production rake db:migrate
112
# RAILS_ENV=production rake redmine:load_default_data
113 1 Anthony Mallet
 + [en]
114 2 Anthony Mallet
</pre>
115
116
* Test everything is OK on @http://localhost:3000@. (not for production!)
117
<pre>
118
# ruby script/rails server webrick -e production
119
</pre>
120 1 Anthony Mallet
}}
121
122 2 Anthony Mallet
{{collapse(apache)
123
* Compile @passenger@ (installed as a gem thanks to @Gemfile.local@ in redmine (laas)
124
<pre>
125
% passenger-install-apache2-module
126
</pre>
127 1 Anthony Mallet
128 2 Anthony Mallet
* Configure httpd.conf as follow:
129
<pre>
130
# /etc/httpd/conf/httpd.conf
131
NameVirtualHost *:80
132
NameVirtualHost [::]:80
133
NameVirtualHost *:443
134
NameVirtualHost [::]:443
135
</pre>
136 1 Anthony Mallet
137 2 Anthony Mallet
 <pre>
138
# /etc/httpd/conf.d/redmine.conf
139 1 Anthony Mallet
<VirtualHost *:443 [::]:443>
140 2 Anthony Mallet
    SSLEngine on
141 1 Anthony Mallet
    SSLCertificateFile /etc/pki/tls/certs/localhost.crt
142 2 Anthony Mallet
    SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
143 1 Anthony Mallet
144
    ServerName redmine.laas.fr
145
    ServerAdmin sysadmin@laas.fr
146 3 Anthony Mallet
    DocumentRoot /opt/redmine/src/laas/public
147 1 Anthony Mallet
    ErrorLog /opt/redmine/logs/httpd-errors
148
    CustomLog /opt/redmine/logs/httpd-access common
149
150 9 Anthony Mallet
    LoadModule passenger_module /opt/redmine/gems/ruby/1.9.1/gems/passenger-4.0.40/buildout/apache2/mod_passenger.so
151
    PassengerRoot /opt/redmine/gems/ruby/1.9.1/gems/passenger-4.0.40
152
    PassengerDefaultRuby /opt/rh/ruby193/root/usr/bin/ruby
153 2 Anthony Mallet
    PassengerDefaultUser redmine
154 9 Anthony Mallet
155
    SetEnv PATH /opt/rh/ruby193/root/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
156
    SetENV LD_LIBRARY_PATH /opt/rh/ruby193/root/usr/lib64
157 1 Anthony Mallet
158 3 Anthony Mallet
    <Directory /opt/redmine/src/laas/public>
159 2 Anthony Mallet
        AllowOverride all
160
        Options -MultiViews
161
        Allow from all
162
    </Directory>
163
</VirtualHost>
164 1 Anthony Mallet
165 2 Anthony Mallet
<VirtualHost *:80 [::]:80>
166
    ServerName redmine.laas.fr
167
    Redirect permanent / https://redmine.laas.fr/
168
</VirtualHost>
169
</pre>
170
171
* Reload
172
<pre>
173
# /etc/init.d/httpd reload
174
</pre>
175
}}
176
177
{{collapse(redmine plugins)
178 4 Anthony Mallet
* git hosting hosted in @redmine-laas/plugin@ project ...
179 2 Anthony Mallet
<pre>
180
% cd ~/plugins
181 1 Anthony Mallet
% git clone git://github.com/thorin/redmine_ldap_sync
182 2 Anthony Mallet
% git clone git://github.com/jbox-web/redmine_plugin_views_revisions
183 6 Anthony Mallet
% git clone https://github.com/cdwertmann/recaptcha.git
184 2 Anthony Mallet
</pre>
185
 <pre>
186 5 Anthony Mallet
% git clone git://localhost/laas/redmine-laas/redmine_git_hosting
187 2 Anthony Mallet
% cd redmine_git_hosting
188
</pre>
189
190
* Some magic to update redmine
191
<pre>
192
% cd ~/src/redmine
193
% bundle install
194
% RAILS_ENV=production rake redmine:plugins:migrate
195
% RAILS_ENV=production rake redmine:plugins:process_version_change
196
</pre>
197
198
* Setup gitolite
199
<pre>
200
# su - redmine
201
% mkdir .ssh
202
% ssh-keygen -N '' -f ~/.ssh/gitolite_admin_rsa # use the same key as already in gitolite
203
% emacs ~/.ssh/config
204 1 Anthony Mallet
 + Host localhost
205
 +  User git
206
 +  IdentityFile /opt/redmine/.ssh/gitolite_admin_rsa
207
 +  IdentitiesOnly yes
208 2 Anthony Mallet
</pre>
209 1 Anthony Mallet
210 2 Anthony Mallet
* Setup (manually) @RW+@ access to gitolite-admin for user @redmine@
211 1 Anthony Mallet
212 2 Anthony Mallet
* Allow @sudo@
213
<pre>
214
# sudo visudo
215 1 Anthony Mallet
 + redmine        ALL=(git)      NOPASSWD:ALL
216
 + git            ALL=(redmine)  NOPASSWD:ALL
217 2 Anthony Mallet
</pre>
218 1 Anthony Mallet
219 2 Anthony Mallet
* Setup redmine user name
220
<pre>
221
% git config --global user.email "redmine@laas.fr"
222
% git config --global user.name "Redmine"
223
</pre>
224 1 Anthony Mallet
225 2 Anthony Mallet
* Test
226
<pre>
227
% ssh localhost info
228
  R W    gitolite-admin
229
</pre>
230
}}
231 1 Anthony Mallet
232 2 Anthony Mallet
{{collapse(restart redmine)
233 1 Anthony Mallet
234 2 Anthony Mallet
* This works for any RoR software:
235
<pre>
236
% touch /opt/redmine/src/redmine/tmp/restart.txt
237
</pre>
238
}}