hacer inteligencia con sutty
This commit is contained in:
parent
61e9bf70dc
commit
fb5cc9ae26
6 changed files with 146 additions and 2 deletions
|
@ -6,3 +6,10 @@ SUTTY=sutty.local
|
|||
SUTTY_WITH_PORT=sutty.local:3000
|
||||
REDIS_SERVER=
|
||||
REDIS_CLIENT=
|
||||
# API authentication
|
||||
HTTP_BASIC_USER=
|
||||
HTTP_BASIC_PASSWORD=
|
||||
BLAZER_DATABASE_URL=
|
||||
BLAZER_SLACK_WEBHOOK_URL=
|
||||
BLAZER_USERNAME=
|
||||
BLAZER_PASSWORD=
|
||||
|
|
2
Gemfile
2
Gemfile
|
@ -38,7 +38,7 @@ gem 'turbolinks', '~> 5'
|
|||
gem 'jbuilder', '~> 2.5'
|
||||
# Use ActiveModel has_secure_password
|
||||
gem 'bcrypt', '~> 3.1.7'
|
||||
|
||||
gem 'blazer'
|
||||
gem 'bootstrap', '~> 4'
|
||||
gem 'commonmarker'
|
||||
gem 'devise'
|
||||
|
|
12
Gemfile.lock
12
Gemfile.lock
|
@ -79,6 +79,11 @@ GEM
|
|||
bcrypt (3.1.13)
|
||||
bcrypt_pbkdf (1.0.1)
|
||||
bindex (0.8.1)
|
||||
blazer (2.2.1)
|
||||
activerecord (>= 5)
|
||||
chartkick (>= 3.2)
|
||||
railties (>= 5)
|
||||
safely_block (>= 0.1.1)
|
||||
bootstrap (4.4.1)
|
||||
autoprefixer-rails (>= 9.1.0)
|
||||
popper_js (>= 1.14.3, < 2)
|
||||
|
@ -92,6 +97,7 @@ GEM
|
|||
rack (>= 1.0.0)
|
||||
rack-test (>= 0.5.4)
|
||||
xpath (>= 2.0, < 4.0)
|
||||
chartkick (3.3.1)
|
||||
childprocess (3.0.0)
|
||||
coderay (1.1.2)
|
||||
colorator (1.1.0)
|
||||
|
@ -122,6 +128,7 @@ GEM
|
|||
email_address (0.1.12)
|
||||
netaddr (>= 2.0.4, < 3)
|
||||
simpleidn
|
||||
errbase (0.2.0)
|
||||
erubi (1.9.0)
|
||||
eventmachine (1.2.7)
|
||||
exception_notification (4.4.0)
|
||||
|
@ -324,6 +331,8 @@ GEM
|
|||
rubyzip (2.0.0)
|
||||
rugged (0.28.4.1)
|
||||
safe_yaml (1.0.5)
|
||||
safely_block (0.3.0)
|
||||
errbase (>= 0.1.1)
|
||||
sassc (2.2.1)
|
||||
ffi (~> 1.9)
|
||||
sassc-rails (2.1.2)
|
||||
|
@ -396,6 +405,7 @@ PLATFORMS
|
|||
DEPENDENCIES
|
||||
bcrypt (~> 3.1.7)
|
||||
bcrypt_pbkdf
|
||||
blazer
|
||||
bootstrap (~> 4)
|
||||
brakeman
|
||||
capybara (~> 2.13)
|
||||
|
@ -453,4 +463,4 @@ RUBY VERSION
|
|||
ruby 2.6.5p114
|
||||
|
||||
BUNDLED WITH
|
||||
2.0.2
|
||||
2.1.4
|
||||
|
|
75
config/blazer.yml
Normal file
75
config/blazer.yml
Normal file
|
@ -0,0 +1,75 @@
|
|||
# see https://github.com/ankane/blazer for more info
|
||||
|
||||
data_sources:
|
||||
main:
|
||||
url: <%= ENV["BLAZER_DATABASE_URL"] %>
|
||||
|
||||
# statement timeout, in seconds
|
||||
# none by default
|
||||
# timeout: 15
|
||||
|
||||
# caching settings
|
||||
# can greatly improve speed
|
||||
# off by default
|
||||
# cache:
|
||||
# mode: slow # or all
|
||||
# expires_in: 60 # min
|
||||
# slow_threshold: 15 # sec, only used in slow mode
|
||||
|
||||
# wrap queries in a transaction for safety
|
||||
# not necessary if you use a read-only user
|
||||
# true by default
|
||||
# use_transaction: false
|
||||
|
||||
smart_variables:
|
||||
site_id: 'select id, name from sites order by name asc'
|
||||
# zone_id: "SELECT id, name FROM zones ORDER BY name ASC"
|
||||
# period: ["day", "week", "month"]
|
||||
# status: {0: "Active", 1: "Archived"}
|
||||
|
||||
linked_columns:
|
||||
# user_id: "/admin/users/{value}"
|
||||
|
||||
smart_columns:
|
||||
site_id: 'select id, name from sites where id in {value}'
|
||||
# user_id: "SELECT id, name FROM users WHERE id IN {value}"
|
||||
|
||||
# create audits
|
||||
audit: true
|
||||
|
||||
# change the time zone
|
||||
# time_zone: "Pacific Time (US & Canada)"
|
||||
|
||||
# class name of the user model
|
||||
user_class: Usuarie
|
||||
|
||||
# method name for the current user
|
||||
user_method: current_usuarie
|
||||
|
||||
# method name for the display name
|
||||
user_name: email
|
||||
|
||||
# custom before_action to use for auth
|
||||
# before_action_method: require_admin
|
||||
|
||||
# email to send checks from
|
||||
from_email: blazer@<%= ENV.fetch('SUTTY', 'sutty.nl') %>
|
||||
|
||||
# webhook for Slack
|
||||
# slack_webhook_url: <%= ENV["BLAZER_SLACK_WEBHOOK_URL"] %>
|
||||
|
||||
check_schedules:
|
||||
- "1 day"
|
||||
- "1 hour"
|
||||
- "5 minutes"
|
||||
|
||||
# enable anomaly detection
|
||||
# note: with trend, time series are sent to https://trendapi.org
|
||||
# anomaly_checks: trend / r
|
||||
|
||||
# enable forecasting
|
||||
# note: with trend, time series are sent to https://trendapi.org
|
||||
# forecasting: trend
|
||||
|
||||
# enable map
|
||||
# mapbox_access_token: <%= ENV["MAPBOX_ACCESS_TOKEN"] %>
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
Rails.application.routes.draw do
|
||||
devise_for :usuaries
|
||||
mount Blazer::Engine, at: 'blazer'
|
||||
|
||||
root 'application#index'
|
||||
|
||||
|
|
51
db/migrate/20200206163257_install_blazer.rb
Normal file
51
db/migrate/20200206163257_install_blazer.rb
Normal file
|
@ -0,0 +1,51 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Blazer
|
||||
class InstallBlazer < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
return unless Rails.env.production?
|
||||
|
||||
create_table :blazer_queries do |t|
|
||||
t.references :creator
|
||||
t.string :name
|
||||
t.text :description
|
||||
t.text :statement
|
||||
t.string :data_source
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :blazer_audits do |t|
|
||||
t.references :user
|
||||
t.references :query
|
||||
t.text :statement
|
||||
t.string :data_source
|
||||
t.timestamp :created_at
|
||||
end
|
||||
|
||||
create_table :blazer_dashboards do |t|
|
||||
t.references :creator
|
||||
t.text :name
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :blazer_dashboard_queries do |t|
|
||||
t.references :dashboard
|
||||
t.references :query
|
||||
t.integer :position
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
create_table :blazer_checks do |t|
|
||||
t.references :creator
|
||||
t.references :query
|
||||
t.string :state
|
||||
t.string :schedule
|
||||
t.text :emails
|
||||
t.text :slack_channels
|
||||
t.string :check_type
|
||||
t.text :message
|
||||
t.timestamp :last_run_at
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue