繁体   English   中英

Rails / Uberspacify:503服务暂时不可用

[英]Rails/Uberspacify: 503 Service Temporarily Unavailable

我正在用uberspacify测试uberspace.de是一个capistrano receipes系列。 在我开始使用uberspacify之前,我按照uberspace 提供文档中的描述配置了服务器。 我的RubyOnRails应用程序刚刚推出。 现在我通过uberspacify部署了以下错误写在/var/www/virtual/john/logs/error_log

[错误](111)连接被拒绝:代理:HTTP:尝试连接到127.0.0.1:44477(*)失败

请注意,每次部署时端口44477都不同。
该网站本身说明:

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

这是我准备的Capfile

# 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

以下是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}"

我运行了以下命令:

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

我想知道uberspacify是否会处理所有配置。 RubyOnRails的uberspace教程fcgi和带有重写规则的.htaccess一起使用。 他们也不使用rvm

这是应用程序的Gemfile

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

有趣的是我需要通过toast包管理器安装gdal库,通过: $ toast arm gdal才能成功安装$ gem install gdal 解析ShapeFiles需要此gem。


我注意到deploy:setup后没有~/.passenger目录deploy:setup and deploy:migrations成功处理deploy:migrations

我是Uberspacify的作者。 似乎带有您的Rails应用程序的Passenger尚未启动(尚未)。 这就是Apache在端口44477上报告“Connection refused”的原因 - 这是uberspacify随机选择的端口,用于Passenger和Apache之间的内部通信。

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

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

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

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

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

在试错的过程,我们发现,有PATH的问题,我们注意到了~/service/rails-{yourapp}/run$HOME/.bash_profile可以看出这里 要提一下,我将zshoh-my-zsh自定义dotfiles结合使用。 我们注意到我已经在~/.zshrc .zshrc中配置了rvm 该文件已包含源命令

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

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

总结一下:如果从自定义dotfiles中删除rvm配置,uberspacify将完美地设置并启动Web服务器。


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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM