...
Just my blog

Blog about everything, mostly about tech stuff I made. Here is the list of stuff I'm using at my blog. Feel free to ask me about implementations.

Soft I recommend
Py lib I recommend

I'm using these libraries so you can ask me about them.

Update Redmine 2.5.2

Обновляю Редмайн на новую версию, вроде как ничего нового с 2.5.1 не появилось, "работает не трогай" а все равно руки чешутся. Ну и читаю, в общем я два гайда: Русский: [su_spoiler title="Русский гайд"]

Шаг 3 - Выполнить обновление

Теперь пришло время для выполнения фактического обновления. Этот процесс является различным в зависимости от того, как вы скачали Redmine. Вам только нужно выполнить один из следующих вариантов.

Вариант 1 - Скачайте релиз в виде tar.gz или ZIP-файл 1. Распакуйте новый архив программы в новый каталог. 2. Скопируйте настройки базы данных, файл config/database.yml в директорию config новой директории установки. Если вы запускаете Redmine >= 1.4 с mysql и ruby1.9, измените адаптер базы данных на 'mysql2'. 3a. Скопируйте файл основных настроек config/configuration.yml в директорию config новой директории установки 3b. Или, если вы обновляете с версии ранее 1.2.0, скопируйте настройки вашей почты из вашего файла config/email.yml в новый файл config/configuration.yml, который может быть создан копированием существующего файла configuration.yml.example. 4. Скопируйте содержимое каталога files в новую директорию установки (данная директория содержит все ваши загруженные файлы). 5. Скопируйте папки ваших установленных плагинов из директории vendor/plugins (если вы обновляете с версии ниже 2.0.0) или из директории plugins (если вы обновляете с версии выше 2.0.0) в новую pluginsдиректорию установки. Убедитесь, что вы копируете только те плагины, которые подходят для новой устанавливаемой версии Redmine.

6. Выполните следующую команду из нового корневого каталога Redmine:

rake generate_secret_token

Данная команда создаст файл (config/initializers/secret_token.rb) со случайными данными, используемый для защиты данных сессий.

7. Проверьте, нет ли тем, которые вы могли установить в каталог public/themes. Вы тоже можете их скопировать, но проверьте подходят ли они для обновленной версии.

ОЧЕНЬ ВАЖНО: не заменять файл config/settings.yml старой версией!

[/su_spoiler]

А теперь внимание привлекает ангйлоязычный:

[su_spoiler title="Англ гайд"]

Option 1 - Downloaded release (tar.gz or zip file) 1. Uncompress the new program archive in a new directory. 2. Copy your database settings-file config/database.yml into the new config directory. If you're running Redmine >= 1.4 with mysql and ruby1.9, change the database adapter to 'mysql2'. 3a. Copy your base configuration settings-file config/configuration.yml into the new config directory. 3b. Or, if upgrading from version older than 1.2.0, copy your email settings from your config/email.yml into the new config/configuration.yml file that can be created by copying the availableconfiguration.yml.example file. 4. Copy the files directory content into your new installation (this directory contains all your uploaded files). 5. Copy the folders of your custom installed plugins from your vendor/plugins directory (if upgrading from a version prior to 2.0.0) or plugins directory (else, upgrading from a version >= 2.0.0) into new installation pluginsdirectory. Make sure that you copy only plugins that are were not initially bundled with your previous Redmine setup.

6. Install the required gems by running:

bundle install --without development test

If ImageMagick is not installed on your system, you should skip the installation of the rmagick gem using:

bundle install --without development test rmagick

Only the gems that are needed by the adapters you've specified in your database configuration file are actually installed (eg. if your config/database.yml uses the 'mysql2' adapter, then only the mysql2 gem will be installed). Don't forget to re-run 'bundle install' when you change config/database.yml for using other database adapters. If you need to load some gems that are not required by Redmine core (eg. fcgi), you can create a file named Gemfile.local at the root of your redmine directory. It will be loaded automatically when running 'bundle install'. 7. Run the following command from your new Redmine root directory:

rake generate_secret_token

This will generate a file (config/initializers/secret_token.rb) with a random secret used to secure session data. 8. Check for any themes that you may have installed in the public/themes directory. You can copy them over but checking for updated version is ideal. VERY IMPORTANT: do NOT overwrite config/settings.yml with the old one.

[/su_spoiler]

Я, хер его знает, почему они пишут гайды так коряво, но сделаю лучше дважды бекап. ЧИТАЙТЕ ТОЛЬКО АНГЛИЙСКИЕ ГАЙДЫ!!   На всякий случай внизу лог обновы: [su_spoiler title="Обнова"]

root@tet-redmine www/redmine# svn update
Skipped '.'

Лень разбираться, почему автоапдейт не пошел, сделал все ручками и дальше по гайду:

root@tet-redmine www/redmine# bundle install --without development test
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Updating git://github.com/jgraichen/transifex-ruby.git
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.........
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Fetching additional metadata from https://rubygems.org/..
Fetching additional metadata from https://rubygems.org/..
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.1.1
Installing i18n 0.6.11
Using multi_json 1.10.1
Installing activesupport 3.2.19
Using builder 3.0.0
Installing activemodel 3.2.19
Using erubis 2.7.0
Using journey 1.0.4
Using rack 1.4.5
Using rack-cache 1.2
Using rack-test 0.6.2
Using hike 1.2.3
Using tilt 1.4.1
Using sprockets 2.2.2
Installing actionpack 3.2.19
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Installing actionmailer 3.2.19
Using arel 3.0.3
Installing tzinfo 0.3.41
Installing activerecord 3.2.19
Installing activeresource 3.2.19
Using awesome_nested_set 2.1.6
Using bundler 1.6.3
Using climate_control 0.0.3
Using cocaine 0.5.4
Using coderay 1.1.0
Using haml 4.0.5
Using htmlentities 4.3.2
Using rack-ssl 1.3.4
Using json 1.8.1
Using rdoc 3.12.2
Using thor 0.19.1
Installing railties 3.2.19
Using jquery-rails 2.0.3
Using kaminari 0.16.1
Using mysql2 0.3.16
Using net-ldap 0.3.1
Using paperclip 3.5.4
Using ruby-openid 2.3.0
Using rack-openid 1.4.2
Using rack-raw-upload 1.1.1
Installing rails 3.2.19
Using redcarpet 2.3.0
Installing sass 3.4.3
Using sass-rails 3.2.6
Using rich 1.4.6
Installing rmagick 2.13.3
Using vcard 0.2.12
Your bundle is complete!
Gems in the groups development and test were not installed.
Use 'bundle show [gemname]' to see where a bundled gem is installed.
Post-install message from rmagick:
Please report any bugs. See https://github.com/gemhome/rmagick/compare/RMagick_2-13-2...master and https://github.com/rmagick/rmagick/issues/18

[/su_spoiler]

И это еще не все, давайте делать токен: [su_spoiler title="rake generate_secret_token"] root@tet-redmine www/redmine# rake generate_secret_token --trace rake aborted! Gem::LoadError: You have already activated rake 10.3.2, but your Gemfile requires rake 10.1.1. Prepending 'bundle exec' to your command may solve this. /var/lib/gems/1.9.1/gems/bundler-1.6.3/lib/bundler/runtime.rb:34:in 'block in setup' /var/lib/gems/1.9.1/gems/bundler-1.6.3/lib/bundler/runtime.rb:19:in 'setup' /var/lib/gems/1.9.1/gems/bundler-1.6.3/lib/bundler.rb:120:in 'setup' /var/lib/gems/1.9.1/gems/bundler-1.6.3/lib/bundler/setup.rb:7:in '<top (required)>' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in 'require' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in 'rescue in require' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in 'require' /var/www/redmine/config/boot.rb:6:in '<top (required)>' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require' /var/www/redmine/config/application.rb:1:in '<top (required)>' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require' /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in 'require' /var/www/redmine/Rakefile:5:in '<top (required)>' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in 'load' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/rake_module.rb:28:in 'load_rakefile' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:687:in 'raw_load_rakefile' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:94:in 'block in load_rakefile' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in 'standard_exception_handling' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:93:in 'load_rakefile' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:77:in 'block in run' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:176:in 'standard_exception_handling' /var/lib/gems/1.9.1/gems/rake-10.3.2/lib/rake/application.rb:75:in 'run' /var/lib/gems/1.9.1/gems/rake-10.3.2/bin/rake:33:in '<top (required)>' /usr/local/bin/rake:23:in 'load' /usr/local/bin/rake:23:in '<main>'

[/su_spoiler]

"Пошел в жопу, ты используешь не те джемы" - как-бы намекает мне руби. Пойду её мучать. /var/www/redmine/Gemfile А что если ручками поправить?  на gem "rake", "~> 10.3.2" Сменил, сохранил файл, запустил снова: rake generate_secret_token:

root@tet-redmine www/redmine# rake generate_secret_token
You have requested:
 rake ~> 10.3.2
The bundle currently has rake locked at 10.1.1.
Try running 'bundle update rake'
Run 'bundle install' to install missing gems.
root@tet-redmine www/redmine# bundle update rake

Ругается на конфликты версий и просит обновить. Обнова прошла успешно! Your bundle is updated! Gems in the groups development and test were not installed. root@tet-redmine www/redmine# rake generate_secret_token YEAH BITCH! Токен сгенерился! var/www/redmine/config/initializers/secret_token.rb Скрестим пальцы! Мигрирую базу:

root@tet-redmine www/redmine# rake db:migrate RAILS_ENV=production

Продолжаю играть с огнем - плагины:

rake redmine:plugins:migrate RAILS_ENV=production
Migrating redmine_ckeditor (Redmine CKEditor plugin)...
Migrating redmine_dashboard (Redmine Dashboard plugin)...
Migrating redmine_digest (Digest plugin)...
Migrating redmine_hours (Redmine Hours Plugin)...
Migrating redmine_issue_checklist (Redmine Issue Checklist plugin)...
Migrating redmine_lightbox (Redmine Light Box plugin)...
Migrating redmine_open_links_in_new_window (Redmine Open Links In New Window plugin)...
Migrating redmine_people (Redmine People plugin)...
Migrating sidebar_hide (Sidebar Hide Plugin)...

Чищу кэш:

rake tmp:cache:clear
rake tmp:sessions:clear

Ну и на последок, если сейчас сервер не сдохнет, то все прошло збс:

root@tet-redmine www/redmine# service apache2 restart
[....] Restarting web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
. ok

Норм: После рестарта оч. долго может тупить вебморда, но после пары рефрешей приходит в норму. Проверка версии:

Environment:
  Redmine version                2.5.2.stable
  Ruby version                   1.9.3-p194 (2012-04-20) [x86_64-linux]
  Rails version                  3.2.19
  Environment                    production
  Database adapter               Mysql2

УРА! Не все так круто, конечно же, потому что при пересоздании папок слетели права и настройки не записываются, но! http://habrahabr.ru/post/225667 Если строка «Каталог ресурсов модулей доступен для записи» стоит с восклицательным знаком, тогда делаем так:

[root@Red www]# mkdir public/plugin_assets
[root@Red www]# chown -R apache:apache public/plugin_assets
[root@Red www]# chmod -R 755 files log tmp public/plugin_assets

Пригодились старые логи консоли:

[su_spoiler title="root@tet-redmine www/redmine# ls -l"]

root@tet-redmine www/redmine# ls -l
total 84
-rwxrwxr-x 1 www-data www-data 248 Jun 20 08:02 CONTRIBUTING.md
-rwxrwxr-x 1 www-data www-data 3615 Jun 22 13:06 Gemfile
-rwxrwxr-x 1 www-data www-data 4317 Jul 3 10:30 Gemfile.lock
-rwxrwxr-x 1 www-data www-data 210 Jun 20 08:02 README.rdoc
-rwxrwxr-x 1 www-data www-data 358 Jun 20 11:35 Rakefile
drwxrwxr-x 7 www-data www-data 4096 Feb 12 2013 app
drwxrwxrwx 5 www-data www-data 4096 Jun 19 16:51 config
-rwxrwxr-x 1 www-data www-data 243 Jun 20 11:35 config.ru
drwxrwxr-x 3 www-data www-data 4096 Oct 15 2013 db
drwxrwxr-x 2 www-data www-data 4096 Feb 12 2013 doc
drwxrwxr-x 5 www-data www-data 4096 Feb 12 2013 extra
drwxrwxr-x 3 www-data www-data 4096 Jun 20 11:53 files
drwxrwxr-x 8 www-data www-data 4096 Feb 12 2013 lib
drwxrwxr-x 2 www-data www-data 4096 Jul 1 12:01 log
drwxrwxr-x 11 www-data www-data 4096 Aug 27 08:20 plugins
drwxrwxr-x 9 www-data www-data 4096 Jun 22 20:02 public
drwxrwxr-x 2 www-data www-data 4096 Feb 12 2013 script
drwxrwxr-x 9 www-data www-data 4096 Jun 20 08:02 test
drwxrwxr-x 8 www-data www-data 4096 Jun 19 16:51 tmp
drwxrwxr-x 2 www-data www-data 4096 Feb 12 2013 vendor

[/su_spoiler]

Для верности лучше заовнить все как было.