minicron 0.1.1 → 0.2
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.
- checksums.yaml +4 -4
- data/README.md +96 -43
- data/Rakefile +9 -1
- data/lib/minicron.rb +9 -4
- data/lib/minicron/alert.rb +2 -1
- data/lib/minicron/alert/email.rb +7 -2
- data/lib/minicron/alert/pagerduty.rb +3 -2
- data/lib/minicron/alert/sms.rb +2 -1
- data/lib/minicron/cli.rb +49 -19
- data/lib/minicron/constants.rb +2 -1
- data/lib/minicron/cron.rb +6 -6
- data/lib/minicron/hub/app.rb +8 -8
- data/lib/minicron/hub/assets/app/controllers/executions.js +4 -3
- data/lib/minicron/hub/assets/app/controllers/hosts.js +4 -4
- data/lib/minicron/hub/assets/app/controllers/jobs.js +4 -4
- data/lib/minicron/hub/assets/app/controllers/schedules.js +4 -1
- data/lib/minicron/hub/controllers/api/executions.rb +4 -4
- data/lib/minicron/hub/controllers/api/hosts.rb +18 -5
- data/lib/minicron/hub/controllers/api/job_execution_outputs.rb +2 -2
- data/lib/minicron/hub/controllers/api/jobs.rb +8 -8
- data/lib/minicron/hub/controllers/api/schedule.rb +10 -10
- data/lib/minicron/hub/db/schema.rb +70 -65
- data/lib/minicron/hub/db/schema.sql +53 -25
- data/lib/minicron/hub/models/execution.rb +1 -1
- data/lib/minicron/hub/models/host.rb +10 -1
- data/lib/minicron/hub/models/job.rb +3 -3
- data/lib/minicron/hub/models/schedule.rb +1 -1
- data/lib/minicron/hub/serializers/execution.rb +61 -57
- data/lib/minicron/hub/serializers/host.rb +49 -42
- data/lib/minicron/hub/serializers/job.rb +82 -78
- data/lib/minicron/hub/serializers/job_execution_output.rb +42 -38
- data/lib/minicron/hub/serializers/schedule.rb +56 -52
- data/lib/minicron/hub/views/handlebars/executions.erb +7 -1
- data/lib/minicron/hub/views/handlebars/hosts.erb +2 -2
- data/lib/minicron/hub/views/handlebars/schedules.erb +3 -3
- data/lib/minicron/monitor.rb +4 -4
- data/lib/minicron/transport/client.rb +6 -6
- data/lib/minicron/transport/faye/client.rb +4 -4
- data/lib/minicron/transport/faye/extensions/job_handler.rb +3 -2
- data/lib/minicron/transport/faye/server.rb +1 -0
- data/lib/minicron/transport/server.rb +2 -2
- data/lib/minicron/transport/ssh.rb +6 -8
- data/spec/minicron/cli_spec.rb +4 -4
- data/spec/minicron/transport/client_spec.rb +2 -2
- data/spec/minicron/transport/faye/client_spec.rb +7 -7
- data/spec/minicron/transport/server_spec.rb +1 -1
- data/spec/minicron_spec.rb +2 -1
- data/spec/valid_config.toml +1 -0
- metadata +16 -2
data/lib/minicron/constants.rb
CHANGED
data/lib/minicron/cron.rb
CHANGED
@@ -57,7 +57,7 @@ module Minicron
|
|
57
57
|
|
58
58
|
# Throw an exception if it failed
|
59
59
|
if update != 'y'
|
60
|
-
|
60
|
+
fail Exception, "Unable to replace '#{find}' with '#{replace}' in the crontab"
|
61
61
|
end
|
62
62
|
|
63
63
|
# If it's a delete
|
@@ -67,7 +67,7 @@ module Minicron
|
|
67
67
|
|
68
68
|
# Throw an exception if we can't see our new line at the end of the file
|
69
69
|
if grep != replace
|
70
|
-
|
70
|
+
fail Exception, "Expected to find nothing when grepping crontab but found #{grep}"
|
71
71
|
end
|
72
72
|
else
|
73
73
|
# Check the updated line is there
|
@@ -75,7 +75,7 @@ module Minicron
|
|
75
75
|
|
76
76
|
# Throw an exception if we can't see our new line at the end of the file
|
77
77
|
if grep != replace
|
78
|
-
|
78
|
+
fail Exception, "Expected to find '#{replace}' when grepping crontab but found #{grep}"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -83,7 +83,7 @@ module Minicron
|
|
83
83
|
move = conn.exec!("mv /etc/crontab.tmp /etc/crontab && echo 'y' || echo 'n'").to_s.strip
|
84
84
|
|
85
85
|
if move != 'y'
|
86
|
-
|
86
|
+
fail Exception, 'Unable to move tmp crontab with updated crontab'
|
87
87
|
end
|
88
88
|
end
|
89
89
|
|
@@ -105,7 +105,7 @@ module Minicron
|
|
105
105
|
|
106
106
|
# Throw an exception if it failed
|
107
107
|
if write != 'y'
|
108
|
-
|
108
|
+
fail Exception, "Unable to write '#{line}' to the crontab"
|
109
109
|
end
|
110
110
|
|
111
111
|
# Check the line is there
|
@@ -113,7 +113,7 @@ module Minicron
|
|
113
113
|
|
114
114
|
# Throw an exception if we can't see our new line at the end of the file
|
115
115
|
if tail != line
|
116
|
-
|
116
|
+
fail Exception, "Expected to find '#{line}' at eof but found '#{tail}'"
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
data/lib/minicron/hub/app.rb
CHANGED
@@ -84,15 +84,15 @@ module Minicron::Hub
|
|
84
84
|
# Configure the database
|
85
85
|
case Minicron.config['database']['type']
|
86
86
|
when 'mysql'
|
87
|
-
set :database,
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
87
|
+
set :database,
|
88
|
+
:adapter => 'mysql2',
|
89
|
+
:host => Minicron.config['database']['host'],
|
90
|
+
:database => Minicron.config['database']['database'],
|
91
|
+
:username => Minicron.config['database']['username'],
|
92
|
+
:password => Minicron.config['database']['password']
|
93
|
+
|
94
94
|
else
|
95
|
-
|
95
|
+
fail Exception, "The database #{Minicron.config['database']['type']} is not supported"
|
96
96
|
end
|
97
97
|
end
|
98
98
|
end
|
@@ -5,12 +5,13 @@
|
|
5
5
|
var confirmation = "Are you sure want to delete this execution?";
|
6
6
|
|
7
7
|
if (window.confirm(confirmation)) {
|
8
|
-
// TODO: Do the same cascading delete that happens on the backend
|
9
|
-
// i.e deleting this execution also deletes the job execution output
|
10
8
|
execution.deleteRecord();
|
11
9
|
|
12
10
|
execution.save().then(function() {
|
13
|
-
|
11
|
+
// This is needed to reload all the relationships correctly after a delete
|
12
|
+
// TODO: do this in a nicer way
|
13
|
+
window.location.hash = '/executions';
|
14
|
+
window.location.reload();
|
14
15
|
}, function(response) {
|
15
16
|
execution.rollback();
|
16
17
|
console.log(response);
|
@@ -6,13 +6,13 @@
|
|
6
6
|
confirmation += 'All associated data i.e jobs on this host and the jobs in this hosts crontab will be REMOVED!';
|
7
7
|
|
8
8
|
if (window.confirm(confirmation)) {
|
9
|
-
// TODO: Do the same cascading delete that happens on the backend
|
10
|
-
// i.e deleting jobs -> executions -> job_execution_outputs linked
|
11
|
-
// to this host
|
12
9
|
host.deleteRecord();
|
13
10
|
|
14
11
|
host.save().then(function() {
|
15
|
-
|
12
|
+
// This is needed to reload all the relationships correctly after a delete
|
13
|
+
// TODO: do this in a nicer way
|
14
|
+
window.location.hash = '/hosts';
|
15
|
+
window.location.reload();
|
16
16
|
}, function(response) {
|
17
17
|
host.rollback();
|
18
18
|
console.log(response);
|
@@ -6,13 +6,13 @@
|
|
6
6
|
confirmation += 'All associated data will be deleted and it will be REMOVED from the host!';
|
7
7
|
|
8
8
|
if (window.confirm(confirmation)) {
|
9
|
-
// TODO: Do the same cascading delete that happens on the backend
|
10
|
-
// i.e deleting jobs -> executions -> job_execution_outputs linked
|
11
|
-
// to this job
|
12
9
|
job.deleteRecord();
|
13
10
|
|
14
11
|
job.save().then(function() {
|
15
|
-
|
12
|
+
// This is needed to reload all the relationships correctly after a delete
|
13
|
+
// TODO: do this in a nicer way
|
14
|
+
window.location.hash = '/jobs';
|
15
|
+
window.location.reload();
|
16
16
|
}, function(response) {
|
17
17
|
job.rollback();
|
18
18
|
console.log(response);
|
@@ -8,7 +8,10 @@
|
|
8
8
|
schedule.deleteRecord();
|
9
9
|
|
10
10
|
schedule.save().then(function() {
|
11
|
-
|
11
|
+
// This is needed to reload all the relationships correctly after a delete
|
12
|
+
// TODO: do this in a nicer way
|
13
|
+
window.location.hash = '/jobs/' + job_id;
|
14
|
+
window.location.reload();
|
12
15
|
}, function(response) {
|
13
16
|
schedule.rollback();
|
14
17
|
console.log(response);
|
@@ -4,16 +4,16 @@ class Minicron::Hub::App
|
|
4
4
|
get '/api/executions' do
|
5
5
|
content_type :json
|
6
6
|
executions = Minicron::Hub::Execution.all.order(:created_at => :desc, :started_at => :desc)
|
7
|
-
.includes({:job => :host}, :job_execution_outputs)
|
8
|
-
ExecutionSerializer.new(executions).serialize.to_json
|
7
|
+
.includes({ :job => :host }, :job_execution_outputs)
|
8
|
+
Minicron::Hub::ExecutionSerializer.new(executions).serialize.to_json
|
9
9
|
end
|
10
10
|
|
11
11
|
# Get a single job execution by its ID
|
12
12
|
get '/api/executions/:id' do
|
13
13
|
content_type :json
|
14
|
-
execution = Minicron::Hub::Execution.includes({:job => :host}, :job_execution_outputs)
|
14
|
+
execution = Minicron::Hub::Execution.includes({ :job => :host }, :job_execution_outputs)
|
15
15
|
.find(params[:id])
|
16
|
-
ExecutionSerializer.new(execution).serialize.to_json
|
16
|
+
Minicron::Hub::ExecutionSerializer.new(execution).serialize.to_json
|
17
17
|
end
|
18
18
|
|
19
19
|
# Delete an existing execution
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'minicron'
|
1
2
|
require 'minicron/transport/ssh'
|
2
3
|
|
3
4
|
class Minicron::Hub::App
|
@@ -6,14 +7,14 @@ class Minicron::Hub::App
|
|
6
7
|
get '/api/hosts' do
|
7
8
|
content_type :json
|
8
9
|
hosts = Minicron::Hub::Host.all.includes(:jobs).order(:id => :asc)
|
9
|
-
HostSerializer.new(hosts).serialize.to_json
|
10
|
+
Minicron::Hub::HostSerializer.new(hosts).serialize.to_json
|
10
11
|
end
|
11
12
|
|
12
13
|
# Get a single host by its ID
|
13
14
|
get '/api/hosts/:id' do
|
14
15
|
content_type :json
|
15
16
|
host = Minicron::Hub::Host.includes(:jobs).find(params[:id])
|
16
|
-
HostSerializer.new(host).serialize.to_json
|
17
|
+
Minicron::Hub::HostSerializer.new(host).serialize.to_json
|
17
18
|
end
|
18
19
|
|
19
20
|
# Create a new host
|
@@ -23,6 +24,9 @@ class Minicron::Hub::App
|
|
23
24
|
# Load the JSON body
|
24
25
|
request_body = Oj.load(request.body)
|
25
26
|
|
27
|
+
# Default the value of the port
|
28
|
+
request_body['host']['port'] ||= 22
|
29
|
+
|
26
30
|
# Try and save the new host
|
27
31
|
host = Minicron::Hub::Host.create(
|
28
32
|
:name => request_body['host']['name'],
|
@@ -39,7 +43,7 @@ class Minicron::Hub::App
|
|
39
43
|
host.save!
|
40
44
|
|
41
45
|
# Return the new host
|
42
|
-
HostSerializer.new(host).serialize.to_json
|
46
|
+
Minicron::Hub::HostSerializer.new(host).serialize.to_json
|
43
47
|
# TODO: nicer error handling here with proper validation before hand
|
44
48
|
rescue Exception => e
|
45
49
|
status 422
|
@@ -57,6 +61,9 @@ class Minicron::Hub::App
|
|
57
61
|
# Find the host
|
58
62
|
host = Minicron::Hub::Host.includes(:jobs).find(params[:id])
|
59
63
|
|
64
|
+
# Default the value of the port
|
65
|
+
request_body['host']['port'] ||= 22
|
66
|
+
|
60
67
|
# Update its data
|
61
68
|
host.name = request_body['host']['name']
|
62
69
|
host.fqdn = request_body['host']['fqdn']
|
@@ -66,7 +73,7 @@ class Minicron::Hub::App
|
|
66
73
|
host.save!
|
67
74
|
|
68
75
|
# Return the new host
|
69
|
-
HostSerializer.new(host).serialize.to_json
|
76
|
+
Minicron::Hub::HostSerializer.new(host).serialize.to_json
|
70
77
|
# TODO: nicer error handling here with proper validation before hand
|
71
78
|
rescue Exception => e
|
72
79
|
status 422
|
@@ -80,7 +87,7 @@ class Minicron::Hub::App
|
|
80
87
|
begin
|
81
88
|
Minicron::Hub::Host.transaction do
|
82
89
|
# Look up the host
|
83
|
-
host = Minicron::Hub::Host.includes(
|
90
|
+
host = Minicron::Hub::Host.includes(:jobs => :schedules).find(params[:id])
|
84
91
|
|
85
92
|
# Try and delete the host
|
86
93
|
Minicron::Hub::Host.destroy(params[:id])
|
@@ -101,6 +108,12 @@ class Minicron::Hub::App
|
|
101
108
|
# Tidy up
|
102
109
|
ssh.close
|
103
110
|
|
111
|
+
# Delete the pub/priv key pair
|
112
|
+
private_key_path = Minicron.sanitize_filename(File.expand_path("~/.ssh/minicron_host_#{host.id}_rsa"))
|
113
|
+
public_key_path = Minicron.sanitize_filename(File.expand_path("~/.ssh/minicron_host_#{host.id}_rsa.pub"))
|
114
|
+
File.delete(private_key_path)
|
115
|
+
File.delete(public_key_path)
|
116
|
+
|
104
117
|
# This is what ember expects as the response
|
105
118
|
status 204
|
106
119
|
end
|
@@ -16,7 +16,7 @@ class Minicron::Hub::App
|
|
16
16
|
output = Minicron::Hub::JobExecutionOutput.all.order(:id => :asc)
|
17
17
|
end
|
18
18
|
|
19
|
-
JobExecutionOutputSerializer.new(output).serialize.to_json
|
19
|
+
Minicron::Hub::JobExecutionOutputSerializer.new(output).serialize.to_json
|
20
20
|
end
|
21
21
|
|
22
22
|
# Get a single job execution output by it ID
|
@@ -25,6 +25,6 @@ class Minicron::Hub::App
|
|
25
25
|
output = Minicron::Hub::JobExecutionOutput.includes(:execution)
|
26
26
|
.order(:id => :asc)
|
27
27
|
.find(params[:id])
|
28
|
-
JobExecutionOutputSerializer.new(output).serialize.to_json
|
28
|
+
Minicron::Hub::JobExecutionOutputSerializer.new(output).serialize.to_json
|
29
29
|
end
|
30
30
|
end
|
@@ -7,22 +7,22 @@ class Minicron::Hub::App
|
|
7
7
|
content_type :json
|
8
8
|
|
9
9
|
if params[:job_hash]
|
10
|
-
jobs = Minicron::Hub::Job.includes(:host, :schedules,
|
10
|
+
jobs = Minicron::Hub::Job.includes(:host, :schedules, :executions => :job_execution_outputs)
|
11
11
|
.where(:job_hash => params[:job_hash])
|
12
12
|
else
|
13
13
|
jobs = Minicron::Hub::Job.all.order(:created_at => :desc)
|
14
|
-
.includes(:host, :schedules,
|
14
|
+
.includes(:host, :schedules, :executions => :job_execution_outputs)
|
15
15
|
end
|
16
16
|
|
17
|
-
JobSerializer.new(jobs).serialize.to_json
|
17
|
+
Minicron::Hub::JobSerializer.new(jobs).serialize.to_json
|
18
18
|
end
|
19
19
|
|
20
20
|
# Get a single job by it ID
|
21
21
|
get '/api/jobs/:id' do
|
22
22
|
content_type :json
|
23
|
-
job = Minicron::Hub::Job.includes(:host, :schedules,
|
23
|
+
job = Minicron::Hub::Job.includes(:host, :schedules, :executions => :job_execution_outputs)
|
24
24
|
.find(params[:id])
|
25
|
-
JobSerializer.new(job).serialize.to_json
|
25
|
+
Minicron::Hub::JobSerializer.new(job).serialize.to_json
|
26
26
|
end
|
27
27
|
|
28
28
|
# Create a new job
|
@@ -46,7 +46,7 @@ class Minicron::Hub::App
|
|
46
46
|
job.save!
|
47
47
|
|
48
48
|
# Return the new job
|
49
|
-
JobSerializer.new(job).serialize.to_json
|
49
|
+
Minicron::Hub::JobSerializer.new(job).serialize.to_json
|
50
50
|
# TODO: nicer error handling here with proper validation before hand
|
51
51
|
rescue Exception => e
|
52
52
|
status 422
|
@@ -62,7 +62,7 @@ class Minicron::Hub::App
|
|
62
62
|
request_body = Oj.load(request.body)
|
63
63
|
|
64
64
|
# Find the job
|
65
|
-
job = Minicron::Hub::Job.includes(:host, :schedules,
|
65
|
+
job = Minicron::Hub::Job.includes(:host, :schedules, :executions => :job_execution_outputs)
|
66
66
|
.find(params[:id])
|
67
67
|
|
68
68
|
# Update the name
|
@@ -71,7 +71,7 @@ class Minicron::Hub::App
|
|
71
71
|
job.save!
|
72
72
|
|
73
73
|
# Return the new job
|
74
|
-
JobSerializer.new(job).serialize.to_json
|
74
|
+
Minicron::Hub::JobSerializer.new(job).serialize.to_json
|
75
75
|
# TODO: nicer error handling here with proper validation before hand
|
76
76
|
rescue Exception => e
|
77
77
|
status 422
|
@@ -10,20 +10,20 @@ class Minicron::Hub::App
|
|
10
10
|
if params[:ids]
|
11
11
|
schedules = Minicron::Hub::Schedule.where(:id => params[:ids])
|
12
12
|
.order(:id => :asc)
|
13
|
-
.includes(
|
13
|
+
.includes(:job => [:executions, :schedules])
|
14
14
|
else
|
15
15
|
schedules = Minicron::Hub::Schedule.all.order(:id => :asc)
|
16
|
-
.includes(
|
16
|
+
.includes(:job => [:executions, :schedules])
|
17
17
|
end
|
18
18
|
|
19
|
-
ScheduleSerializer.new(schedules).serialize.to_json
|
19
|
+
Minicron::Hub::ScheduleSerializer.new(schedules).serialize.to_json
|
20
20
|
end
|
21
21
|
|
22
22
|
# Get a single schedule by it ID
|
23
23
|
get '/api/schedules/:id' do
|
24
24
|
content_type :json
|
25
|
-
schedule = Minicron::Hub::Schedule.includes(
|
26
|
-
ScheduleSerializer.new(schedule).serialize.to_json
|
25
|
+
schedule = Minicron::Hub::Schedule.includes(:job => [:executions, :schedules]).find(params[:id])
|
26
|
+
Minicron::Hub::ScheduleSerializer.new(schedule).serialize.to_json
|
27
27
|
end
|
28
28
|
|
29
29
|
# Create a new schedule
|
@@ -45,7 +45,7 @@ class Minicron::Hub::App
|
|
45
45
|
)
|
46
46
|
|
47
47
|
if exists
|
48
|
-
|
48
|
+
fail Exception, 'That schedule already exists for this job'
|
49
49
|
end
|
50
50
|
|
51
51
|
Minicron::Hub::Schedule.transaction do
|
@@ -83,7 +83,7 @@ class Minicron::Hub::App
|
|
83
83
|
schedule.save!
|
84
84
|
|
85
85
|
# Return the new schedule
|
86
|
-
ScheduleSerializer.new(schedule).serialize.to_json
|
86
|
+
Minicron::Hub::ScheduleSerializer.new(schedule).serialize.to_json
|
87
87
|
end
|
88
88
|
# TODO: nicer error handling here with proper validation before hand
|
89
89
|
rescue Exception => e
|
@@ -101,7 +101,7 @@ class Minicron::Hub::App
|
|
101
101
|
|
102
102
|
Minicron::Hub::Schedule.transaction do
|
103
103
|
# Find the schedule
|
104
|
-
schedule = Minicron::Hub::Schedule.includes(
|
104
|
+
schedule = Minicron::Hub::Schedule.includes(:job => [:executions, :schedules]).find(params[:id])
|
105
105
|
old_schedule = schedule.formatted
|
106
106
|
|
107
107
|
# Get an ssh instance
|
@@ -136,7 +136,7 @@ class Minicron::Hub::App
|
|
136
136
|
schedule.save!
|
137
137
|
|
138
138
|
# Return the new schedule
|
139
|
-
ScheduleSerializer.new(schedule).serialize.to_json
|
139
|
+
Minicron::Hub::ScheduleSerializer.new(schedule).serialize.to_json
|
140
140
|
end
|
141
141
|
# TODO: nicer error handling here with proper validation before hand
|
142
142
|
rescue Exception => e
|
@@ -151,7 +151,7 @@ class Minicron::Hub::App
|
|
151
151
|
begin
|
152
152
|
Minicron::Hub::Schedule.transaction do
|
153
153
|
# Find the schedule
|
154
|
-
schedule = Minicron::Hub::Schedule.includes(
|
154
|
+
schedule = Minicron::Hub::Schedule.includes(:job => :host).find(params[:id])
|
155
155
|
|
156
156
|
# Try and delete the schedule
|
157
157
|
Minicron::Hub::Schedule.destroy(params[:id])
|
@@ -12,87 +12,92 @@
|
|
12
12
|
|
13
13
|
ActiveRecord::Schema.define(version: 0) do
|
14
14
|
|
15
|
-
create_table
|
16
|
-
t.integer
|
17
|
-
t.integer
|
18
|
-
t.string
|
19
|
-
t.datetime
|
20
|
-
t.string
|
21
|
-
t.datetime
|
15
|
+
create_table 'alerts', force: true do |t|
|
16
|
+
t.integer 'schedule_id'
|
17
|
+
t.integer 'execution_id'
|
18
|
+
t.string 'kind', limit: 4, default: '', null: false
|
19
|
+
t.datetime 'expected_at'
|
20
|
+
t.string 'medium', limit: 9, default: '', null: false
|
21
|
+
t.datetime 'sent_at', null: false
|
22
22
|
end
|
23
23
|
|
24
|
-
add_index
|
25
|
-
add_index
|
26
|
-
add_index
|
27
|
-
add_index
|
28
|
-
add_index
|
24
|
+
add_index 'alerts', ['execution_id'], name: 'execution_id', using: :btree
|
25
|
+
add_index 'alerts', ['expected_at'], name: 'expected_at', using: :btree
|
26
|
+
add_index 'alerts', ['kind'], name: 'kind', using: :btree
|
27
|
+
add_index 'alerts', ['medium'], name: 'medium', using: :btree
|
28
|
+
add_index 'alerts', ['schedule_id'], name: 'schedule_id', using: :btree
|
29
29
|
|
30
|
-
create_table
|
31
|
-
t.integer
|
32
|
-
t.datetime
|
33
|
-
t.datetime
|
34
|
-
t.datetime
|
35
|
-
t.integer
|
30
|
+
create_table 'executions', force: true do |t|
|
31
|
+
t.integer 'job_id', null: false
|
32
|
+
t.datetime 'created_at', null: false
|
33
|
+
t.datetime 'started_at'
|
34
|
+
t.datetime 'finished_at'
|
35
|
+
t.integer 'exit_status'
|
36
36
|
end
|
37
37
|
|
38
|
-
add_index
|
39
|
-
add_index
|
40
|
-
add_index
|
41
|
-
add_index
|
38
|
+
add_index 'executions', ['created_at'], name: 'created_at', using: :btree
|
39
|
+
add_index 'executions', ['finished_at'], name: 'finished_at', using: :btree
|
40
|
+
add_index 'executions', ['job_id'], name: 'job_id', using: :btree
|
41
|
+
add_index 'executions', ['started_at'], name: 'started_at', using: :btree
|
42
42
|
|
43
|
-
create_table
|
44
|
-
t.string
|
45
|
-
t.string
|
46
|
-
t.string
|
47
|
-
t.integer
|
48
|
-
t.text
|
49
|
-
t.datetime
|
50
|
-
t.datetime
|
43
|
+
create_table 'hosts', force: true do |t|
|
44
|
+
t.string 'name'
|
45
|
+
t.string 'fqdn', default: '', null: false
|
46
|
+
t.string 'host', default: '', null: false
|
47
|
+
t.integer 'port', null: false
|
48
|
+
t.text 'public_key'
|
49
|
+
t.datetime 'created_at', null: false
|
50
|
+
t.datetime 'updated_at', null: false
|
51
51
|
end
|
52
52
|
|
53
|
-
add_index
|
53
|
+
add_index 'hosts', ['fqdn'], name: 'hostname', using: :btree
|
54
54
|
|
55
|
-
create_table
|
56
|
-
t.integer
|
57
|
-
t.integer
|
58
|
-
t.text
|
59
|
-
t.datetime
|
55
|
+
create_table 'job_execution_outputs', force: true do |t|
|
56
|
+
t.integer 'execution_id', null: false
|
57
|
+
t.integer 'seq', null: false
|
58
|
+
t.text 'output', null: false
|
59
|
+
t.datetime 'timestamp', null: false
|
60
60
|
end
|
61
61
|
|
62
|
-
add_index
|
63
|
-
add_index
|
62
|
+
add_index 'job_execution_outputs', ['execution_id'], name: 'execution_id', using: :btree
|
63
|
+
add_index 'job_execution_outputs', ['seq'], name: 'seq', using: :btree
|
64
64
|
|
65
|
-
create_table
|
66
|
-
t.string
|
67
|
-
t.string
|
68
|
-
t.text
|
69
|
-
t.integer
|
70
|
-
t.datetime
|
71
|
-
t.datetime
|
65
|
+
create_table 'jobs', force: true do |t|
|
66
|
+
t.string 'job_hash', limit: 32, default: '', null: false
|
67
|
+
t.string 'name'
|
68
|
+
t.text 'command', null: false
|
69
|
+
t.integer 'host_id', null: false
|
70
|
+
t.datetime 'created_at', null: false
|
71
|
+
t.datetime 'updated_at', null: false
|
72
72
|
end
|
73
73
|
|
74
|
-
add_index
|
75
|
-
add_index
|
76
|
-
add_index
|
74
|
+
add_index 'jobs', ['created_at'], name: 'created_at', using: :btree
|
75
|
+
add_index 'jobs', ['host_id'], name: 'host_id', using: :btree
|
76
|
+
add_index 'jobs', ['job_hash'], name: 'job_hash', unique: true, using: :btree
|
77
77
|
|
78
|
-
create_table
|
79
|
-
t.integer
|
80
|
-
t.string
|
81
|
-
t.string
|
82
|
-
t.string
|
83
|
-
t.string
|
84
|
-
t.string
|
85
|
-
t.string
|
86
|
-
t.datetime
|
87
|
-
t.datetime
|
78
|
+
create_table 'schedules', force: true do |t|
|
79
|
+
t.integer 'job_id', null: false
|
80
|
+
t.string 'minute', limit: 179
|
81
|
+
t.string 'hour', limit: 71
|
82
|
+
t.string 'day_of_the_month', limit: 92
|
83
|
+
t.string 'month', limit: 25
|
84
|
+
t.string 'day_of_the_week', limit: 20
|
85
|
+
t.string 'special', limit: 9
|
86
|
+
t.datetime 'created_at', null: false
|
87
|
+
t.datetime 'updated_at', null: false
|
88
88
|
end
|
89
89
|
|
90
|
-
add_index
|
91
|
-
add_index
|
92
|
-
add_index
|
93
|
-
add_index
|
94
|
-
add_index
|
95
|
-
add_index
|
96
|
-
add_index
|
90
|
+
add_index 'schedules', ['day_of_the_month'], name: 'day_of_the_month', using: :btree
|
91
|
+
add_index 'schedules', ['day_of_the_week'], name: 'day_of_the_week', using: :btree
|
92
|
+
add_index 'schedules', ['hour'], name: 'hour', using: :btree
|
93
|
+
add_index 'schedules', ['job_id'], name: 'job_id', using: :btree
|
94
|
+
add_index 'schedules', ['minute'], name: 'minute', using: :btree
|
95
|
+
add_index 'schedules', ['month'], name: 'month', using: :btree
|
96
|
+
add_index 'schedules', ['special'], name: 'special', using: :btree
|
97
|
+
|
98
|
+
create_table 'users', force: true do |t|
|
99
|
+
t.integer 'email', null: false
|
100
|
+
t.integer 'password', null: false
|
101
|
+
end
|
97
102
|
|
98
103
|
end
|