似乎无法让Bundler在使用Capistrano部署的Rails App服务器上正常运行

时间:2021-07-06 11:48:25

I've been using Rails for a couple of months now and made a small app that I'm trying to deploy with Capistrano. The problem is that when I run

我已经使用Rails几个月了,并制作了一个小型应用程序,我正在尝试与Capistrano一起部署。问题是我跑的时候

$ cap production deploy

the deployment appears to run correctly except for the following 3 errors:

部署似乎正常运行,但以下3个错误除外:

DEBUG [764d7f01] Running /usr/bin/env [ -L /var/www/rally_app/releases/20150513103829/public/assets ] as deploy@255.255.255.255
DEBUG [764d7f01] Command: [ -L /var/www/rally_app/releases/20150513103829/public/assets ]
DEBUG [764d7f01] Finished in 3.347 seconds with exit status 1 (failed).

DEBUG [929898d3] Running /usr/bin/env [ -d /var/www/rally_app/releases/20150513103829/public/assets ] as deploy@255.255.255.255
DEBUG [929898d3] Command: [ -d /var/www/rally_app/releases/20150513103829/public/assets ]
DEBUG [929898d3] Finished in 4.065 seconds with exit status 1 (failed).


DEBUG [8917ed02] Running /usr/bin/env ls /var/www/rally_app/releases/20150513103829/public/assets/.sprockets-manifest* as deploy@255.255.255.255
DEBUG [8917ed02] Command: cd /var/www/rally_app/releases/20150513103829 && ( RBENV_ROOT=~/.rbenv RBENV_VERSION=2.2.1 /usr/bin/env ls /var/www/rally_app/releases/20150513103829/public/assets/.sprockets-manifest* )
DEBUG [8917ed02]        ls: cannot access /var/www/rally_app/releases/20150513103829/public/assets/.sprockets-manifest*: No such file or directory
DEBUG [8917ed02] Finished in 3.716 seconds with exit status 2 (failed).

Also, it appears Bundler doesn't run properly, because even though the App is supposed to use PostgreSQL in production, Passenger gives an error about sqlite3 stating:

此外,似乎Bundler无法正常运行,因为即使App应该在生产中使用PostgreSQL,Passenger也会提供有关sqlite3的错误说明:

Specified 'sqlite3' for database adapter, but the gem is not loaded. Add `gem 'sqlite3'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)
  /var/www/rally_app/shared/bundle/ruby/2.2.0/gems/activerecord

I've changed the RailsEnv to development only temporarily to view these logs. If it will help to post more information from the Phusion Passenger logs, I am happy to post. Please let me know.

我暂时将RailsEnv更改为开发以查看这些日志。如果它有助于从Phusion Passenger日志发布更多信息,我很乐意发布。请告诉我。

I'm Linux server admin savvy but I'm a complete Rails/Passenger/rbenv/Capistrano noob, so please consider this in your replies. :)

我是Linux服务器管理员精明但我是一个完整的Rails / Passenger / rbenv / Capistrano noob,所以请在你的回复中考虑这一点。 :)

Thanks in advance for any help.

在此先感谢您的帮助。

Alexis

1 个解决方案

#1


I got past this problem by looking over my deploy.rb and uncommenting

我通过查看我的deploy.rb并取消注释来解决这个问题

set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')

set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')

I think absence of the second line is was what caused the errors. I also manually created the above two yaml files on my server.

我认为没有第二行是造成错误的原因。我还在我的服务器上手动创建了上面两个yaml文件。

I'm now getting an error from rails about PostgreSQL, but that's progress as it's a higher level issue, so my question above is solved. Thanks for pointers @wpp.

我现在从关于PostgreSQL的rails得到一个错误,但这是一个进步,因为它是一个更高级别的问题,所以我的问题已经解决了。感谢指点@wpp。

#1


I got past this problem by looking over my deploy.rb and uncommenting

我通过查看我的deploy.rb并取消注释来解决这个问题

set :linked_files, fetch(:linked_files, []).push('config/database.yml', 'config/secrets.yml')

set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system')

I think absence of the second line is was what caused the errors. I also manually created the above two yaml files on my server.

我认为没有第二行是造成错误的原因。我还在我的服务器上手动创建了上面两个yaml文件。

I'm now getting an error from rails about PostgreSQL, but that's progress as it's a higher level issue, so my question above is solved. Thanks for pointers @wpp.

我现在从关于PostgreSQL的rails得到一个错误,但这是一个进步,因为它是一个更高级别的问题,所以我的问题已经解决了。感谢指点@wpp。