rails_nexus 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,158 +0,0 @@
1
- <% page_title t(".title", default: "Backup Settings") %>
2
-
3
- <div class="space-y-6">
4
- <%# ─── Header ──────────────────────────────────────────────── %>
5
- <nav class="rn-breadcrumbs" aria-label="Breadcrumb">
6
- <a href="<%= root_path %>" class="rn-breadcrumb">Dashboard</a>
7
- <span class="rn-breadcrumb-sep">/</span>
8
- <a href="<%= backup_path %>" class="rn-breadcrumb">Backups</a>
9
- <span class="rn-breadcrumb-sep">/</span>
10
- <span class="rn-breadcrumb-current">Settings</span>
11
- </nav>
12
-
13
- <div class="flex items-center gap-3">
14
- <svg class="w-6 h-6" style="color: var(--rn-primary)" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
15
- <path stroke-linecap="round" stroke-linejoin="round" d="M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.324.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 011.37.49l1.296 2.247a1.125 1.125 0 01-.26 1.431l-1.003.827c-.293.24-.438.613-.431.992a6.759 6.759 0 010 .255c-.007.378.138.75.43.99l1.005.828c.424.35.534.954.26 1.43l-1.298 2.247a1.125 1.125 0 01-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.57 6.57 0 01-.22.128c-.331.183-.581.495-.644.869l-.213 1.28c-.09.543-.56.941-1.11.941h-2.594c-.55 0-1.02-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 01-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 01-1.369-.49l-1.297-2.247a1.125 1.125 0 01.26-1.431l1.004-.827c.292-.24.437-.613.43-.992a6.932 6.932 0 010-.255c.007-.378-.138-.75-.43-.99l-1.004-.828a1.125 1.125 0 01-.26-1.43l1.297-2.247a1.125 1.125 0 011.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.087.22-.128.332-.183.582-.495.644-.869l.214-1.281z" />
16
- <path stroke-linecap="round" stroke-linejoin="round" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
17
- </svg>
18
- <h1 class="text-2xl font-bold" style="color: var(--rn-text)">Backup Settings</h1>
19
- </div>
20
-
21
- <%# ─── Settings Form ───────────────────────────────────────── %>
22
- <div class="rn-card">
23
- <div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
24
- <h2 class="text-sm font-semibold" style="color: var(--rn-text)">Configuration</h2>
25
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Settings are saved to <code>config/rails_nexus_backup.yml</code></p>
26
- </div>
27
-
28
- <%= form_with url: backup_update_settings_path, method: :patch, class: "p-4 space-y-6" do |f| %>
29
- <%# General %>
30
- <div>
31
- <h3 class="text-xs font-semibold uppercase tracking-wider mb-3" style="color: var(--rn-text-muted)">General</h3>
32
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
33
- <div>
34
- <label class="text-xs font-medium" style="color: var(--rn-text)">Backup Enabled</label>
35
- <%= f.select :enabled, options_for_select([["Yes", true], ["No", false]], @backup_config[:enabled]), {}, class: "rn-input mt-1" %>
36
- </div>
37
- <div>
38
- <label class="text-xs font-medium" style="color: var(--rn-text)">Alert Threshold (hours)</label>
39
- <%= f.number_field :alert_threshold_hours, value: @backup_config[:alert_threshold_hours] || 24, class: "rn-input mt-1" %>
40
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Alert when no backup in this many hours</p>
41
- </div>
42
- </div>
43
- </div>
44
-
45
- <%# Paths %>
46
- <div>
47
- <h3 class="text-xs font-semibold uppercase tracking-wider mb-3" style="color: var(--rn-text-muted)">Paths</h3>
48
- <div class="space-y-4">
49
- <div>
50
- <label class="text-xs font-medium" style="color: var(--rn-text)">Backup Config File</label>
51
- <%= f.text_field :config_path, value: @backup_config[:config_path], placeholder: "~/Backup/config.rb", class: "rn-input mt-1" %>
52
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Path to backup gem's config.rb</p>
53
- </div>
54
- <div>
55
- <label class="text-xs font-medium" style="color: var(--rn-text)">Backup Models Directory</label>
56
- <%= f.text_field :models_path, value: @backup_config[:models_path], placeholder: "~/Backup/models", class: "rn-input mt-1" %>
57
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Directory containing backup model files</p>
58
- </div>
59
- <div>
60
- <label class="text-xs font-medium" style="color: var(--rn-text)">Dump Directory</label>
61
- <%= f.text_field :dump_path, value: @backup_config[:dump_path], placeholder: "~/dumps", class: "rn-input mt-1" %>
62
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Where backup files are stored</p>
63
- </div>
64
- </div>
65
- </div>
66
-
67
- <%# Notification %>
68
- <div>
69
- <h3 class="text-xs font-semibold uppercase tracking-wider mb-3" style="color: var(--rn-text-muted)">Notification</h3>
70
- <div>
71
- <label class="text-xs font-medium" style="color: var(--rn-text)">Notify Command</label>
72
- <%= f.text_field :notify_command, value: @backup_config[:notify_command], placeholder: "bk-send", class: "rn-input mt-1" %>
73
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Shell command to run on backup success/failure</p>
74
- </div>
75
- </div>
76
-
77
- <%# RSync %>
78
- <div>
79
- <h3 class="text-xs font-semibold uppercase tracking-wider mb-3" style="color: var(--rn-text-muted)">RSync (Remote Sync)</h3>
80
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
81
- <div>
82
- <label class="text-xs font-medium" style="color: var(--rn-text)">Host</label>
83
- <%= f.text_field :rsync_host, value: @backup_config[:rsync_host], placeholder: "192.168.1.100", class: "rn-input mt-1" %>
84
- </div>
85
- <div>
86
- <label class="text-xs font-medium" style="color: var(--rn-text)">Port</label>
87
- <%= f.number_field :rsync_port, value: @backup_config[:rsync_port] || 22, class: "rn-input mt-1" %>
88
- </div>
89
- <div>
90
- <label class="text-xs font-medium" style="color: var(--rn-text)">SSH User</label>
91
- <%= f.text_field :rsync_user, value: @backup_config[:rsync_user], placeholder: "backup", class: "rn-input mt-1" %>
92
- </div>
93
- <div>
94
- <label class="text-xs font-medium" style="color: var(--rn-text)">Remote Path</label>
95
- <%= f.text_field :rsync_path, value: @backup_config[:rsync_path], placeholder: "backups/", class: "rn-input mt-1" %>
96
- </div>
97
- </div>
98
- </div>
99
-
100
- <%# Encryption %>
101
- <div>
102
- <h3 class="text-xs font-semibold uppercase tracking-wider mb-3" style="color: var(--rn-text-muted)">Encryption</h3>
103
- <div>
104
- <label class="text-xs font-medium" style="color: var(--rn-text)">Encryption Password</label>
105
- <%= f.password_field :encrypt_password, value: @backup_config[:encrypt_password], placeholder: "Enter password", class: "rn-input mt-1" %>
106
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Used for OpenSSL encryption of backup files</p>
107
- </div>
108
- </div>
109
-
110
- <%# Cleanup %>
111
- <div>
112
- <h3 class="text-xs font-semibold uppercase tracking-wider mb-3" style="color: var(--rn-text-muted)">Cleanup</h3>
113
- <div>
114
- <label class="text-xs font-medium" style="color: var(--rn-text)">Auto Cleanup (days)</label>
115
- <%= f.number_field :auto_cleanup_days, value: @backup_config[:auto_cleanup_days] || 30, class: "rn-input mt-1" %>
116
- <p class="text-xs mt-1" style="color: var(--rn-text-muted)">Delete backups older than this (0 = never)</p>
117
- </div>
118
- </div>
119
-
120
- <%# Actions %>
121
- <div class="flex items-center gap-3 pt-4" style="border-top: 1px solid var(--rn-border-light)">
122
- <%= f.submit "Save Settings", class: "rn-btn rn-btn-primary" %>
123
- <a href="<%= backup_path %>" class="rn-btn rn-btn-ghost">Cancel</a>
124
- </div>
125
- <% end %>
126
- </div>
127
-
128
- <%# ─── Current Status ──────────────────────────────────────── %>
129
- <div class="rn-card">
130
- <div class="p-4" style="border-bottom: 1px solid var(--rn-border-light)">
131
- <h2 class="text-sm font-semibold" style="color: var(--rn-text)">Current Status</h2>
132
- </div>
133
- <div class="p-4">
134
- <div class="grid grid-cols-2 md:grid-cols-4 gap-4 text-xs">
135
- <div>
136
- <span style="color: var(--rn-text-muted)">Config File</span>
137
- <p class="font-medium mt-1" style="color: var(--rn-text)"><%= @backup_config[:config_path] || "Not set" %></p>
138
- <p class="mt-1"><span class="rn-badge <%= File.exist?(@backup_config[:config_path].to_s) ? 'rn-badge-success' : 'rn-badge-danger' %>"><%= File.exist?(@backup_config[:config_path].to_s) ? 'Exists' : 'Missing' %></span></p>
139
- </div>
140
- <div>
141
- <span style="color: var(--rn-text-muted)">Models Dir</span>
142
- <p class="font-medium mt-1" style="color: var(--rn-text)"><%= @backup_config[:models_path] || "Not set" %></p>
143
- <p class="mt-1"><span class="rn-badge <%= Dir.exist?(@backup_config[:models_path].to_s) ? 'rn-badge-success' : 'rn-badge-danger' %>"><%= Dir.exist?(@backup_config[:models_path].to_s) ? 'Exists' : 'Missing' %></span></p>
144
- </div>
145
- <div>
146
- <span style="color: var(--rn-text-muted)">Dump Dir</span>
147
- <p class="font-medium mt-1" style="color: var(--rn-text)"><%= @backup_config[:dump_path] || "Not set" %></p>
148
- <p class="mt-1"><span class="rn-badge <%= Dir.exist?(@backup_config[:dump_path].to_s) ? 'rn-badge-success' : 'rn-badge-danger' %>"><%= Dir.exist?(@backup_config[:dump_path].to_s) ? 'Exists' : 'Missing' %></span></p>
149
- </div>
150
- <div>
151
- <span style="color: var(--rn-text-muted)">Config File</span>
152
- <p class="font-medium mt-1" style="color: var(--rn-text)">config/rails_nexus_backup.yml</p>
153
- <p class="mt-1"><span class="rn-badge <%= File.exist?(Rails.root.join('config', 'rails_nexus_backup.yml')) ? 'rn-badge-success' : 'rn-badge-muted' %>"><%= File.exist?(Rails.root.join('config', 'rails_nexus_backup.yml')) ? 'Saved' : 'Default' %></span></p>
154
- </div>
155
- </div>
156
- </div>
157
- </div>
158
- </div>
@@ -1,22 +0,0 @@
1
- class CreateRailsNexusLoggedExceptions < ActiveRecord::Migration[8.0]
2
- def change
3
- create_table :rails_nexus_exceptions do |t|
4
- t.string :exception_class
5
- t.string :controller_name
6
- t.string :action_name
7
- t.text :message
8
- t.text :backtrace
9
- t.text :environment
10
- t.text :request
11
- t.string :user_info
12
- t.string :user_agent
13
- t.string :remote_ip
14
-
15
- t.timestamps
16
- end
17
-
18
- add_index :rails_nexus_exceptions, :created_at
19
- add_index :rails_nexus_exceptions, :exception_class
20
- add_index :rails_nexus_exceptions, [:controller_name, :action_name]
21
- end
22
- end
@@ -1,30 +0,0 @@
1
- class AddAdvancedFeaturesToRailsNexusLoggedExceptions < ActiveRecord::Migration[8.0]
2
- def change
3
- # Exception cause chain
4
- add_column :rails_nexus_exceptions, :cause_chain, :text
5
-
6
- # Breadcrumbs (activity trail before crash)
7
- add_column :rails_nexus_exceptions, :breadcrumbs, :text
8
-
9
- # System health snapshot at crash time
10
- add_column :rails_nexus_exceptions, :system_health, :text
11
-
12
- # User impact tracking
13
- add_column :rails_nexus_exceptions, :user_id, :string
14
- add_column :rails_nexus_exceptions, :user_type, :string
15
-
16
- # Storm protection: occurrence count (deduplication)
17
- add_column :rails_nexus_exceptions, :occurrence_count, :integer, default: 1
18
-
19
- # Custom fingerprint for grouping
20
- add_column :rails_nexus_exceptions, :fingerprint, :string
21
-
22
- # Local/instance variables captured at raise time
23
- add_column :rails_nexus_exceptions, :local_variables, :text
24
- add_column :rails_nexus_exceptions, :instance_variables, :text
25
-
26
- add_index :rails_nexus_exceptions, :user_id
27
- add_index :rails_nexus_exceptions, :fingerprint
28
- add_index :rails_nexus_exceptions, :occurrence_count
29
- end
30
- end
@@ -1,22 +0,0 @@
1
- class CreateRailsNexusCronJobs < ActiveRecord::Migration[8.0]
2
- def change
3
- create_table :rails_nexus_cron_jobs do |t|
4
- t.string :name, null: false
5
- t.string :status, null: false, default: "pending"
6
- t.text :output
7
- t.text :error_message
8
- t.float :duration
9
- t.string :hostname
10
- t.json :metadata
11
- t.datetime :started_at
12
- t.datetime :finished_at
13
-
14
- t.timestamps
15
- end
16
-
17
- add_index :rails_nexus_cron_jobs, :name
18
- add_index :rails_nexus_cron_jobs, :status
19
- add_index :rails_nexus_cron_jobs, :created_at
20
- add_index :rails_nexus_cron_jobs, :started_at
21
- end
22
- end
@@ -1,120 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class CreateRailsNexusMetricsTables < ActiveRecord::Migration[8.0]
4
- def change
5
- # ─── rails_nexus_metrics ─────────────────────────────────────────
6
- create_table :rails_nexus_metrics do |t|
7
- t.string :metric_type, null: false
8
- t.float :value, null: false
9
- t.string :unit
10
- t.json :metadata
11
- t.datetime :recorded_at, null: false
12
- end
13
-
14
- add_index :rails_nexus_metrics, [:metric_type, :recorded_at]
15
- add_index :rails_nexus_metrics, :recorded_at
16
-
17
- # ─── rails_nexus_database_stats ──────────────────────────────────
18
- create_table :rails_nexus_database_stats do |t|
19
- t.integer :pool_size
20
- t.integer :busy
21
- t.integer :idle
22
- t.integer :dead
23
- t.integer :waiting
24
- t.float :utilization
25
- t.string :table_name
26
- t.bigint :table_rows
27
- t.string :table_size
28
- t.string :index_size
29
- t.string :data_free
30
- t.json :n1_patterns
31
- t.json :slow_queries
32
- t.datetime :recorded_at, null: false
33
- end
34
-
35
- add_index :rails_nexus_database_stats, :recorded_at
36
- add_index :rails_nexus_database_stats, :table_name
37
-
38
- # ─── rails_nexus_backups ─────────────────────────────────────────
39
- create_table :rails_nexus_backups do |t|
40
- t.string :model_name, null: false
41
- t.string :status, null: false
42
- t.text :file_path
43
- t.bigint :file_size
44
- t.float :duration
45
- t.text :error_message
46
- t.string :triggered_by
47
- t.datetime :started_at, null: false
48
- t.datetime :completed_at
49
- end
50
-
51
- add_index :rails_nexus_backups, [:model_name, :started_at]
52
- add_index :rails_nexus_backups, :status
53
- add_index :rails_nexus_backups, :started_at
54
-
55
- # ─── rails_nexus_server_metrics ──────────────────────────────────
56
- create_table :rails_nexus_server_metrics do |t|
57
- t.string :hostname
58
- t.string :ruby_version
59
- t.string :rails_version
60
- t.string :os_info
61
- t.float :cpu_usage
62
- t.integer :cpu_cores
63
- t.float :load_avg_1m
64
- t.float :load_avg_5m
65
- t.float :load_avg_15m
66
- t.bigint :memory_total
67
- t.bigint :memory_used
68
- t.bigint :memory_free
69
- t.bigint :swap_total
70
- t.bigint :swap_used
71
- t.bigint :disk_total
72
- t.bigint :disk_used
73
- t.float :disk_usage_percent
74
- t.integer :puma_workers
75
- t.integer :puma_threads
76
- t.integer :sidekiq_workers
77
- t.integer :sidekiq_processed
78
- t.integer :sidekiq_failed
79
- t.integer :sidekiq_enqueued
80
- t.float :uptime_seconds
81
- t.datetime :recorded_at, null: false
82
- end
83
-
84
- add_index :rails_nexus_server_metrics, :recorded_at
85
-
86
- # ─── rails_nexus_nginx_metrics ───────────────────────────────────
87
- create_table :rails_nexus_nginx_metrics do |t|
88
- t.integer :status_code, null: false
89
- t.string :request_method
90
- t.string :request_path
91
- t.float :response_time
92
- t.float :upstream_time
93
- t.string :remote_addr
94
- t.string :user_agent
95
- t.string :referer
96
- t.text :request_body
97
- t.json :metadata
98
- t.datetime :recorded_at, null: false
99
- end
100
-
101
- add_index :rails_nexus_nginx_metrics, [:status_code, :recorded_at]
102
- add_index :rails_nexus_nginx_metrics, :recorded_at
103
- add_index :rails_nexus_nginx_metrics, :request_path
104
-
105
- # ─── rails_nexus_events ──────────────────────────────────────────
106
- create_table :rails_nexus_events do |t|
107
- t.string :event_type, null: false
108
- t.string :eventable_type
109
- t.bigint :eventable_id
110
- t.json :metadata
111
- t.string :author
112
- t.text :message
113
- t.datetime :created_at, null: false
114
- end
115
-
116
- add_index :rails_nexus_events, [:eventable_type, :eventable_id]
117
- add_index :rails_nexus_events, :event_type
118
- add_index :rails_nexus_events, :created_at
119
- end
120
- end
@@ -1,11 +0,0 @@
1
- class AddPlatformToRailsNexusLoggedExceptions < ActiveRecord::Migration[8.0]
2
- def change
3
- add_column :rails_nexus_exceptions, :platform, :string, default: "web"
4
- add_column :rails_nexus_exceptions, :platform_version, :string
5
- add_column :rails_nexus_exceptions, :device_type, :string
6
- add_column :rails_nexus_exceptions, :app_version, :string
7
-
8
- add_index :rails_nexus_exceptions, :platform
9
- add_index :rails_nexus_exceptions, [:platform, :exception_class]
10
- end
11
- end
@@ -1,21 +0,0 @@
1
- class CreateRailsNexusWebhookDeliveries < ActiveRecord::Migration[8.0]
2
- def change
3
- create_table :rails_nexus_webhook_deliveries do |t|
4
- t.string :url, null: false
5
- t.string :status, null: false, default: "pending"
6
- t.integer :response_code
7
- t.text :request_body
8
- t.text :response_body
9
- t.float :duration
10
- t.text :error_message
11
- t.string :event_type
12
- t.json :metadata
13
-
14
- t.timestamps
15
- end
16
-
17
- add_index :rails_nexus_webhook_deliveries, :status
18
- add_index :rails_nexus_webhook_deliveries, :created_at
19
- add_index :rails_nexus_webhook_deliveries, :url
20
- end
21
- end
@@ -1,29 +0,0 @@
1
- # Migration for RailsNexus workflow management
2
- # Adds priority, assignment, snooze, mute columns and comments table
3
- class AddWorkflowToRailsNexus < ActiveRecord::Migration[8.0]
4
- def change
5
- # Workflow columns on logged_exceptions
6
- add_column :rails_nexus_exceptions, :priority, :string, default: nil
7
- add_column :rails_nexus_exceptions, :assigned_to, :string, default: nil
8
- add_column :rails_nexus_exceptions, :assigned_at, :datetime, default: nil
9
- add_column :rails_nexus_exceptions, :snoozed_until, :datetime, default: nil
10
- add_column :rails_nexus_exceptions, :muted, :boolean, default: false
11
- add_column :rails_nexus_exceptions, :muted_at, :datetime, default: nil
12
- add_column :rails_nexus_exceptions, :comments_count, :integer, default: 0
13
-
14
- add_index :rails_nexus_exceptions, :priority
15
- add_index :rails_nexus_exceptions, :assigned_to
16
- add_index :rails_nexus_exceptions, :muted
17
-
18
- # Comments table
19
- create_table :rails_nexus_comments do |t|
20
- t.references :logged_exception, null: false, foreign_key: { to_table: :rails_nexus_exceptions }
21
- t.string :author, null: false
22
- t.text :body, null: false
23
- t.string :comment_type, default: "comment" # comment, status_change, assignment, note
24
- t.timestamps
25
- end
26
-
27
- add_index :rails_nexus_comments, [:logged_exception_id, :created_at]
28
- end
29
- end