Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Starting daemon from Capistrano occasionally is successfull #47

Closed
mirelabk opened this Issue · 6 comments

3 participants

@mirelabk

Capistrano script in the rails project that uses daemonkit has following start and stop tasks:

  task :start do
    try_runner "RAILS_ENV=#{fetch(:rails_env)} DAEMON_ENV=#{fetch(:rails_env)} BUNDLE_GEMFILE=#{current_path}/Gemfile bundle exec #{current_path}/bin/#{daemon_name} start"
  end
  task :stop do
    try_runner "cd #{current_path} && RAILS_ENV=#{fetch(:rails_env)} DAEMON_ENV=#{fetch(:rails_env)} bin/#{daemon_name} stop"
  end

Stop task always runs successfully but start task just occasionally would start successfully. Even if it doesn't start, it never reports any problems. ssh debug log also doesn't show any issues.
Any idea about why would this be happening?
Thanks a lot.
Mirela

@marcbowes
Collaborator

There is one big difference in your start & stop tasks. In the start task, you don't cd into current_path before running the bin. Technically this shouldn't be an issue, but if your code assumes anything about the current working directory, things might not work as expected.

You should be able to find debug information in log/backtrace-TIME.

@mirelabk

That is not an issue. I tred couple of different things and all of them work for stop, but not for start.
I do not see the backtrace-TIME log file. Do I need to enable something for this log to get created? Thanks.

@mirelabk

I see log/backtrace-TIME created for the other project that is not a rails project. But for this rails project I am having issues with this log doesn't exist at all.
Thanks for your help.

@marcbowes
Collaborator

lib/daemon_kit/initializer.rb configures Safely:

Safely::Backtrace.trace_directory = File.join( DAEMON_ROOT, "log" )

The DAEMON_ROOT constant is set by config/boot.rb in your DaemonKit project.

@marcbowes
Collaborator

I guess it's worth pointing out that the log won't be there if it never backtraced.

Have you tried running the daemon without the 'start' on the end? I realise this means it won't be daemonized but at least you'll see any failures (or success) on stdout/err. If it does work, you can Ctrl-C the deployment and try again.

@kennethkalmer

I've started some much needed upgrades to the deployment story in #88, still a few things to do but initial tests to AWS looks much better. Also made possible by the great strides capistrano has taken recently. Lets please keep the conversation (and contributions) over there.

Thanks for reporting the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.