smartmachine 0.7.0 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/scheduler +18 -0
- data/bin/smartrunner +5 -0
- data/lib/smart_machine/boot.rb +1 -0
- data/lib/smart_machine/engine/Dockerfile +1 -0
- data/lib/smart_machine/gem_version.rb +1 -1
- data/lib/smart_machine/grids.rb +4 -1
- data/lib/smart_machine/grids/mysql.rb +139 -2
- data/lib/smart_machine/grids/scheduler.rb +188 -0
- data/lib/smart_machine/grids/scheduler/Dockerfile +14 -0
- data/lib/smart_machine/machine.rb +5 -0
- data/lib/smart_machine/sync.rb +12 -0
- data/lib/smart_machine/templates/dotsmartmachine/config/mysql/schedule.rb +19 -0
- data/lib/smart_machine/templates/dotsmartmachine/grids/mysql/backups/.keep +0 -0
- data/lib/smart_machine/templates/dotsmartmachine/grids/scheduler/crontabs/.keep +0 -0
- metadata +25 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abf46cdee1bfbf5a35837643f766eed7a83a824e04247cd2cb8a09af34dc6752
|
4
|
+
data.tar.gz: f51cc20363a52e15ba30f628d8dafd9897a15f9d5d4252e8bbf4d7af1d012282
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc1429cc9ad3bfb04741487b3620f17a5e103af6d817463631cabd9f6aacd85ad0d5921f3bb98275444f24bf78ead7e9c35c7eb17f4282c55946ebdc1e555039
|
7
|
+
data.tar.gz: 67879fc2681d7d32129795d7e8b60519997dfed8a40a60c174a2c7d19573e61b46b821fe80e0de7991fd8587451ddc983c865a6d7b1d161f3fd975b9593c55b3
|
data/bin/scheduler
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'smart_machine'
|
4
|
+
|
5
|
+
command = ARGV.shift
|
6
|
+
|
7
|
+
scheduler = SmartMachine::Grids::Scheduler.new
|
8
|
+
|
9
|
+
case command
|
10
|
+
when "start"
|
11
|
+
action = ARGV.shift
|
12
|
+
scheduler.mysql("start") if action == "--mysql"
|
13
|
+
|
14
|
+
when "stop"
|
15
|
+
action = ARGV.shift
|
16
|
+
scheduler.mysql("stop") if action == "--mysql"
|
17
|
+
|
18
|
+
end
|
data/bin/smartrunner
CHANGED
@@ -25,4 +25,9 @@ when "prereceiver"
|
|
25
25
|
prereceiver = SmartMachine::Grids::Prereceiver.new
|
26
26
|
prereceiver.public_send(action, *ARGV)
|
27
27
|
|
28
|
+
when "scheduler"
|
29
|
+
action = ARGV.shift
|
30
|
+
scheduler = SmartMachine::Grids::Scheduler.new
|
31
|
+
scheduler.public_send(action, *ARGV)
|
32
|
+
|
28
33
|
end
|
data/lib/smart_machine/boot.rb
CHANGED
@@ -24,6 +24,7 @@ require 'smart_machine/grids/minio'
|
|
24
24
|
require 'smart_machine/grids/mysql'
|
25
25
|
require 'smart_machine/grids/nginx'
|
26
26
|
require 'smart_machine/grids/prereceiver'
|
27
|
+
require 'smart_machine/grids/scheduler'
|
27
28
|
require 'smart_machine/grids/solr'
|
28
29
|
|
29
30
|
require 'smart_machine/apps'
|
data/lib/smart_machine/grids.rb
CHANGED
@@ -7,7 +7,10 @@ module SmartMachine
|
|
7
7
|
grid_name = args.shift
|
8
8
|
action = args.shift
|
9
9
|
|
10
|
-
|
10
|
+
valid_actions = ['up', 'down']
|
11
|
+
valid_actions.push(*['backup', 'flushlogs']) if grid_name == 'mysql'
|
12
|
+
valid_actions.push(*["start", "stop"]) if grid_name == 'scheduler'
|
13
|
+
raise "invalid action on the grid #{grid_name}" unless valid_actions.include? action
|
11
14
|
|
12
15
|
Object.const_get("SmartMachine::Grids::#{grid_name.capitalize}").new.public_send(action, *args)
|
13
16
|
end
|
@@ -21,7 +21,7 @@ module SmartMachine
|
|
21
21
|
# Creating & Starting containers
|
22
22
|
print "-----> Creating container mysql ... "
|
23
23
|
if system("docker create \
|
24
|
-
--name='
|
24
|
+
--name='#{container_name}' \
|
25
25
|
--env MYSQL_ROOT_PASSWORD=#{SmartMachine.credentials.mysql[:root_password]} \
|
26
26
|
--env MYSQL_USER=#{SmartMachine.credentials.mysql[:username]} \
|
27
27
|
--env MYSQL_PASSWORD=#{SmartMachine.credentials.mysql[:password]} \
|
@@ -60,7 +60,144 @@ module SmartMachine
|
|
60
60
|
puts "done"
|
61
61
|
end
|
62
62
|
end
|
63
|
-
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# Flushing logs
|
66
|
+
def flushlogs(*args)
|
67
|
+
print "-----> Flushing logs for #{container_name} ... "
|
68
|
+
if system("docker exec #{container_name} sh -c \
|
69
|
+
'exec mysqladmin \
|
70
|
+
--user=root \
|
71
|
+
--password=#{SmartMachine.credentials.mysql[:root_password]} \
|
72
|
+
flush-logs'")
|
73
|
+
|
74
|
+
puts "done"
|
75
|
+
else
|
76
|
+
puts "error"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Create backup using the grids backup command
|
81
|
+
def backup(*args)
|
82
|
+
args.flatten!
|
83
|
+
type = args.empty? ? '--snapshot' : args.shift
|
84
|
+
|
85
|
+
if type == "--daily"
|
86
|
+
run_backup(type: "daily")
|
87
|
+
elsif type == "--promote-to-weekly"
|
88
|
+
run_backup(type: "weekly")
|
89
|
+
elsif type == "--snapshot"
|
90
|
+
run_backup(type: "snapshot")
|
91
|
+
elsif type == "--transfer"
|
92
|
+
transfer_backups_to_external_storage
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
# Transfer all current backups to external storage
|
99
|
+
def transfer_backups_to_external_storage
|
100
|
+
end
|
101
|
+
|
102
|
+
def run_backup(type:)
|
103
|
+
FileUtils.mkdir_p("#{backups_path}/#{type}")
|
104
|
+
|
105
|
+
unless type == "weekly"
|
106
|
+
standard_backup(type: type)
|
107
|
+
else
|
108
|
+
weekly_backup_from_latest_daily
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def restore(type:, version:)
|
113
|
+
printf "Are you sure you want to do this? It will destroy/overwrite all the current databases? Type 'YES' and press enter to continue: ".red
|
114
|
+
prompt = STDIN.gets.chomp
|
115
|
+
return unless prompt == 'YES'
|
116
|
+
|
117
|
+
print "-----> Restoring the backup of all databases with version #{version} (without binlogs) in #{container_name} ... "
|
118
|
+
if system("docker exec -i #{container_name} sh -c \
|
119
|
+
'exec xz < #{backups_path}/#{type}/#{version}.sql.xz \
|
120
|
+
| mysql \
|
121
|
+
--user=root \
|
122
|
+
--password=#{SmartMachine.credentials.mysql[:root_password]}")
|
123
|
+
|
124
|
+
puts "done"
|
125
|
+
else
|
126
|
+
puts "error... check data & try again"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
# Create a standard backup
|
131
|
+
def standard_backup(type:)
|
132
|
+
# Note: There should be no space between + and " in version.
|
133
|
+
# Note: date will be UTC date until timezone has been changed.
|
134
|
+
version = `date +"%Y%m%d%H%M%S"`.chomp!
|
135
|
+
backup_version_file = "#{version}.sql.xz"
|
136
|
+
|
137
|
+
print "-----> Creating #{type} backup of all databases with backup version file #{backup_version_file} in #{container_name} ... "
|
138
|
+
if system("docker exec #{container_name} sh -c \
|
139
|
+
'exec mysqldump \
|
140
|
+
--user=root \
|
141
|
+
--password=#{SmartMachine.credentials.mysql[:root_password]} \
|
142
|
+
--all-databases \
|
143
|
+
--single-transaction \
|
144
|
+
--flush-logs \
|
145
|
+
--master-data=2 \
|
146
|
+
--events \
|
147
|
+
--routines \
|
148
|
+
--triggers' \
|
149
|
+
| xz -9 > #{backups_path}/#{type}/#{backup_version_file}")
|
150
|
+
|
151
|
+
puts "done"
|
152
|
+
|
153
|
+
clean_up(type: type)
|
154
|
+
else
|
155
|
+
puts "error... check data & try again"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Copy weekly backup from the daily backup
|
160
|
+
def weekly_backup_from_latest_daily
|
161
|
+
Dir.chdir("#{backups_path}/daily") do
|
162
|
+
backup_versions = Dir.glob('*').sort
|
163
|
+
backup_version = backup_versions.last
|
164
|
+
|
165
|
+
if backup_version
|
166
|
+
print "-----> Creating weekly backup from daily backup version file #{backup_version} ... "
|
167
|
+
system("cp ./#{backup_version} ../weekly/#{backup_version}")
|
168
|
+
puts "done"
|
169
|
+
|
170
|
+
clean_up(type: "weekly")
|
171
|
+
else
|
172
|
+
puts "-----> Could not find daily backup to copy to weekly ... error"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
# Clean up very old versions
|
178
|
+
def clean_up(type:)
|
179
|
+
keep_releases = { snapshot: 2, daily: 7, weekly: 3 }
|
180
|
+
|
181
|
+
Dir.chdir("#{backups_path}/#{type}") do
|
182
|
+
backup_versions = Dir.glob('*').sort
|
183
|
+
destroy_count = backup_versions.count - keep_releases[type.to_sym]
|
184
|
+
if destroy_count > 0
|
185
|
+
print "Deleting older #{type} backups ... "
|
186
|
+
destroy_count.times do
|
187
|
+
FileUtils.rm_r(File.join(Dir.pwd, backup_versions.shift))
|
188
|
+
end
|
189
|
+
puts "done"
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
def backups_path
|
195
|
+
"#{SmartMachine.config.user_home_path}/.smartmachine/grids/mysql/backups"
|
196
|
+
end
|
197
|
+
|
198
|
+
def container_name
|
199
|
+
"mysql"
|
200
|
+
end
|
64
201
|
end
|
65
202
|
end
|
66
203
|
end
|
@@ -0,0 +1,188 @@
|
|
1
|
+
# The main SmartMachine Grids Scheduler driver
|
2
|
+
module SmartMachine
|
3
|
+
class Grids
|
4
|
+
class Scheduler < SmartMachine::Base
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
end
|
8
|
+
|
9
|
+
def install
|
10
|
+
puts "-----> Installing Scheduler"
|
11
|
+
|
12
|
+
ssh = SmartMachine::SSH.new
|
13
|
+
commands = ["smartmachine runner scheduler create"]
|
14
|
+
ssh.run commands
|
15
|
+
|
16
|
+
puts "-----> Scheduler Installation Complete"
|
17
|
+
end
|
18
|
+
|
19
|
+
def uninstall
|
20
|
+
puts "-----> Uninstalling Scheduler"
|
21
|
+
|
22
|
+
ssh = SmartMachine::SSH.new
|
23
|
+
commands = ["smartmachine runner scheduler destroy"]
|
24
|
+
ssh.run commands
|
25
|
+
|
26
|
+
puts "-----> Scheduler Uninstallation Complete"
|
27
|
+
end
|
28
|
+
|
29
|
+
def update
|
30
|
+
uninstall
|
31
|
+
install
|
32
|
+
end
|
33
|
+
|
34
|
+
def create
|
35
|
+
unless system("docker image inspect #{scheduler_image_name}", [:out, :err] => File::NULL)
|
36
|
+
print "-----> Creating image #{scheduler_image_name} ... "
|
37
|
+
if system("docker image build -t #{scheduler_image_name} \
|
38
|
+
--build-arg SMARTMACHINE_VERSION=#{SmartMachine.version} \
|
39
|
+
#{SmartMachine.config.root_path}/lib/smart_machine/grids/scheduler", out: File::NULL)
|
40
|
+
puts "done"
|
41
|
+
|
42
|
+
up
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def destroy
|
48
|
+
down
|
49
|
+
|
50
|
+
if system("docker image inspect #{scheduler_image_name}", [:out, :err] => File::NULL)
|
51
|
+
print "-----> Removing image #{scheduler_image_name} ... "
|
52
|
+
if system("docker image rm #{scheduler_image_name}", out: File::NULL)
|
53
|
+
puts "done"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def up
|
59
|
+
if SmartMachine::Docker.running?
|
60
|
+
if system("docker image inspect #{scheduler_image_name}", [:out, :err] => File::NULL)
|
61
|
+
print "-----> Creating container scheduler with image #{scheduler_image_name} ... "
|
62
|
+
if system("docker create \
|
63
|
+
--name='scheduler' \
|
64
|
+
--env MAILTO=#{SmartMachine.config.sysadmin_email} \
|
65
|
+
--user `id -u` \
|
66
|
+
--workdir /home/`id -un`/.smartmachine \
|
67
|
+
--volume='#{SmartMachine.config.user_home_path}/.smartmachine/config:#{SmartMachine.config.user_home_path}/.smartmachine/config' \
|
68
|
+
--volume='#{SmartMachine.config.user_home_path}/.smartmachine/grids/scheduler:#{SmartMachine.config.user_home_path}/.smartmachine/grids/scheduler' \
|
69
|
+
--volume='#{SmartMachine.config.user_home_path}/.smartmachine/bin/smartmachine.sh:/usr/local/bundle/bin/smartmachine' \
|
70
|
+
--volume='/var/run/docker.sock:/var/run/docker.sock:ro' \
|
71
|
+
--restart='always' \
|
72
|
+
#{scheduler_image_name}", out: File::NULL)
|
73
|
+
puts "done"
|
74
|
+
|
75
|
+
print "-----> Starting container scheduler with image #{scheduler_image_name} ... "
|
76
|
+
if system("docker start scheduler", out: File::NULL)
|
77
|
+
puts "done"
|
78
|
+
|
79
|
+
restore_crontabs
|
80
|
+
else
|
81
|
+
puts "error"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def down
|
89
|
+
if SmartMachine::Docker.running?
|
90
|
+
# Stopping & Removing containers - in reverse order
|
91
|
+
if system("docker inspect -f '{{.State.Running}}' 'scheduler'", [:out, :err] => File::NULL)
|
92
|
+
print "-----> Stopping container scheduler with image #{scheduler_image_name} ... "
|
93
|
+
if system("docker stop 'scheduler'", out: File::NULL)
|
94
|
+
puts "done"
|
95
|
+
|
96
|
+
print "-----> Removing container scheduler with image #{scheduler_image_name} ... "
|
97
|
+
if system("docker rm 'scheduler'", out: File::NULL)
|
98
|
+
puts "done"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
else
|
102
|
+
puts "-----> Container 'scheduler' is currently not running."
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def start(*args)
|
109
|
+
args.flatten!
|
110
|
+
type = args.empty? ? '--all' : args.shift
|
111
|
+
|
112
|
+
self.class.running!
|
113
|
+
|
114
|
+
if type == '--mysql'
|
115
|
+
system("docker exec -i scheduler sh -c 'exec scheduler start --mysql'")
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
def stop(*args)
|
120
|
+
args.flatten!
|
121
|
+
type = args.empty? ? '--all' : args.shift
|
122
|
+
|
123
|
+
self.class.running!
|
124
|
+
|
125
|
+
if type == '--mysql'
|
126
|
+
system("docker exec -i scheduler sh -c 'exec scheduler stop --mysql'")
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
def mysql(*args)
|
131
|
+
args.flatten!
|
132
|
+
action = args.empty? ? '' : args.shift
|
133
|
+
|
134
|
+
return unless ['start', 'stop'].include? action
|
135
|
+
|
136
|
+
command = "whenever --set 'output=#{SmartMachine.config.user_home_path}/.smartmachine/grids/scheduler/crontabs/crontabs.log' --load-file #{SmartMachine.config.user_home_path}/.smartmachine/config/mysql/schedule.rb"
|
137
|
+
|
138
|
+
if action == 'start'
|
139
|
+
command += " --update-crontab"
|
140
|
+
action_text = "Starting"
|
141
|
+
elsif action == 'stop'
|
142
|
+
command += " --clear-crontab"
|
143
|
+
action_text = "Stopping"
|
144
|
+
end
|
145
|
+
|
146
|
+
print "-----> #{action_text} automatic backup schedule for mysql ... "
|
147
|
+
if system(command, out: File::NULL)
|
148
|
+
puts "done"
|
149
|
+
else
|
150
|
+
puts "error"
|
151
|
+
end
|
152
|
+
ensure
|
153
|
+
backup_crontabs
|
154
|
+
end
|
155
|
+
|
156
|
+
def scheduler_image_name
|
157
|
+
"smartmachine/scheduler:#{SmartMachine.version}"
|
158
|
+
end
|
159
|
+
|
160
|
+
def restore_crontabs
|
161
|
+
if system("docker exec scheduler sh -c 'exec test -f #{SmartMachine.config.user_home_path}/.smartmachine/grids/scheduler/crontabs/`id -un`'")
|
162
|
+
print "-----> Restoring latest crontabs ... "
|
163
|
+
|
164
|
+
if system("docker exec scheduler sh -c 'exec crontab - < #{SmartMachine.config.user_home_path}/.smartmachine/grids/scheduler/crontabs/`id -un`'")
|
165
|
+
puts "done"
|
166
|
+
else
|
167
|
+
puts "error"
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def backup_crontabs
|
173
|
+
print "-----> Backing up latest crontabs ... "
|
174
|
+
if system("crontab -l > #{SmartMachine.config.user_home_path}/.smartmachine/grids/scheduler/crontabs/`id -un`", out: File::NULL)
|
175
|
+
puts "done"
|
176
|
+
else
|
177
|
+
puts "error"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
def self.running!
|
182
|
+
unless system("docker inspect -f '{{.State.Running}}' 'scheduler'", [:out, :err] => File::NULL)
|
183
|
+
raise "Scheduler is not running. Please start scheduler before scheduling"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
ARG SMARTMACHINE_VERSION
|
2
|
+
|
3
|
+
FROM smartmachine:$SMARTMACHINE_VERSION
|
4
|
+
LABEL maintainer="Timeboard <hello@timeboard.me>"
|
5
|
+
|
6
|
+
# Scheduler Essentials
|
7
|
+
RUN apk add --update busybox-suid && \
|
8
|
+
apk add --update bash && \
|
9
|
+
rm -rf /var/cache/apk/*
|
10
|
+
|
11
|
+
# Gems
|
12
|
+
RUN gem install whenever -v 1.0.0
|
13
|
+
|
14
|
+
CMD ["crond", "-f", "-l", "0", "-L", "/dev/stdout"]
|
@@ -64,6 +64,11 @@ module SmartMachine
|
|
64
64
|
prereceiver.public_send(action)
|
65
65
|
end
|
66
66
|
|
67
|
+
if args.empty? || args.include?("scheduler")
|
68
|
+
scheduler = SmartMachine::Grids::Scheduler.new
|
69
|
+
scheduler.public_send(action)
|
70
|
+
end
|
71
|
+
|
67
72
|
if args.empty? || args.include?("elasticsearch")
|
68
73
|
elasticsearch = SmartMachine::Grids::Elasticsearch.new
|
69
74
|
elasticsearch.public_send(action)
|
data/lib/smart_machine/sync.rb
CHANGED
@@ -43,11 +43,15 @@ module SmartMachine
|
|
43
43
|
'grids/minio/data/***',
|
44
44
|
|
45
45
|
'grids/mysql',
|
46
|
+
'grids/mysql/backups/***',
|
46
47
|
'grids/mysql/data/***',
|
47
48
|
|
48
49
|
'grids/nginx',
|
49
50
|
'grids/nginx/certificates/***',
|
50
51
|
|
52
|
+
'grids/scheduler',
|
53
|
+
'grids/scheduler/crontabs/***',
|
54
|
+
|
51
55
|
'grids/solr',
|
52
56
|
'grids/solr/solr/***',
|
53
57
|
]
|
@@ -63,6 +67,8 @@ module SmartMachine
|
|
63
67
|
'apps/repositories/.keep',
|
64
68
|
|
65
69
|
'config',
|
70
|
+
'config/mysql',
|
71
|
+
'config/mysql/schedule.rb',
|
66
72
|
'config/credentials.yml.enc',
|
67
73
|
'config/environment.rb',
|
68
74
|
|
@@ -79,6 +85,8 @@ module SmartMachine
|
|
79
85
|
'grids/minio/data/.keep',
|
80
86
|
|
81
87
|
'grids/mysql',
|
88
|
+
'grids/mysql/backups',
|
89
|
+
'grids/mysql/backups/.keep',
|
82
90
|
'grids/mysql/data',
|
83
91
|
'grids/mysql/data/.keep',
|
84
92
|
|
@@ -96,6 +104,10 @@ module SmartMachine
|
|
96
104
|
'grids/redis/data',
|
97
105
|
'grids/redis/data/.keep',
|
98
106
|
|
107
|
+
'grids/scheduler',
|
108
|
+
'grids/scheduler/crontabs',
|
109
|
+
'grids/scheduler/crontabs/.keep',
|
110
|
+
|
99
111
|
'grids/solr',
|
100
112
|
'grids/solr/solr',
|
101
113
|
'grids/solr/solr/.keep',
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# Recommended defaults have been setup.
|
2
|
+
# This file should be changed only when you know what you are doing.
|
3
|
+
|
4
|
+
# Flush logs used to create consistent binlogs to be used for incremental backups
|
5
|
+
every :day, at: '12:00 pm' do
|
6
|
+
command "smartmachine runner grids mysql flushlogs"
|
7
|
+
end
|
8
|
+
|
9
|
+
# Create daily backup.
|
10
|
+
# This also flushes the logs before backup
|
11
|
+
every :day, at: '12:00 am' do
|
12
|
+
command "smartmachine runner grids mysql backup --daily"
|
13
|
+
end
|
14
|
+
|
15
|
+
# Promote currently latest daily backup to weekly backup.
|
16
|
+
# This is only possible when a daily backup creation has already been completed.
|
17
|
+
every :monday, at: '3:00 am' do
|
18
|
+
command "smartmachine runner grids mysql backup --promote-to-weekly"
|
19
|
+
end
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smartmachine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timeboard
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '6.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: whenever
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.0'
|
68
|
+
type: :runtime
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '1.0'
|
61
75
|
description: SmartMachine is a full-stack deployment framework for rails optimized
|
62
76
|
for admin programmer happiness and peaceful administration. It encourages natural
|
63
77
|
simplicity by favoring convention over configuration.
|
@@ -65,6 +79,7 @@ email: hello@timeboard.me
|
|
65
79
|
executables:
|
66
80
|
- buildpacker
|
67
81
|
- prereceiver
|
82
|
+
- scheduler
|
68
83
|
- smartmachine
|
69
84
|
- smartrunner
|
70
85
|
extensions: []
|
@@ -76,6 +91,7 @@ files:
|
|
76
91
|
- README.rdoc
|
77
92
|
- bin/buildpacker
|
78
93
|
- bin/prereceiver
|
94
|
+
- bin/scheduler
|
79
95
|
- bin/smartmachine
|
80
96
|
- bin/smartrunner
|
81
97
|
- lib/smart_machine.rb
|
@@ -112,6 +128,8 @@ files:
|
|
112
128
|
- lib/smart_machine/grids/prereceiver/fcgiwrap/packages/main/x86_64/fcgiwrap-openrc-1.1.1-r4.apk
|
113
129
|
- lib/smart_machine/grids/redis.rb
|
114
130
|
- lib/smart_machine/grids/redis/.keep
|
131
|
+
- lib/smart_machine/grids/scheduler.rb
|
132
|
+
- lib/smart_machine/grids/scheduler/Dockerfile
|
115
133
|
- lib/smart_machine/grids/solr.rb
|
116
134
|
- lib/smart_machine/grids/solr/config/.keep
|
117
135
|
- lib/smart_machine/grids/solr/config/README.txt
|
@@ -283,10 +301,12 @@ files:
|
|
283
301
|
- lib/smart_machine/templates/dotsmartmachine/apps/containers/.keep
|
284
302
|
- lib/smart_machine/templates/dotsmartmachine/apps/repositories/.keep
|
285
303
|
- lib/smart_machine/templates/dotsmartmachine/config/environment.rb
|
304
|
+
- lib/smart_machine/templates/dotsmartmachine/config/mysql/schedule.rb
|
286
305
|
- lib/smart_machine/templates/dotsmartmachine/config/users.yml
|
287
306
|
- lib/smart_machine/templates/dotsmartmachine/grids/elasticsearch/data/.keep
|
288
307
|
- lib/smart_machine/templates/dotsmartmachine/grids/elasticsearch/logs/.keep
|
289
308
|
- lib/smart_machine/templates/dotsmartmachine/grids/minio/data/.keep
|
309
|
+
- lib/smart_machine/templates/dotsmartmachine/grids/mysql/backups/.keep
|
290
310
|
- lib/smart_machine/templates/dotsmartmachine/grids/mysql/data/.keep
|
291
311
|
- lib/smart_machine/templates/dotsmartmachine/grids/nginx/certificates/.keep
|
292
312
|
- lib/smart_machine/templates/dotsmartmachine/grids/nginx/fastcgi.conf
|
@@ -294,6 +314,7 @@ files:
|
|
294
314
|
- lib/smart_machine/templates/dotsmartmachine/grids/nginx/nginx.tmpl
|
295
315
|
- lib/smart_machine/templates/dotsmartmachine/grids/prereceiver/pre-receive
|
296
316
|
- lib/smart_machine/templates/dotsmartmachine/grids/redis/data/.keep
|
317
|
+
- lib/smart_machine/templates/dotsmartmachine/grids/scheduler/crontabs/.keep
|
297
318
|
- lib/smart_machine/templates/dotsmartmachine/grids/solr/solr/.keep
|
298
319
|
- lib/smart_machine/templates/dotsmartmachine/tmp/.keep
|
299
320
|
- lib/smart_machine/user.rb
|
@@ -303,8 +324,8 @@ licenses:
|
|
303
324
|
- MIT
|
304
325
|
metadata:
|
305
326
|
bug_tracker_uri: https://github.com/timeboarders/smartbytes/issues
|
306
|
-
changelog_uri: https://github.com/timeboarders/smartbytes/blob/v0.
|
307
|
-
source_code_uri: https://github.com/timeboarders/smartbytes/tree/v0.
|
327
|
+
changelog_uri: https://github.com/timeboarders/smartbytes/blob/v0.8.0/smartmachine/CHANGELOG.rdoc
|
328
|
+
source_code_uri: https://github.com/timeboarders/smartbytes/tree/v0.8.0/smartmachine
|
308
329
|
post_install_message:
|
309
330
|
rdoc_options:
|
310
331
|
- "--main"
|