Project

General

Profile

Install-log » History » Version 7

Anthony Mallet, 2014-03-19 11:42
mention local patch to gitolite update hook

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