Tag: heroku

在Heroku上重启后,长时间运行的delayed_job作业保持锁定状态

当重新启动Heroku工作程序时(无论是在命令上还是作为部署的结果),Heroku都会将SIGTERM发送到工作进程。 在delayed_job的情况下, 捕获 SIGTERM 信号 ,然后在当前作业(如果有)停止后工作程序停止执行。 如果工人需要很长时间才能完成,那么Heroku将发送SIGKILL 。 在delayed_job的情况下,这会在数据库中delayed_job一个锁定的作业,该作业不会被另一个工作人员接收。 我想确保工作最终完成(除非出现错误)。 鉴于此,采用这种方法的最佳方法是什么? 我看到两个选择。 但是我想得到其他的意见: 修改delayed_job以在收到SIGTERM时停止处理当前作业(并释放锁定)。 找出(程序化的)方法来检测孤立的锁定作业,然后解锁它们。 有什么想法吗?

Sinatra即时配置环境

我已成功编写了一个小的Sinatra应用程序,并已成功将其部署在heroku上。 但是我想在我的本地计算机上以开发模式运行该应用程序,并且我希望在将它推送到远程存储库后在heroku上具有生产模式。 目前我可以实现其中一个选项。 当我将config.ru更改为以下值时: require ‘rubygems’ require ‘sinatra’ require ‘sinatra/reloader’ require “./calc.rb” enable :logging set :environment, :development set :port, 4567 我可以通过ruby config.ru在本地(在端口4567上)运行它。 当我将config.ru更改为: require ‘rubygems’ require ‘sinatra’ require ‘sinatra/reloader’ require “./calc.rb” enable :logging set :environment, :production set :port, 4567 run Sinatra::Application 我能够让它在Heroku上运行(在端口80上)。 但我不能在开发和生产中使用相同的配置。 我希望有类似的东西: ruby config.ru dev for development和ruby config.ru for production。 附加信息: 当我尝试在我的本地机器上运行生产config.ru时,我得到: $ […]

有没有办法为heroku上的应用程序设置简单的http身份validation?

我想使用简单的http身份validation在heroku上设置一个私有临时服务器。 那可能吗?

HEROKU – 无法运行git push heroku master

我运行命令 heroku create –stack cedar git push heroku master 但它给了我一个错误: > Counting objects: 144, done. Delta compression using up to 2 threads. > Compressing objects: 100% (128/128), done. Writing objects: 100% > (144/144), 50.16 KiB, done. Total 144 (delta 23), reused 0 (delta 0) > > —–> Heroku receiving push > —–> Ruby/Rails app detected […]

Heroku和Rails:Postgres的Gem加载错误,但它在GEMFILE中指定

所以我试图将一个小项目部署到Heroku,但是当我部署它并试图运行heroku run rake db:migrate它返回了我以下错误: rake aborted! Gem::LoadError: Specified ‘postgresql’ for database adapter, but the gem is not loaded. Add `gem ‘pg’` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:177:in `rescue in spec’ /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_adapters/connection_specification.rb:174:in `spec’ /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/connection_handling.rb:50:in `establish_connection’ /app/vendor/bundle/ruby/2.2.0/gems/activerecord-4.2.6/lib/active_record/railtie.rb:120:in `block (2 levels) in ‘ /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval’ /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook’ /app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.6/lib/active_support/lazy_load_hooks.rb:28:in `block […]

如何在没有先保存文本文件的情况下在Ruby中进行FTP

由于Heroku不允许将动态文件保存到磁盘,我遇到了一个两难的境地,我希望你能帮我克服。 我有一个可以在RAM中创建的文本文件。 问题是我找不到允许我将文件流式传输到另一个FTP服务器的gem或函数。 我正在使用的Net / FTP gem需要先将文件保存到磁盘。 有什么建议? ftp = Net::FTP.new(domain) ftp.passive = true ftp.login(username, password) ftp.chdir(path_on_server) ftp.puttextfile(path_to_web_file) ftp.close ftp.puttextfile函数是需要物理文件存在的函数。