Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

God load crashes when dependencies are required from god config files #255

Open
Startouf opened this issue Jun 14, 2018 · 0 comments
Open

Comments

@Startouf
Copy link

Maybe I'm doing things wrong, but I have defined some custom God notifier plugins, and I need to load those dependencies before starting god for the first time.

But then, when I try to release a new app version (I'm deploying with Capistrano), my flow is to update God config using god load. Problem, this causes crashes when I require modules that extend ActiveSupport::Concern and have included blocks with the following error

Cannot define multiple 'included' blocks for a Concern

Here is a sample of my God file (Note that <%= %> are compiled before execution)

require 'active_support/all'
require 'slack-notifier'
require '<%= release_path.join("lib/service_connector") %>'
require '<%= release_path.join("lib/slack_connector") %>'
require '<%= release_path.join("lib/god/contacts/slack_notifier") %>'

God.contact(:email) do |c|

God.contact(:slack_notifier) do |c|
  c.name = 'priority-errors'
  c.group = 'developers'
  c.webhook = '<%= Capistrano::SecretsYml.local_secrets_yml("deploy")&.dig("slack") %>'
end

My restart task with Capistrano

desc "Restart god's child processes"
  task :restart do
    on roles(fetch(:god_roles)) do
      within release_path do
        with RAILS_ENV: fetch(:rails_env) do
          if god_is_running?
            execute :bundle, 'exec god load config/god/god.rb'
            execute :bundle, 'exec god restart'
          else
            start_god
          end
        end
      end
    end
  end

The execute :bundle, 'exec god load config/god/god.rb' command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant