내 앱이 dev에서 작동하며 새로운 슬라이스에 배포하려고합니다. 환경을 '베타'라고합니다. 레이크가 카피 스트라 노 (capistrano) 또는 수동으로 불려지 든 빈 데이터베이스 이름을 전달하려고 시도하는 것을 제외하고는 모든 것이 정상적으로 작동하는 것 같습니다. 다음에 무엇을해야할지 모르겠으므로 어떤 도움을 주셔서 감사합니다. 인터넷 검색은 아무 것도 발견하지 못했습니다. 레일즈 3 - 베타 환경에서 빈 데이터베이스 이름을 생성/마이그레이션하려고 시도합니다.
내가 아무 소용이 내 database.yml을하고 beta.rb 파일을 마사지 같은 명백한 것들을 시도 레일[email protected]:~/sites/darkserve/current$ rake db:drop
(in /home/ops/sites/darkserve/releases/20110218183444)
Couldn't drop : #<ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect database name '': DROP DATABASE IF EXISTS ``>
[email protected]:~/sites/darkserve/current$ rake db:create
(in /home/ops/sites/darkserve/releases/20110218183444)
already exists
* executing "cd /home/ops/sites/darkserve/releases/20110218183444; bundle exec rake RAILS_ENV=beta db:migrate"
servers: ["173.203.106.112"]
[173.203.106.112:30000] executing command
*** [err :: 173.203.106.112:30000] rake aborted!
*** [err :: 173.203.106.112:30000]
*** [err :: 173.203.106.112:30000] Mysql2::Error: No database selected: SHOW TABLES
*** [err :: 173.203.106.112:30000]
*** [err :: 173.203.106.112:30000]
*** [err :: 173.203.106.112:30000] (See full trace by running task with --trace)
*** [err :: 173.203.106.112:30000]
** [out :: 173.203.106.112:30000] (in /home/ops/sites/darkserve/releases/20110218183444)
에 토끼를 주셔서 감사합니다. MySQL은 제대로 작동하고 올바른 사용자가 생성됩니다.
common: &mysql
adapter: mysql2
host: localhost
encoding: utf8
username: root
password:
pool: 5
timeout: 5000
reconnect: true
development:
<<: *mysql
database: darkserve_development
test:
<<: *mysql
database: darkserve_test
beta:
<<: *mysql
database: darkserve_beta
production:
<<: *mysql
database: darkserve_prod
[email protected]:~/sites/darkserve/current$ mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 57
Server version: 5.1.41-3ubuntu12.9 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
mysql>
#beta.rb
Darkserve::Application.configure do
# Settings specified here will take precedence over those in config/environment.rb
# The production environment is meant for finished, "live" apps.
# Code is not reloaded between requests
config.cache_classes = true
# Full error reports are disabled and caching is turned on
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
# Specifies the header that your server uses for sending files
config.action_dispatch.x_sendfile_header = "X-Sendfile"
# For nginx:
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
# If you have no front-end server that supports something like X-Sendfile,
# just comment this out and Rails will serve the files
# See everything in the log (default is :info)
# config.log_level = :debug
# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
# Use a different cache store in production
#config.cache_store = :mem_cache_store
# Disable Rails's static asset server
# In production, Apache or nginx will already do this
config.serve_static_assets = false
# Enable serving of images, stylesheets, and javascripts from an asset server
# config.action_controller.asset_host = "http://assets.example.com"
# Disable delivery errors, bad email addresses will be ignored
# config.action_mailer.raise_delivery_errors = false
config.action_mailer.delivery_method = :smtp
# Enable threaded mode
# config.threadsafe!
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
# the I18n.default_locale when a translation can not be found)
config.i18n.fallbacks = true
# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify
end
[email protected]:~/sites/darkserve/current$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-linux]
[email protected]:~/sites/darkserve/current$ rails -v
Rails 3.0.4
[email protected]:~/sites/darkserve/current$ irb
ruby-1.9.2-p136 :001 > require 'mysql'
=> true
어떻게 환경을 설정하고 있습니까? –
$ 고양이 ~/.bash_profile에 수출 RAILS_ENV = 베타 – pendevere
로드 베타 환경 (레일 3.0.4) 루비 1.9.2-P136 : 001> Rails.env => database.yml을 파일에서 "베타" – pendevere