我不确定行为模式是什么,但有些程序 - 特别是基于rack.ru的简单运行程序 - 无法轻松调试.当断点被触发时,没有可用的源
注意这与其他SO [问题] [1]不同
[1]:在ruby中,为什么我的IRB交互式调试会话总是说"没有可用的源文件" session-always-say-no-sourcefile
我目前正在使用Apache代理瘦(使用这篇文章)
我的静态资产都不起作用(例如样式表,javascripts).就是Apache应该是为他们服务或做我必须启用config.serve_static_assets的config/environments/production.rb?如果Apache应该为他们服务,那么我可能做错了什么?
这是我的Apache配置:
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
DocumentRoot /home/r/public_html/example/public
RewriteEngine On
<Proxy balancer://thinservers>
BalancerMember http://127.0.0.1:5000
BalancerMember http://127.0.0.1:5001
BalancerMember http://127.0.0.1:5002
</Proxy>
# Redirect all non-static requests to thin
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://thinservers%{REQUEST_URI} [P,QSA,L]
ProxyPass / balancer://thinservers/
ProxyPassReverse / balancer://thinservers/
ProxyPreserveHost on
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
# Custom log file locations
ErrorLog /home/r/public_html/example/log/error.log
CustomLog /home/r/public_html/example/log/access.log combined
</VirtualHost>
Run Code Online (Sandbox Code Playgroud) 我在使用Thin和Sinatra设置我的应用程序时遇到了问题.我创建了一个包含以下设置的development-config.ru文件:
# This is a rack configuration file to fire up the Sinatra application.
# This allows better control and configuration as we are using the modular
# approach here for controlling our application.
#
# Extend the Ruby load path with the root of the API and the lib folder
# so that we can automatically include all our own custom classes. This makes
# the requiring of files a bit cleaner and easier to maintain.
# This is …Run Code Online (Sandbox Code Playgroud) 我创建了一个使用瘦服务器启动它的rails应用程序.
我已经在ubuntu虚拟机上部署了该机器.
我通过ssh登录到该机器并通过启动服务器
瘦启动-R config.ru&
所以我有它应该在后台运行.
到目前为止,我能够从远程机器正确访问我的rails应用程序.
当我从远程机器的ssh终端注销时.
我的申请停止响应.
还有其他方法可以在远程机器的后台启动应用程序.
我使用capistrano(rails 4,ruby 2.1.2,thin 1.6.2,capistrano 2.1.5)将一个rails应用程序部署到nginx,瘦.我通过瘦启动命令开始瘦身.并在此文件thin.log上查看一些错误.谁能告诉我如何解决这个问题?
非常感谢你!
thin.yml
pid: /home/deploy/myapp/pids/thin.pid
port: 3000
timeout: 30
wait: 30
log: log/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
threaded: true
no-epoll: true
daemonize: true
socket: /home/deploy/myapp/sockets/thin.sock
chdir: /home/deploy/myapp/current
address: 0.0.0.0
Run Code Online (Sandbox Code Playgroud)
在/ etc/nginx的/网站-availabel /默认
upstream myapp{
server 127.0.0.1:3000;
server 127.0.0.1:3001;
server 127.0.0.1:3002;
}
server {
listen 80;
server_name _;
character utf-8;
access_log /home/deploy/myapp/log/access.log;
error_log /home/deploy/myapp/log/error.log;
root /home/deploy/myapp/current/public;
location / {
proxy_pass http://127.0.0.1:3000;
}
}
Run Code Online (Sandbox Code Playgroud)
thin.log
Writing PID to /home/deploy/myapp/pids/thin.pid
Using rack adapter
Thin web …Run Code Online (Sandbox Code Playgroud) 我在Heroku上运行了Rails应用程序.问题:我的应用程序在没有人暂时没有使用时关闭,但是一旦用户进入 - 服务器就启动了.我如何让它永远有效?
Rails,瘦Web服务器.
我的Procfile:
web: bundle exec rails server thin-p $ PORT
Run Code Online (Sandbox Code Playgroud) Thin的代码/文档表明默认连接超时为30秒.但是,当我尝试测试时,它似乎不起作用.我错过了什么?
我正在使用瘦v1.5.0(最新版本).
# Test this using: curl -X GET http://localhost:3000/test. You will find that the request does not
# timeout after 30s.
require 'thin'
class SimpleAdapter
def call(env)
sleep 100
body = ["hello!"]
[
200,
{ 'Content-Type' => 'text/plain' },
body
]
end
end
server = Thin::Server.new('127.0.0.1', 3000) do
map '/test' do
run SimpleAdapter.new
end
end
server.start!
Run Code Online (Sandbox Code Playgroud) 我尝试在轻薄的rails应用程序上部署ruby.我收到了这个错误
/usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:31:in `block in setup': You have already activated rack 1.5.1, but your Gemfile requires rack 1.4.4. Using bundle exec may solve this. (Gem::LoadError)
from /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler/runtime.rb:17:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler.rb:116:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p125@global/gems/bundler-1.2.0/lib/bundler/setup.rb:7:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/www/rails/mgm/config/boot.rb:6:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/www/rails/mgm/config/application.rb:1:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/www/rails/mgm/config/environment.rb:2:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /var/www/rails/mgm/config.ru:3:in `block in <main>'
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/rack-1.5.1/lib/rack/builder.rb:55:in `instance_eval'
from /usr/local/rvm/gems/ruby-1.9.3-p125/gems/rack-1.5.1/lib/rack/builder.rb:55:in …Run Code Online (Sandbox Code Playgroud) 我的瘦服务器在30秒后超时.我想覆盖这个ruby文件.
DEFAULT_TIMEOUT从30秒到120秒.怎么做?请告诉我.
代码在这里:https: //github.com/macournoyer/thin/blob/master/lib/thin/server.rb
我想覆盖没有"已经初始化的常量"警告.
我已经将我的os x shell切换到了zsh所有看起来很干净的东西.虽然我对独角兽只有一个问题.
基本上发生的事情就是当我开始使用独角兽:
% unicorn -c config/unicorn.rb
Run Code Online (Sandbox Code Playgroud)
我看到了独角兽的日志,但是如果我按下enter,在每个enter打印之间创建一些空间并在调用之间分隔日志^M并且不会创建新行.如果那时我binding.pry用来暂停执行,我会看到所有输入按钮被解释,我看到几个空行(只是提示字符串).
与Thin是一回事.
bash没有发生这种情况,我不确定是什么造成的,但这有点令人讨厌.
你知道怎么解决这个问题吗?
谢谢.