<> Notes sur l'installation de http://redmine.auf.org (rappel : première version de JeanChristopheAndré : /PremiereVersion) On a décidé d'installer la version 1.0-stable (svn) sans passer par un paquet Debian. Le framework Rails est également installé directement, via le système «gem» de Ruby. Quelques paquets viennent des backports. Sources d'inspiration : * http://www.redmine.org/wiki/redmine/RedmineInstall * http://doc.ubuntu-fr.org/redmine#configuration == Préparation == Machine Debian Lenny 5.0, avec activation des backports et de volatile : * ajout de `lenny/volatile` et `lenny-backports` au `/etc/apt/sources.list` * création d'un fichier `/etc/apt/preferences` contenant : {{{ Explanation: autoriser les mises à jour automatiques pour les backports Package: * Pin: release a=lenny-backports Pin-Priority: 200 }}} * correction du `/etc/hosts` pour mettre le nom pleinement qualifié (''FQDN'') avant l'alias... * vérification du support des `locales` Unicode, en particulier `fr_FR.UTF-8` * installation de `mysql-server`, sécurisation et mise en place du support Unicode * installation de `apache2` et mise en place du support Unicode == Installation Ruby et paquets ruby de base nécessaires == {{{ # aptitude install ruby # aptitude install irb # facultatif, utile pour le script/console de redmine # aptitude -t lenny-backports install rubygems rake # aptitude install libopenssl-ruby # aptitude install libdbd-mysql-ruby mysql-client # aptitude install librmagick-ruby # facultatif, permettra d'avoir des graphes dans redmine }}} == Installation de rails 2.3.5 et dépendances (via gem) == {{{ # gem install rails -V -v=2.3.5 (...) Successfully installed rake-0.8.7 Successfully installed activesupport-2.3.5 Successfully installed activerecord-2.3.5 Successfully installed rack-1.0.1 Successfully installed actionpack-2.3.5 Successfully installed actionmailer-2.3.5 Successfully installed activeresource-2.3.5 Successfully installed rails-2.3.5 8 gems installed }}} == Téléchargement de redmine 1.0-stable via svn == On installe redmine dans `/opt` : {{{ # cd /opt # svn checkout http://redmine.rubyforge.org/svn/branches/1.0-stable redmine-1.0 # ln -s redmine-1.0 redmine }}} == Configuration de redmine == Création de la base MySQL `redmine09` et de l'utilisateur correspondant : {{{ create database redmine09 character set utf8; create user 'redmine'@'localhost' identified by 'trucmachin'; grant all privileges on redmine09.* to 'redmine'@'localhost'; }}} Connexion de redmine à cette base : {{{ # cat > config/database.yml << EOF production: adapter: mysql database: redmine09 host: localhost username: redmine password: trucmachin encoding: utf8 EOF }}} == Initialisation de redmine == {{{ $ rake generate_session_store $ export RAILS_ENV=production $ rake db:migrate $ rake redmine:load_default_data $ rake db:migrate_plugins # est-ce nécessaire ? je ne pense pas, mais ça fait pas de mal. }}} == Mise en production via mongrel == (note : ceci est inspiré de http://doc.ubuntu-fr.org/redmine#configuration) Mongrel est un serveur HTTP qui va propulser redmine sur un port local (127.0.0.1:3000). C'est ensuite apache qui rendra redmine visible de l'extérieur en HTTPS (voir ci-dessous) : {{{ # aptitude install mongrel }}} Création d'un utilisateur dédié à redmine et mise en place des droits d'accès : {{{ # adduser --system redmine --home /opt/redmine --no-create-home --group --gecos "redmine system user" --disabled-login --disabled-password # cd /opt/redmine # chown -R redmine:redmine log files tmp plugin/plugin_assets }}} Ajout d'un script de démarrage de redmine via mongrel : [[attachment:redmine_mongrel.sh|/etc/init.d/redmine_mongrel]], et activation de ce script avec `update-rc.d redmine_mongrel defaults` == Mise à disposition en HTTPS avec apache == Activation des modules d'apache2 nécessaires : {{{ # a2enmod proxy proxy_http ssl }}} On installe le certificat et la clé SSL pour *.auf.org et on configure le site dans /etc/apache2/sites-enabled/redmine.auf.org : {{{ (...) SSLEngine on SSLCertificateFile /.../all-auf.org.crt SSLCertificateKeyFile /.../all-auf.org.key SSLCACertificateFile /.../CA.pem SSLVerifyClient None (...) ProxyPreserveHost Off ProxyPass / http://127.0.0.1:3000/ ProxypassReverse / http://127.0.0.1:3000/ Order allow,deny Allow from all ServerAdmin webmaster@auf.org ServerName redmine.auf.org Redirect permanent / https://redmine.auf.org/ }}} == Création automatique des comptes depuis le LDAP == Note : ceci suppose que l'authentification LDAP a été activée dans redmine, et que le groupe AUF existe. Script lancé en cron toutes les 5 minutes : [[attachment:sync_ldap.sh]] == Synchronisation des dépôts git == Un cron est installé qui met à jour tous les dépôts `/srv/git/*.git` : {{{ #!/bin/sh # sources d'inspiration # http://mult.ifario.us/p/integrating-github-and-redmine # http://www.redmine.org/wiki/redmine/RedmineRepositories # mise a jour des depots for git in `ls -d /srv/git/*.git` do echo "git fetch $git" cd $git git --bare fetch origin :master #git reset refs/remotes/origin/master > /dev/null #selon doc redmine, mais est-ce necessaire ? done # mise a jour du suivi par redmine # (optionnel, car de toute façon ça serait fait lors du premier acces a chaque depot) echo "mise a jour redmine (Repository.fetch_changesets)" cd /opt/redmine ./script/runner "Repository.fetch_changesets" -e production }}} Pour activer un nouveau dépôt sur la machine, il suffit donc de faire quelque chose comme : {{{ root@redmine# su - redmine redmine@redmine$ cd /srv/git redmine@redmine$ git clone --bare git://git.auf.org/xxxx.git xxxx.git redmine@redmine$ cd xxxx.git redmine@redmine$ git --bare remote add origin git://git.auf.org/xxxx.git }}} Voir aussi [[Git/DépôtGit]] == Patches AUF (actif) == Ces modifications ont été apportées au redmine installé : * rendre accessible l'URL demandée initialement {{{#!highlight diff --- app/helpers/application_helper.rb (révision 6284) +++ app/helpers/application_helper.rb (copie de travail) @@ -766,6 +766,12 @@ form_for(name, object, options.merge({ :builder => TabularFormBuilder, :lang => current_language}), &proc) end + def back_url_link + back_url = params[:back_url] || request.env['HTTP_REFERER'] + back_url = CGI.unescape(back_url.to_s) + CGI.escape(back_url) + end + def back_url_hidden_field_tag back_url = params[:back_url] || request.env['HTTP_REFERER'] back_url = CGI.unescape(back_url.to_s) }}} * ajouter l'accès id.auf (SSO/SLO) sur la page de login : {{{#!highlight diff --- ./app/views/account/login.html.erb.orig 2016-10-10 07:48:13.000000000 +0000 +++ ./app/views/account/login.html.erb 2019-11-25 16:38:12.754314977 +0000 @@ -3,6 +3,19 @@ <%= form_tag(signin_path, onsubmit: 'return keepAnchorOnSignIn(this);') do %> <%= back_url_hidden_field_tag %> + + + + + + + @@ -10,6 +23,8 @@ + <% if Setting.lost_password? %>  <%= link_to 'Oublié ?', :controller => 'account', :action => 'lost_password' %><% end %> + <% if Setting.openid? %> @@ -20,21 +35,13 @@ - - - - +
Usagers de l'AUF : + +
+
+ ou +
+
Pour les usagers qui n'ont pas d'adresse @auf.org,
utilisez le formulaire de connexion suivant :
<%= text_field_tag 'username', params[:username], :tabindex => '1' %>
<%= password_field_tag 'password', nil, :tabindex => '2' %>
+ <% if Setting.autologin? %> <% end %>
- <% if Setting.lost_password? %> - <%= link_to l(:label_password_lost), lost_password_path %> - <% end %> - - -
<% end %> }}} {{{#!highlight diff --- public/stylesheets/application.css (révision 7077) +++ public/stylesheets/application.css (copie de travail) @@ -89,7 +89,8 @@ #login-form table {margin-top:5em; padding:1em; margin-left: auto; margin-right: auto; border: 2px solid #FDBF3B; background-color:#FFEBC1; } #login-form table td {padding: 6px;} #login-form label {font-weight: bold;} -#login-form input#username, #login-form input#password { width: 300px; } +#login-form input#username { width: 300px; } +#login-form input#password { width: 220px; } input#openid_url { background: url(../images/openid-bg.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px; } }}} == Patches AUF (obsolètes) == * --(utilisation correcte de `git` pour les projets avec dépôt git :)-- plus nécessaire depuis 1.0 {{{#!highlight diff --- lib/redmine/scm/adapters/git_adapter.rb (revision 3762) +++ lib/redmine/scm/adapters/git_adapter.rb (working copy) @@ -22,7 +22,7 @@ module Adapters class GitAdapter < AbstractAdapter # Git executable name - GIT_BIN = "git" + GIT_BIN = "/usr/bin/git" def info begin }}} * --(ne pas afficher les descriptions dans la liste des projets (https://redmine.auf.org/projects) :)-- mieux géré en 1.0 {{{#!highlight diff --- app/helpers/projects_helper.rb (revision 3762) +++ app/helpers/projects_helper.rb (working copy) @@ -70,7 +70,7 @@ classes = (ancestors.empty? ? 'root' : 'child') s << "
  • " + link_to(h(project), {:controller => 'projects', :action => 'show', :id => project}, :class => "project #{User.current.member_of?(project) ? 'my-project' : nil}") - s << "
    #{textilizable(project.short_description, :project => project)}
    " unless project.description.blank? + # s << "
    #{textilizable(project.short_description, :project => project)}
    " unless project.description.blank? s << "
    \n" ancestors << project end }}} * --(permettre des logins de 60 caractères : )-- déjà intégré par Redmine . voir http://www.redmine.org/attachments/1642/0001-Fixes-2719.patch * --(affichage plus claire des sous-projets d'un projet (items au lieu d'une seule liste virgulée) : )-- plus vraiment indiqué {{{#!highlight diff --- app/views/projects/show.rhtml (revision 6284) +++ app/views/projects/show.rhtml (working copy) @@ -14,7 +14,10 @@ <% unless @project.homepage.blank? %>
  • <%=l(:field_homepage)%>: <%= auto_link(h(@project.homepage)) %>
  • <% end %> <% if @subprojects.any? %>
  • <%=l(:label_subproject_plural)%>: - <%= @subprojects.collect{|p| link_to(h(p), :action => 'show', :id => p)}.join(", ") %>
  • + + <% end %> <% @project.custom_values.each do |custom_value| %> <% if !custom_value.value.blank? %> }}}