0

I am testing uberspace.de with uberspacify, a capistrano receipes collection. Before I started with uberspacify I configured the server as described in the documentation provided by uberspace. My RubyOnRails app just launched nicely. Now that I deployed via uberspacify, the following error is written in /var/www/virtual/john/logs/error_log:

[error] (111)Connection refused: proxy: HTTP: attempt to connect to 127.0.0.1:44477 (*) failed

Note that the port 44477 is a different each time I deploy.
The website itself states:

503 Service Temporarily Unavailable
The server is temporarily unable to service your request due to 
maintenance downtime or capacity problems. Please try again later.
Apache/2.2.15 (CentOS) Server at foobar.phoenix.uberspace.de Port 443

Here is the Capfile I prepared:

# Capfile
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks

Here is the configuration in deploy.rb:

# config/deploy.rb

# include uberspacify base recipes
require "uberspacify/base"

# comment this if you don"t use MySQL
require "uberspacify/mysql"

# the Uberspace server you are on
server "phoenix.uberspace.de", :web, :app, :db, :primary => true

# your Uberspace username
set :user, "john"

# a name for your app, [a-z0-9] should be safe, will be used for your gemset,
# databases, directories, etc.
set :application, "foobar"

# the repo where your code is hosted
set :scm, :git
set :repository, "git@bitbucket.org:obama/#{application}.git"
set :branch, "master"

# optional stuff from here

# By default, your app will be available in the root of your Uberspace. If you
# have your own domain set up, you can configure it here
# set :domain, "www.dummyapp.com"

# By default, uberspacify will generate a random port number for Passenger to
# listen on. This is fine, since only Apache will use it. Your app will always
# be available on port 80 and 443 from the outside. However, if you"d like to
# set this yourself, go ahead.
# set :passenger_port, 55555

# By default, Ruby Enterprise Edition 1.8.7 is used for Uberspace. If you
# prefer Ruby 1.9 or any other version, please refer to the RVM documentation
# at https://rvm.io/integration/capistrano/ and set this variable.
set :rvm_ruby_string, "1.9.3@#{application}"

I ran the following commands:

$ bundle exec cap deploy:setup
$ bundle exec cap deploy:migrations

I wonder if uberspacify takes care of all the configuration. The uberspace tutorial for RubyOnRails works with fcgi and an .htaccess with rewrite rules. Also they do not use rvm.

Here is the Gemfile of the application:

source 'https://rubygems.org'

ruby '1.9.3'
gem 'rails', '~> 3.2.13'
gem 'counter_culture', git: 'https://github.com/dorilla/counter_culture'
gem 'jquery-rails', '~> 3.0.2'
gem 'therubyracer', '~> 0.11.4', require: 'v8'
gem 'attribute_normalizer', '~> 1.1.0'
gem 'pry', '~> 0.9.12.2'

# Parsing ShapeFiles
gem 'rgeo', '~> 0.3.20'
gem 'rgeo-shapefile', '~> 0.2.3'
gem 'georuby', '~> 2.0.0'
gem 'dbf', '~> 2.0.6'
gem 'gdal', '~> 0.0.5'

gem 'capistrano', '~> 2.15.5'
gem 'uberspacify', '~> 0.9.3'
gem 'mysql2', '~> 0.3.13'

group :assets do
  gem 'sass-rails', '~> 3.2.5'
  gem 'coffee-rails', '~> 3.2.2'
  gem 'uglifier', '~> 2.1.1'
end

group :development do
  gem 'debugger', '~> 1.6.0'
end

group :development, :test do
  gem 'sqlite3', '~> 1.3.7'
  gem 'rspec-rails', '~> 2.14.0'
  gem 'rspec-smart-formatter', '~> 0.0.4', require: false
  gem 'factory_girl_rails', '4.2.1'
  gem 'factory_girl_extensions', '2.1.0'
end

group :production do
  gem 'mysql2', '~> 0.3.13'
end

Of interest might be that I needed to install the gdal library via the toast package manager, via: $ toast arm gdal before I could successfully install $ gem install gdal. This gem is needed for parsing ShapeFiles.


I noticed that there is no ~/.passenger directory after deploy:setup and deploy:migrations successfully processsed.

4

2 回答 2

1

在@patheticpat 的大力帮助下问题解决了!!!

以下是有助于分析服务器上的问题的步骤。

  • 要检查网络服务器是否正在运行,请运行$ curl http://localhost:{PORT}。该端口可以在~/html/.htaccess或 中找到~/service/rails-{yourapp}/run
  • 要手动启动服务器,请执行$ ~/service/rails-{yourapp}/run并注意错误。
  • 当前的部署可以在/var/www/virtual/$USER/rails/{yourapp}/current.
  • 启动乘客手动运行$ bundle exec passenger start -p $PORT -e production
  • 启动乘客即服务运行$ svc -u ~/service/rails-{yourapp}
  • 停止乘客服务运行$ svc -d ~/service/rails-{yourapp}

在这个反复试验的过程中,我们发现存在PATH问题,我们注意到可以在此处~/service/rails-{yourapp}/run看到的来源。值得一提的是,我将zshoh-my-zshcustom dotfiles结合使用。我们注意到我已经在. 该文件已经包含一个源命令$HOME/.bash_profile~/.zshrc

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

我们发现这实际上阻碍了rvm将相同的语句放入此处~/.bash_profile,因为它已在此处记录

总结一下:如果您从自定义点文件中删除rvm配置,uberspacify 将完美地设置和启动网络服务器。


@uberspacify:我建议您重写rvm脚本以注意此处提到的警告并做出适当的反应。

于 2013-08-02T10:33:04.437 回答
1

我是 Uberspacify 的作者。使用您的 Rails 应用程序的乘客似乎尚未启动(尚未)。这就是为什么 Apache 在端口 44477 上报告“连接被拒绝”的原因——这是 uberspacify 随机选择的用于Passenger 和 Apache 之间的内部通信的端口。

要对此进行调试,您可能需要查看/var/www/virtual/< your username>/rails/<your app>/shared/log.

此外,请务必根据 Uberspace 的说明“撤消”您所做的任何配置更改。他们的说明仅用于 FCGI 部署,与 Uberspacify 无关(并且很可能不兼容)。使用 Uberspacify 的唯一先决条件是常规 Rails 应用程序和 Uberspace 帐户。

于 2013-07-31T11:06:01.450 回答