【问题标题】:Deploying Chiliproject to Dreamhost将 Chiliproject 部署到 Dreamhost
【发布时间】:2011-08-04 23:43:39
【问题描述】:

在部署它时遇到一些问题。我现在尝试部署它两次。这是我到目前为止所做的......

install page上安装了所需的gem和版本:

gem install -v=2.3.5 rails
gem install -v=1.0.1 rack
gem install -v=0.8.7 rake
gem install -v=0.4.2 i18n

下载包:

git clone git://github.com/chiliproject/chiliproject.git
cd chiliproject
git checkout stable

必须找到并设置捆绑包,因为它不在我的路径中:

BUNDLE="/usr/lib/ruby/gems/1.8/bin/bundle"

将我的数据库信息放入database.yml:

然后开始捆绑的东西:

$BUNDLE install --without=postgres rmagick
$BUNDLE exec rake generate_session_store

最后一条命令报错:

rake aborted!
can't activate rails (= 2.3.5, runtime), already activated rails-2.3.12. Make sure all dependencies are added to Gemfile.

所以我在 Gemfile 中将 2.3.12 更改为 2.3.5 并继续:

RAIL_ENV=production $BUNDLE exec rake db:migrate

然后我也收到了这个命令的错误:

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
undefined method `autoload_paths' for #<Rails::Configuration:0x68a68dbb82c0>
/home/USERNAME/DOMAIN/public/config/environment.rb:44

我尝试在那里注释掉第 44 行,但随后它又抛出了 undefined methodconvert_to_without_fallback_on_iso_8859_1' 类 Class' 的另一个错误,所以我不想再玩它了。 注意这只发生在我第二次尝试部署它时。我第一次尝试 db:migrate 成功(我检查了数据库中没有数据)。

*所以第二次尝试我被困在这里:-( *

但这是 db:migrate 成功后第一次发生的事情......

RAILS_ENV=production $BUNDLE exec rake redmine:load_default_data

但是,使用最后一个命令它失败了,它说权限被拒绝 mysql 'user'@'173.236.128.0/255.255.128.0' 我就像 WTF 它试图连接到网络,就好像它是一个主机一样?

所以我继续前进,复制了我的配置文件和环境文件。更改/添加了这些行:

# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
 ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.5'# unless defined? RAILS_GEM_VERSION

if ENV['RAILS_ENV'] == 'production'  # don't bother on dev
  ENV['GEM_PATH'] = '/home/USERNAME/.gems' + ':/usr/lib/ruby/gems/1.8'
end

然后使这些东西可写并重新启动Passenger:

chmod -R 777 files log tmp public/plugin_assets/
touch tmp/restart.txt

对不起,文字墙,有人能指出我做错了什么吗?

提前致谢。

编辑:所以这都是错误的,这就是我的工作方式

rm ~/.gem*
gem install bundler

PATH=$PATH:/usr/lib/ruby/gems/1.8/bin

cd ~
git clone git://github.com/chiliproject/chiliproject.git
cd chiliproject
git checkout stable

cp * ../example.com/ -R
cd ../example.com

# Make sure database is working

bundle install --without postgres rmagick test
bundle exec rake generate_session_store

RAILS_ENV=production bundle exec rake db:migrate

# No output is no good, check database.yml

RAILS_ENV=production bundle exec rake redmine:load_default_data

或者看到这个:https://gist.github.com/1127306

【问题讨论】:

    标签: ruby-on-rails ruby dreamhost chiliproject


    【解决方案1】:

    当前的 ChiliProject 稳定版本 (2.x) 需要使用 bundler。因此,Slotos 的答案在这里是不正确的。 gen install 不再起作用了,我们需要 bundler。

    另外,我们现在需要 Rails 2.3.12。如果您随意编辑文件,您将不会得到任何工作结果。在某些平台上,您需要调整 Gemfile(例如,当使用 Ruby 1.8.6 或某些版本的 ImageMagick 时)。对于当前建议的使用 Ruby 1.8.7 或 REE 的设置,您无需调整任何内容。

    为了安装当前稳定的ChiliProject 2.x版本的依赖,你基本上需要做到以下几点:

    首先,您需要确保重新安装 gem 二进制文件的目录在您的 $PATH 中。这可以通过运行这个(在你的情况下)暂时实现

    export PATH=/usr/lib/ruby/gems/1.8/bin:$PATH
    

    然后你需要安装 bundler gem 并指示它安装所有依赖项

    gem install bundler
    bundle install --without rmagick postgres test # in your case
    

    在您的情况下,真正奇怪的是 rake 似乎试图启用 Rails 2.3.5。它不应该这样做(除非您更改了某些文件,否则不会这样做)。我强烈建议从一个新的干净的源代码树开始,不要更改任何任意文件。

    【讨论】:

    • 谢谢。我遇到了一个乘客错误,说它找不到宝石,但没有说是哪一个。我运行了你说的命令,它开始工作了!这是我使用的使其工作的命令列表gist.github.com/1127306 再次感谢:)
    【解决方案2】:

    不要将gem install 命令与捆绑程序包管理混为一谈。这样做你会得到意想不到的结果。

    如果你真的想使用 bundler - 将你想要的所有 gem 添加到 Gemfile 中。 否则就省略它。

    快速搜索“bundle chiliproject”将我带到chiliproject-gemfile。显然它已经被合并到了unstable中。

    【讨论】:

    • 谢谢谢谢,我放弃了 gem install 并开始只使用 bundler ......乘客说它找不到 gem tho......这样做 -- 没有测试似乎也能工作。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-16
    • 1970-01-01
    • 2012-01-02
    • 2011-06-08
    • 1970-01-01
    • 1970-01-01
    • 2014-10-26
    相关资源
    最近更新 更多