簡體   English   中英

耙db:migrate給出錯誤

[英]rake db:migrate gives error

我花了最后一周嘗試設置以下配置:帶有干凈Centos 7安裝程序的VPS。 運行Redmine的Ruby on Rails都讀取了用bacula創建的redmine數據庫的備份。

現在,請注意,我來自圖形設計/ Microsoft /硬件工程背景,目前正在過渡,所以我對我現在的雇主使用的大多數堆棧仍然非常不熟悉,因為我在那工作了僅幾周。

設置VPS和安裝Centos7非常容易,然后我繼續安裝rbenv / httpd / bundler / rmagick /所有gems並還原redmine備份(整個安裝過程中的備份)。

現在,我想運行rake db:migrate命令(僅遵循來自redmine和digital ocean的wiki),並且會發生這種情況:

[user@machinename redmine]$ rake db:migrate
rake aborted!
ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"]
/opt/redmine-3.1.0/lib/plugins/acts_as_activity_provider/init.rb:2:in `block in <top (required)>'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:12:in `eval'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:12:in `block in <top (required)>'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:2:in `each'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:2:in `<top (required)>'
/opt/redmine-3.1.0/config/environment.rb:14:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
[user@machinename redmine]$

如果然后我檢查說00-core_plugins.rb,我似乎找不到問題所在。

# Loads the core plugins located in lib/plugins
Dir.glob(File.join(Rails.root, "lib/plugins/*")).sort.each do |directory|
  if File.directory?(directory)
    lib = File.join(directory, "lib")
    if File.directory?(lib)
      $:.unshift lib
      ActiveSupport::Dependencies.autoload_paths += [lib]
    end
    initializer = File.join(directory, "init.rb")
    if File.file?(initializer)
      config = RedmineApp::Application.config
      eval(File.read(initializer), binding, initializer)
    end
  end
end

如果有人可以提供幫助/了解我在做什么,那將不勝感激。 設置redmine和所有依賴項的獨立安裝程序也很好,因為我實際上只需要能夠將數據庫的備份導入到redmine中。

完整--trace:

[user@machinename redmine]$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
ActiveRecord::AdapterNotSpecified: 'development' database is not configured. Available: ["production"]
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:248:in `resolve_symbol_connection'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:211:in `resolve_connection'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:139:in `resolve'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/connection_specification.rb:169:in `spec'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/connection_handling.rb:50:in `establish_connection'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/railtie.rb:120:in `block (2 levels) in <class:Railtie>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:44:in `each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/lazy_load_hooks.rb:44:in `run_load_hooks'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/base.rb:315:in `<module:ActiveRecord>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activerecord-4.2.3/lib/active_record/base.rb:26:in `<top (required)>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/opt/redmine-3.1.0/lib/plugins/acts_as_activity_provider/init.rb:2:in `block in <top (required)>'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:12:in `eval'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:12:in `block in <top (required)>'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:2:in `each'
/opt/redmine-3.1.0/config/initializers/00-core_plugins.rb:2:in `<top (required)>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `block in load'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:268:in `load'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/engine.rb:652:in `block in load_config_initializer'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/engine.rb:651:in `load_config_initializer'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/engine.rb:615:in `each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/engine.rb:615:in `block in <class:Engine>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `instance_exec'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/initializable.rb:30:in `run'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/initializable.rb:44:in `tsort_each_child'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:415:in `call'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:415:in `each_strongly_connected_component_from'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `call'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/initializable.rb:54:in `run_initializers'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/application.rb:352:in `initialize!'
/opt/redmine-3.1.0/config/environment.rb:14:in `<top (required)>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `block in require'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:240:in `load_dependency'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/activesupport-4.2.3/lib/active_support/dependencies.rb:274:in `require'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/application.rb:328:in `require_environment!'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/railties-4.2.3/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:201:in `block in invoke_prerequisites'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:199:in `each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:199:in `invoke_prerequisites'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:178:in `block in invoke_with_call_chain'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/lib/ruby/gems/2.3.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/bin/rake:22:in `load'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/bin/rake:22:in `<main>'
Tasks: TOP => db:migrate => environment

Database.yml:

# Default setup is given for MySQL with ruby1.9.
# Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end.
# Line indentation must be 2 spaces (no tabs).

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "therightpassword_icheckeditadozentimes"
  encoding: utf8

development:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "therightpassword_icheckeditadozentimes"
  encoding: utf8

# PostgreSQL configuration example
#production:
#  adapter: postgresql
#  database: redmine
#  host: localhost
#  username: postgres
#  password: "postgres"

# SQLite3 configuration example
#production:
#  adapter: sqlite3
#  database: db/redmine.sqlite3

# SQL Server configuration example
#production:
#  adapter: sqlserver
#  database: redmine
#  host: localhost
#  username: jenkins
#  password: jenkins

配置文件

# = Redmine configuration file
#
# Each environment has it's own configuration options.  If you are only
# running in production, only the production block needs to be configured.
# Environment specific configuration options override the default ones.
#
# Note that this file needs to be a valid YAML file.
# DO NOT USE TABS! Use 2 spaces instead of tabs for identation.

# default configuration options for all environments
  default:
  # Outgoing emails configuration
  # See the examples below and the Rails guide for more configuration options:
  # http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      #ssl: true
      address: smtp.gmail.com
      port: "587"
      domain: "site.tld"
      authentication: :plain
      user_name: "ticketing@site.tld"
      password: "god our security is atrocious"

  # ==== Simple SMTP server at localhost
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "localhost"
  #      port: 25
  #
  # ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      address: "example.com"
  #      port: 25
  #      authentication: :login
  #      domain: 'foo.com'
  #      user_name: 'myaccount'
  #      password: 'password'
  #
  # ==== SMTP server at example.com using PLAIN authentication
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  configuration.yml #      address: "example.com"
  #      port: 25
  #      authentication: :plain
  #      domain: 'example.com'
  #      user_name: 'myaccount'
  #      password: 'password'
  #
  # ==== SMTP server at using TLS (GMail)
  # This might require some additional configuration. See the guides at:
  # http://www.redmine.org/projects/redmine/wiki/EmailConfiguration
  #
  #  email_delivery:
  #    delivery_method: :smtp
  #    smtp_settings:
  #      enable_starttls_auto: true
  #      address: "smtp.gmail.com"
  #      port: 587
  #      domain: "smtp.gmail.com" # 'your.domain.com' for GoogleApps
  #      authentication: :plain
  #      user_name: "your_email@gmail.com"
  #      password: "your_password"
  #
  # ==== Sendmail command
  #
  #  email_delivery:
  #    delivery_method: :sendmail

  # Absolute path to the directory where attachments are stored.
  # The default is the 'files' directory in your Redmine instance.
  # Your Redmine instance needs to have write permission on this
  # directory.
  # Examples:
  # attachments_storage_path: /var/redmine/files
  # attachments_storage_path: D:/redmine/files
   attachments_storage_path:

  # Configuration of the autologin cookie.
  # autologin_cookie_name: the name of the cookie (default: autologin)
  # autologin_cookie_path: the cookie path (default: /)
  # autologin_cookie_secure: true sets the cookie secure flag (default: false)
   autologin_cookie_name:
   autologin_cookie_path:
   autologin_cookie_secure:

  # Configuration of SCM executable command.
  #
  # Absolute path (e.g. /usr/local/bin/hg) or command name (e.g. hg.exe, bzr.exe)
  # On Windows + CRuby, *.cmd, *.bat (e.g. hg.cmd, bzr.bat) does not work.
  #
  # On Windows + JRuby 1.6.2, path which contains spaces does not work.
  # For example, "C:\Program Files\TortoiseHg\hg.exe".
  # If you want to this feature, you need to install to the path which does not contains spaces.
  # For example, "C:\TortoiseHg\hg.exe".
  #
  # Examples:
  # scm_subversion_command: svn                                       # (default: svn)
  # scm_mercurial_command:  C:\Program Files\TortoiseHg\hg.exe        # (default: hg)
  # scm_git_command:        /usr/local/bin/git                        # (default: git)
  # scm_cvs_command:        cvs                                       # (default: cvs)
  # scm_bazaar_command:     bzr.exe                                   # (default: bzr)
  # scm_darcs_command:      darcs-1.0.9-i386-linux                    # (default: darcs)
  #
   scm_subversion_command:
   scm_mercurial_command:
   scm_git_command:
   scm_cvs_command:
   scm_bazaar_command:
   scm_darcs_command:

  # SCM paths validation.
  #
  # You can configure a regular expression for each SCM that will be used to
  # validate the path of new repositories (eg. path entered by users with the
  # "Manage repositories" permission and path returned by reposman.rb).
  # The regexp will be wrapped with \A \z, so it must match the whole path.
  # And the regexp is case sensitive.
  #
  # You can match the project identifier by using %project% in the regexp.
  #
  # You can also set a custom hint message for each SCM that will be displayed
  # on the repository form instead of the default one.
  #
  # Examples:
  # scm_subversion_path_regexp: file:///svnpath/[a-z0-9_]+
  # scm_subversion_path_info: SVN URL (eg. file:///svnpath/foo)
  #
  # scm_git_path_regexp: /gitpath/%project%(\.[a-z0-9_])?/
  #
   scm_subversion_path_regexp:
   scm_mercurial_path_regexp:
   scm_git_path_regexp:
   scm_cvs_path_regexp:
   scm_bazaar_path_regexp:
   scm_darcs_path_regexp:
   scm_filesystem_path_regexp:

  # Absolute path to the SCM commands errors (stderr) log file.
  # The default is to log in the 'log' directory of your Redmine instance.
  # Example:
  # scm_stderr_log_file: /var/log/redmine_scm_stderr.log
   scm_stderr_log_file:

  # Key used to encrypt sensitive data in the database (SCM and LDAP passwords).
  # If you don't want to enable data encryption, just leave it blank.
  # WARNING: losing/changing this key will make encrypted data unreadable.
  #
  # If you want to encrypt existing passwords in your database:
  # * set the cipher key here in your configuration file
  # * encrypt data using 'rake db:encrypt RAILS_ENV=production'
  #
  # If you have encrypted data and want to change this key, you have to:
  # * decrypt data using 'rake db:decrypt RAILS_ENV=production' first
  # * change the cipher key here in your configuration file
  # * encrypt data using 'rake db:encrypt RAILS_ENV=production'
   database_cipher_key:

  # Set this to false to disable plugins' assets mirroring on startup.
  # You can use `rake redmine:plugins:assets` to manually mirror assets
  # to public/plugin_assets when you install/upgrade a Redmine plugin.
  #
  #mirror_plugins_assets_on_startup: false

  # Your secret key for verifying cookie session data integrity. If you
  # change this key, all old sessions will become invalid! Make sure the
  # secret is at least 30 characters and all random, no regular words or
  # you'll be exposed to dictionary attacks.
  #
  # If you have a load-balancing Redmine cluster, you have to use the
  # same secret token on each machine.
  #secret_token: 'change it to a long random string'
   secret_token: 'rake output I generated before and copy-pasta'ed'

  # Requires users to re-enter their password for sensitive actions (editing
  # of account data, project memberships, application settings, user, group,
  # role, auth source management and project deletion). Disabled by default.
  # Timeout is set in minutes.
  #
  #sudo_mode: true
  #sudo_mode_timeout: 15

  # Absolute path (e.g. /usr/bin/convert, c:/im/convert.exe) to
  # the ImageMagick's `convert` binary. Used to generate attachment thumbnails.
  #imagemagick_convert_command:

  # Configuration of RMagcik font.
  #
  # Redmine uses RMagcik in order to export gantt png.
  # You don't need this setting if you don't install RMagcik.
  #
  # In CJK (Chinese, Japanese and Korean),
  # in order to show CJK characters correctly,
   pt/redmine-3.1.0/log/"
  # you need to set this configuration.
  #
  # Because there is no standard font across platforms in CJK,
  # you need to set a font installed in your server.
  #
  # This setting is not necessary in non CJK.
  #
  # Examples for Japanese:
  #   Windows:
  #     rmagick_font_path: C:\windows\fonts\msgothic.ttc
  #   Linux:
  #     rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf
  #
   rmagick_font_path:

  # Maximum number of simultaneous AJAX uploads
  #max_concurrent_ajax_uploads: 2
  "/opt/redmine-3.1.0/log/"
  # Configure OpenIdAuthentication.store
  #
  # allowed values: :memory, :file, :memcache
  #openid_authentication_store: :memory

# specific configuration options for production environment
# that overrides the default ones
  production:

# specific configuration options for development environment
# that overrides the default ones
  development:"/opt/redmine-3.1.0/log/"

感謝Deepak的建議,我在database.yml中添加了一個“開發”部分,但是現在出現了此錯誤:

[user@machinename redmine]$ rake db:migrate
rake aborted!
Psych::SyntaxError: (<unknown>): could not find expected ':' while scanning a simple key at line 52 column 3
/opt/redmine-3.1.0/lib/redmine/configuration.rb:86:in `load_from_yaml'
/opt/redmine-3.1.0/lib/redmine/configuration.rb:42:in `load'
/opt/redmine-3.1.0/lib/redmine/configuration.rb:67:in `[]'
/opt/redmine-3.1.0/lib/redmine/thumbnail.rb:24:in `<module:Thumbnail>'
/opt/redmine-3.1.0/lib/redmine/thumbnail.rb:21:in `<module:Redmine>'
/opt/redmine-3.1.0/lib/redmine/thumbnail.rb:20:in `<top (required)>'
/opt/redmine-3.1.0/lib/redmine.rb:47:in `<top (required)>'
/opt/redmine-3.1.0/config/initializers/30-redmine.rb:6:in `<top (required)>'
/opt/redmine-3.1.0/config/environment.rb:14:in `<top (required)>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

@lightalloy的建議的輸出:

[user@machinename redmine]$ bundle exec rake db:migrate RAILS_ENV=production
rake aborted!
Psych::SyntaxError: (<unknown>): could not find expected ':' while scanning a simple key at line 52 column 3
/opt/redmine-3.1.0/lib/redmine/configuration.rb:86:in `load_from_yaml'
/opt/redmine-3.1.0/lib/redmine/configuration.rb:42:in `load'
/opt/redmine-3.1.0/lib/redmine/configuration.rb:67:in `[]'
/opt/redmine-3.1.0/lib/redmine/thumbnail.rb:24:in `<module:Thumbnail>'
/opt/redmine-3.1.0/lib/redmine/thumbnail.rb:21:in `<module:Redmine>'
/opt/redmine-3.1.0/lib/redmine/thumbnail.rb:20:in `<top (required)>'
/opt/redmine-3.1.0/lib/redmine.rb:47:in `<top (required)>'
/opt/redmine-3.1.0/config/initializers/30-redmine.rb:6:in `<top (required)>'
/opt/redmine-3.1.0/config/environment.rb:14:in `<top (required)>'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/bin/bundle:22:in `load'
/home/XX_USERNAME_XX/.rbenv/versions/2.3.4/bin/bundle:22:in `<main>'
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)

確保在config/database.yml具有開發環境的config/database.yml

如果沒有,請在config/database.yml添加以下條目

# MYSQL

development:
  adapter: mysql2
  database: development_db
  host: localhost
  username: username
  password: password
  encoding: utf8

# # SQLite

# development:
#   adapter: sqlite3
#   database: db/development.sqlite3
#   pool: 5
#   timeout: 5000

# # Postgres

# development:
#   adapter: postgresql
#   encoding: unicode
#   database: development_db
#   pool: 5
#   username: username
#   password: password

我假設您需要通過database.yml設置生產環境,因此在運行rake db:migrate時需要指定它:

bundle exec rake db:migrate RAILS_ENV=production

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM