Permalink
Find file
eb9730f Nov 10, 2016
@eisuke @eagletmt
187 lines (129 sloc) 3.63 KB

Administrator Guide

Components

Web UI (Web console)

The Web UI (Web Console) is a rails application.

Daemons

All kuroko2 daemons backend is serverengine gem.

Example systemd unit files are available here.

job-scheduler

./bin/rails runner Kuroko2::Servers::JobScheduler.new.run

workflow-processor

./bin/rails runner Kuroko2::Servers::WorkflowProcessor.new.run

command-executor

./bin/rails runner Kuroko2::Servers::CommandExecutor.new.run

Configuration

Kuroko2's configuration file is config/kuroko2.yml.

url

A your Kuroko2 application URL.

url: 'my.kuroko2.host.expample.com'

action_mailer

The options to ActionMailer. See detals in Action Mailer Basics in Ruby on Rails Guides.

action_mailer:
  delivery_method: 'smtp'
  smtp_settings:
    address: 'your.smtp.example.com'
    port:    25
    domain:  'example.com'

custom_tasks

A hash table in the custom task name and class name.

custom_tasks:
  custom_task1: CustomTaskClass

See details in Adding custom tasks.

notifiers

Notifiers settings. The mail option is required, others is optional.

notifiers:
  mail:
    mail_from: 'no-reply@example.com>'
    mail_to: "kuroko+<%= Socket.gethostname %>@example.com"
  slack:
    webhook_url: 'https://localhost/test/slack'
  webhook:
    secret_token: '<%= ENV["KUROKO2_WEBHOOK_SECRET_TOKEN"] %>'

execution_logger

Select a execution logger storage and options.

Supporting storages are

  • Void (Do nothing logger)
  • Amazon CloudWatch Logs
execution_logger:
  type: 'CloudWatchLogs'
  option:
    group_name: 'kuroko2'

app_authentication

Authentication settings. it supports only Google OAuth.

app_authentication:
  google_oauth2:
    client_id: '<%= ENV["GOOGLE_CLIENT_ID"] %>'
    client_secret: '<%= ENV["GOOGLE_CLIENT_SECRET"] %>'
    options:
      hd: '<%= ENV["GOOGLE_HOSTED_DOMAIN"] %>'

Addtional configuration to Kuroko2::Servers::CommandExecutor

Environment variable Details Required
HOSTNAME A hostname to display on Web UI. NO
QUEUE A queue name to execute. Default value is "@default". NO
NUM_WORKERS The number of workers. Default value is 4. NO

Adding custom tasks

1. Create a custom task directory to your application

$ cd your_kurko2_rails_apps/
$ mkdir -p lib/kuroko2/workflow/task/

2. Put a custom task class in your custom task directory.

module Kuroko2
  module Workflow
    module Task
      class MyProjectRunner < Execute
        def chdir
          '/home/alice/my_project'
        end

        def shell
          "bundle exec ./bin/rails runner -e production #{Shellwords.escape(option)}"
        end
      end
    end
  end
end

3. Add to config/kuroko2.yml

custom_tasks:
  my_project_runner: MyProjectRunner

4. You can use custom task in job scripts.

env: VAL1=A
env: VAL2=B
my_project_runner: MyProject::Batch1.run

Monitoring Kuroko2 stats

You can monitor the Kuroko2 statuses at below endpoints.

  • /v1/stats/waiting_execution
  • /v1/stats/instance

How to upgrade Kuroko2

$ bundle update kuroko2
$ ./bin/rake kuroko2:install:migrations
$ ./bin/rake db:migrate