Showing posts with the label daemons

Setup ruby god for rails application || Daemons setup for rails application

 1) Install god on Ubuntu/Linux machine      sudo apt update      sudo apt install ruby-god 2) Create new rails application if you don't have existing 3) In your Gemfile add new gem       gem 'god', '~> 0.13.7', require: false 4) Then run bundle install 5) create a folder named daemons inside your  lib folder 6) create a file name daemons.god inside daemons folder (this file name or folder name can be anything its totally up to you) 7) Then paste this on you daemons.god file      ENV["RAILS_ENV"] = "development"      RAILS_ENV  = ENV.fetch('RAILS_ENV', 'production')      RAILS_ROOT = File.expand_path('../../..', __FILE__)      require 'shellwords'      # Create non-default log/daemons directory.      require 'fileutils'      FileUtils.mkdir_p "#{RAILS_ROOT}/log/daemons"      def daemon(name, options = {}) do |w|          command        = "bundle exec ruby lib/daemons/#{op