Error when migrating to new server..

Added by Jackson Jiang over 1 year ago

Hello, I see some issues after migrate the redmine to a new server. I restored the mysql database, and copied over the files folder. following some instructions, I also did this to update the database

sudo bundle exec rake db:migrate RAILS_ENV=production

everything looks fine except whenever i tries to access account page or administration settings page it would throw out Internal errors.. any idea why it is like that?
Thanks. I have attached the logs below.

  Redmine version                3.3.1.stable
  Ruby version                   2.3.3-p222 (2016-11-21) [aarch64-linux-gnu]
  Rails version        
  Environment                    production
  Database adapter               Mysql2
  Git                            2.11.0
Redmine plugins:
  no plugin installed

Error Log when accessing "Account":

Processing by MyController#account as HTML
  Current user: admin (id=1)
  Rendered my/account.html.erb within layouts/base (28.0ms)
Completed 500 Internal Server Error in 70ms (ActiveRecord: 14.3ms)

ActionView::Template::Error (Permission denied @ dir_s_mkdir - /usr/share/redmine/instances/default/tmp/cache/D39):
    22:   <p><%= f.text_field :lastname, :required => true %></p>
    23:   <p><%= f.text_field :mail, :required => true %></p>
    24:   <% unless @user.force_default_language? %>
    25:   <p><%= :language, lang_options_for_select %></p>
    26:   <% end %>
    27:   <% if Setting.openid? %>
    28:   <p><%= f.text_field :identity_url  %></p>
  lib/redmine/i18n.rb:113:in `languages_options'
  app/helpers/application_helper.rb:1042:in `lang_options_for_select'
  app/views/my/account.html.erb:25:in `block in _app_views_my_account_html_erb__617676139844867108_184271351180'
  app/helpers/application_helper.rb:1052:in `labelled_form_for'
  app/views/my/account.html.erb:14:in `_app_views_my_account_html_erb__617676139844867108_184271351180'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Error when accessing "Settings" from Administration

Started GET "/redmine/settings" for at 2019-04-28 12:33:16 -0500
Processing by SettingsController#index as HTML
  Current user: admin (id=1)
  Rendered settings/_general.html.erb (7.5ms)
  Rendered settings/_display.html.erb (8.0ms)
  Rendered common/_tabs.html.erb (21.5ms)
  Rendered settings/edit.html.erb within layouts/admin (22.2ms)
Completed 500 Internal Server Error in 38ms (ActiveRecord: 5.3ms)

ActionView::Template::Error (Permission denied @ dir_s_mkdir - /usr/share/redmine/instances/default/tmp/cache/D39):
    3: <div class="box tabular settings">
    4: <p><%= setting_select :ui_theme, Redmine::Themes.themes.collect {|t| [,]}, :blank => :label_default, :label => :label_theme %></p>
    6: <p><%= setting_select :default_language, lang_options_for_select(false) %></p>
    8: <p><%= setting_check_box :force_default_language_for_anonymous %></p>
  lib/redmine/i18n.rb:113:in `languages_options'
  app/helpers/application_helper.rb:1042:in `lang_options_for_select'
  app/views/settings/_display.html.erb:6:in `block in _app_views_settings__display_html_erb__924942471545137570_273712183540'
  app/views/settings/_display.html.erb:1:in `_app_views_settings__display_html_erb__924942471545137570_273712183540'
  app/views/common/_tabs.html.erb:17:in `block in _app_views_common__tabs_html_erb___2279556909341009028_273714396060'
  app/views/common/_tabs.html.erb:16:in `each'
  app/views/common/_tabs.html.erb:16:in `_app_views_common__tabs_html_erb___2279556909341009028_273714396060'
  app/helpers/application_helper.rb:326:in `render_tabs'
  app/views/settings/edit.html.erb:3:in `_app_views_settings_edit_html_erb___1404745002033751752_273714536160'
  app/controllers/settings_controller.rb:30:in `index'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Replies (1)

RE: Error when migrating to new server.. - Added by Jackson Jiang over 1 year ago

i figured it out, these three directories below are owned by root, not the www-data.. so the apache server can't access them..
i chown to www-data now the problem is gone.. do they all need to be owned by www-data?

dietpi@RockPro64:/usr/share/redmine/instances$ ls -la default/
total 16
drwxr-xr-x 4 root root 4096 Apr 28 11:32 .
drwxr-xr-x 3 root root 4096 Apr 28 11:32 ..
lrwxrwxrwx 1 root root 20 Apr 28 11:32 config -> /etc/redmine/default
drwxr-xr-x 3 www-data www-data 4096 Apr 28 12:08 files
lrwxrwxrwx 1 root root 24 Apr 28 11:32 log -> /var/log/redmine/default
drwxr-xr-x 2 root root 4096 Apr 28 11:32 public
lrwxrwxrwx 1 root root 30 Apr 28 11:32 tmp -> /var/cache/redmine/default/tmp