我正在寻找一些关于类似于使用 binding.pry 的工具的建议。
我正在与 foreman 一起在本地提供 Rails 应用程序,并且希望实现相同的功能,将“调试器”放入我的代码中,当进程遇到该问题时,冻结并打开该代码部分中的控制台环境。
我尝试过与工头一起使用 pry,但没有成功,我很好奇是否还有其他已知的工具我没有通过谷歌找到?
感谢您的建议。
我试图在Heroku上组装一个示例node.js应用程序,基本上按照他们的说明:https://devcenter.heroku.com/articles/nodejs
该应用程序在本地运行正常foreman start,但是,每次部署应用程序时它都会崩溃. 我究竟做错了什么?
我的Procfile包含:
web: node web.js
Run Code Online (Sandbox Code Playgroud)
我的package.json包含:
{
"name": "testapp",
"version": "0.0.1",
"engines": {
"node": "0.6.15"
, "npm": "1.1.9"
}
, "dependencies": {
"tower": "0.4.0-12"
}
}
Run Code Online (Sandbox Code Playgroud)
我的web.js包含:
var express = require('express');
var app = express.createServer(express.logger());
app.get('/', function(request, response) {
response.send('Hello World!');
});
var port = process.env.PORT || 3000;
app.listen(port, function() {
console.log("Listening on " + port);
});
Run Code Online (Sandbox Code Playgroud)
该应用程序部署并启动,但每次都崩溃.我从应用程序看到的日志输出是:
2012-04-27T20:21:31+00:00 heroku[web.1]: State changed from created to starting …Run Code Online (Sandbox Code Playgroud) 我在Heroku上有一个ruby应用程序需要使用工作线程进行一些后台处理.我还没有决定延迟工作和Resque,但这个问题的答案可能会影响我.后台作业将主要等待外部API(Facebook,Twitter等),因此它们将使CPU的利用率非常低.
有没有办法在heroku上获得每个worker dyno的多个线程?是这个标准还是有插件DJ或Resque?或者foreman配置预分叉或什么?否则我将浪费很多钱在工作人员的dynos上,95%的人闲置等待外部API.
对于工头,我正在尝试使用两个.env文件启动我的rails应用程序.
一个是常规.env文件,但是第二个文件有额外的变量要加载.我正在尝试使用本指南中提到的方法来保持配置变量的代码:https://devcenter.heroku.com/articles/config-vars
这是我的Procfile:
web: bundle exec rails server thin -p $PORT --env $RACK_ENV,var.env
Run Code Online (Sandbox Code Playgroud)
我的问题是,即使文档说它应该是可能的,工头似乎也不想为-env采用这两个参数:
-e, - env
指定备用环境文件.您可以使用以下命令指定多个文件: - env file1,file2.
当我尝试用"foreman start"运行它时,我收到错误:
06:22:46 web.1 | You did not specify how you would like Rails to report deprecation notices for your development,var.env environment, please set config.active_support.deprecation to :log, :notify or :stderr at config/environments/development,var.env.rb
Run Code Online (Sandbox Code Playgroud)
它似乎并不想分割"development,var.env"并单独处理它们.当我查看工头代码时,看起来它应该只是对逗号做一个简单的拆分,所以我不知道我做错了什么或者它是一个错误.
当我foreman start在localhost上运行时,Procfile中的所有进程都正常运行:
#Procfile
web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb
resque: env TERM_CHILD=1 QUEUE=* bundle exec rake resque:work
sqs_converted: bundle exec rake sqs:listen_converted
sqs_failed: bundle exec rake sqs:listen_failed
Run Code Online (Sandbox Code Playgroud)
$ foreman start
13:52:07 sqs_failed.1 | started with pid 3521
13:52:07 web.1 | started with pid 3518
13:52:07 sqs_converted.1 | started with pid 3520
13:52:07 resque.1 | started with pid 3519
Run Code Online (Sandbox Code Playgroud)
但是当我部署到heroku并运行时,heroku ps我运行的只是一个web.1实例
=== web: `bundle exec unicorn -p $PORT -c ./config/unicorn.rb`
web.1: up for 8m
Run Code Online (Sandbox Code Playgroud)
无法弄清楚发生了什么......谢谢
我当前使用supervisor在本地开发时运行我的node.js应用程序.这很棒,但我目前将所有配置存储在我的中.bash_profile,我想将它们移动到一个.env文件中.
有没有办法通过监视主管的文件来获取工头的环境加载功能?
一种选择是将它添加到我Procfile这样的,但我怀疑这会搞乱Heroku.
`local: supervisor web.js`
Run Code Online (Sandbox Code Playgroud) 我想知道是否可以同时运行多个jekyll应用程序.我已经安装了工头,但是当另一个已经运行时,它似乎无法更改应用程序端口.
目前我必须在Procfile中手动设置jekyll端口
web: jekyll --server 5000
Run Code Online (Sandbox Code Playgroud)
无论如何可以自动执行此操作吗?
我正在尝试启动我的应用程序.是独角兽+工头+ sinatra应用程序.
这是我的config.ru文件:
require "rubygems"
require "sinatra"
Bundler.require
require File.expand_path '../twitter_module.rb', __FILE__
run TwitterModule
require File.expand_path '../lib/tweet_streamer.rb', __FILE__
require 'sidekiq/web'
run Rack::URLMap.new('/' => Sinatra::Application, '/sidekiq' => Sidekiq::Web)
Run Code Online (Sandbox Code Playgroud)
这是我的sidekiq.yml:
---
:pidfile: tmp/pids/sidekiq.pid
development:
:verbose: true
:logfile: log/sidekiq_development.log
Run Code Online (Sandbox Code Playgroud)
这是我的Procfile:
unicorn: bundle exec unicorn -c config/unicorn.rb
sidekiq: bundle exec sidekiq -C config/sidekiq.yml -e development -r lib/workers
Run Code Online (Sandbox Code Playgroud)
现在的问题是我总是给出这个错误:
2013-10-12T15:30:23Z 28234 TID-ov4rh38wo INFO: Please point sidekiq to a Rails 3/4 application or a Ruby file
2013-10-12T15:30:23Z 28234 TID-ov4rh38wo INFO: to load your worker classes with …Run Code Online (Sandbox Code Playgroud) 这可能是一个二合一的问题.
我有一个用于家庭/爱好使用的Rails应用程序,托管在Raspberry Pi上,我想知道是否可以为它创建本地SSL证书并设置Rails使用它?
如果是,我如何设置我的Rails/Puma/Foreman/Ubuntu应用程序?现在,我使用Procfile运行Foreman的应用程序:
web: bundle exec puma -t 8:8 -p 3000
worker: bundle exec sidekiq
clock: bundle exec clockwork config/clock.rb
Run Code Online (Sandbox Code Playgroud)首先,我知道这里已经列出了这个错误,但问题是不同的。
我有一个 Rails 4 应用程序,我曾经在 Puma 上运行过。
然后,我的一个朋友开发了该应用程序,并建议我们改用 Foreman。
所以,我曾经rails s在终端中在本地运行该应用程序。
现在,我应该用foreman start.
问题是,几乎每次我尝试启动该应用程序时,都会出现以下错误:
foreman start
08:42:28 web.1 | started with pid 3398
08:42:28 web.1 | [3398] Puma starting in cluster mode...
08:42:28 web.1 | [3398] * Version 2.13.4 (ruby 2.2.1-p85), codename: A Midsummer Code's Dream
08:42:28 web.1 | [3398] * Min threads: 5, max threads: 5
08:42:28 web.1 | [3398] * Environment: development
08:42:28 web.1 | [3398] * Process workers: 2
08:42:28 web.1 …Run Code Online (Sandbox Code Playgroud)