lucy_dockerunner 0.1.7 → 0.1.9
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/Gemfile.lock +1 -1
- data/README.md +10 -3
- data/lib/lucy_dockerunner/version.rb +1 -1
- data/lib/tasks/compose.rake +39 -31
- data/lib/tasks/compose_assets.rake +0 -1
- data/lib/tasks/compose_logs.rake +48 -0
- data/lib/tasks/compose_prod.rake +9 -9
- metadata +3 -4
- data/lib/rake/lucyd_hooks.rb +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5982619210e56d52470c5a60eb936282f0e37f958c993c0511c25c546b25004
|
4
|
+
data.tar.gz: b6a090ac20f0d81b44c2a78c1488ba354ab43d5f261945fb053c43d182d17058
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f08537f76a386d8c07cbe474a3297d56851984103a07e8dae69f64585687088b607e2e6ed260e5cf01903462546e5ecec13a4320f0f704bf8f2fd4939b63ae07
|
7
|
+
data.tar.gz: 253c9000552f954a2522c8104a69e7474b2c88b80691fd713216dbea5cecdd97043956e0a1c3032f9e43999ed9e9805f1b9fcd8174960f7fc53cc1bc3e1806e3
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -28,6 +28,16 @@ It's important to have .env files separated by environment, for example:
|
|
28
28
|
- .env.production
|
29
29
|
|
30
30
|
And remember to add the .env files to the .gitignore file and reference them in the docker-compose.yml and docker-compose.prod.yml files.
|
31
|
+
|
32
|
+
## Services
|
33
|
+
This gem requires the following services names to be included in the docker-compose.yml and docker-compose.prod.yml files:
|
34
|
+
<!-- db - redis - web - sidekiq -->
|
35
|
+
* db
|
36
|
+
* redis
|
37
|
+
* web
|
38
|
+
* sidekiq
|
39
|
+
|
40
|
+
##### more services will be added in the future, for example: mailcatcher, elasticsearch, webpack, etc.
|
31
41
|
## Installation
|
32
42
|
|
33
43
|
You can install the gem by executing:
|
@@ -127,9 +137,6 @@ LucyDockerunner.load_tasks
|
|
127
137
|
````bash
|
128
138
|
$ rake compose:up
|
129
139
|
````
|
130
|
-
|
131
|
-
## References
|
132
|
-
The code code inside the 'lib/rake/lucyd_hooks.rb' file is based on the code of the [rake-hooks](https://github.com/guillermo/rake-hooks) from Guillermo Iguaran, Joel Moss as described in the [Ruby Toolbox](https://www.ruby-toolbox.com/projects/rake-hooks) page.
|
133
140
|
## Contributing
|
134
141
|
|
135
142
|
Bug reports and pull requests are welcome on GitHub at https://github.com/JesusGautamah/lucy_dockerunner. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/JesusGautamah/lucy_dockerunner/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/tasks/compose.rake
CHANGED
@@ -2,11 +2,9 @@
|
|
2
2
|
|
3
3
|
require "rake"
|
4
4
|
require_relative "task_helpers/compose_taskhelper"
|
5
|
-
require_relative "../rake/lucyd_hooks"
|
6
5
|
|
7
6
|
def tasks_names
|
8
|
-
@tasks_names = %w[install build up down restart clean_all clean_volumes clean_orphans clean_images
|
9
|
-
clean_stopped]
|
7
|
+
@tasks_names = %w[install build up down restart clean_all clean_volumes clean_orphans clean_images]
|
10
8
|
end
|
11
9
|
|
12
10
|
def namesp
|
@@ -71,6 +69,30 @@ namespace :compose do
|
|
71
69
|
system "sudo #{compose_command} down"
|
72
70
|
puts "Stopping Compose... Done!"
|
73
71
|
end
|
72
|
+
|
73
|
+
task :bot_detach do
|
74
|
+
puts "Running Bot Detached..."
|
75
|
+
system "sudo #{compose_command} up -d bot"
|
76
|
+
puts "Running Bot Detached... Done!"
|
77
|
+
end
|
78
|
+
|
79
|
+
task :telegram_detach do
|
80
|
+
puts "Running Telegram Detached..."
|
81
|
+
system "sudo #{compose_command} up -d telegram"
|
82
|
+
puts "Running Telegram Detached... Done!"
|
83
|
+
end
|
84
|
+
|
85
|
+
task :discord_detach do
|
86
|
+
puts "Running Discord Detached..."
|
87
|
+
system "sudo #{compose_command} up -d discord"
|
88
|
+
puts "Running Discord Detached... Done!"
|
89
|
+
end
|
90
|
+
|
91
|
+
task :nginx_detach do
|
92
|
+
puts "Running Nginx Detached..."
|
93
|
+
system "sudo #{compose_command} up -d nginx"
|
94
|
+
puts "Running Nginx Detached... Done!"
|
95
|
+
end
|
74
96
|
|
75
97
|
task :db_detach do
|
76
98
|
puts "Running Database Detached..."
|
@@ -84,11 +106,11 @@ namespace :compose do
|
|
84
106
|
puts "Running Redis Detached... Done!"
|
85
107
|
end
|
86
108
|
|
87
|
-
task :back_detach do
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
109
|
+
# task :back_detach do
|
110
|
+
# puts "Running Backend Detached..."
|
111
|
+
# system "sudo #{compose_command} up -d --remove-orphans db redis sidekiq"
|
112
|
+
# puts "Running Backend Detached... Done!"
|
113
|
+
# end
|
92
114
|
|
93
115
|
task :restart do
|
94
116
|
puts "Restarting Compose..."
|
@@ -114,21 +136,7 @@ namespace :compose do
|
|
114
136
|
|
115
137
|
task :clean_all do
|
116
138
|
puts "Cleaning Compose..."
|
117
|
-
|
118
|
-
system "sudo #{compose_command} down"
|
119
|
-
puts "Stopping Compose... Done!"
|
120
|
-
puts "Removing Containers..."
|
121
|
-
system "sudo #{compose_command} rm -f"
|
122
|
-
puts "Removing Containers... Done!"
|
123
|
-
puts "Removing Images..."
|
124
|
-
system "sudo #{compose_command} rmi -f"
|
125
|
-
puts "Removing Images... Done!"
|
126
|
-
puts "Removing Volumes..."
|
127
|
-
system "sudo #{compose_command} down -v"
|
128
|
-
puts "Removing Volumes... Done!"
|
129
|
-
puts "Removing Orphans..."
|
130
|
-
system "sudo #{compose_command} down --remove-orphans"
|
131
|
-
puts "Removing Networks... Done!"
|
139
|
+
system "sudo docker system prune"
|
132
140
|
puts "Cleaning Compose... Done!"
|
133
141
|
end
|
134
142
|
|
@@ -177,20 +185,20 @@ namespace :compose do
|
|
177
185
|
end
|
178
186
|
end
|
179
187
|
|
180
|
-
def
|
181
|
-
|
188
|
+
def compose_exist?
|
189
|
+
File.exist?(compose_file)
|
182
190
|
end
|
183
191
|
|
184
|
-
def
|
185
|
-
|
192
|
+
def dockerfile_exist?
|
193
|
+
File.exist?("Dockerfile")
|
186
194
|
end
|
187
195
|
|
188
196
|
tasks_names.each do |task|
|
189
197
|
before_action = "#{namesp}:#{task}"
|
190
|
-
|
198
|
+
Rake::Task[before_action].enhance do
|
191
199
|
docker_abort_error = "Dockerfile not found.\nYou must have a Dockerfile file."
|
192
|
-
compose_abort_error = "Compose file not found.\
|
193
|
-
|
194
|
-
|
200
|
+
compose_abort_error = "Compose file not found.\nYou must have a docker-compose.yml file."
|
201
|
+
abort(docker_abort_error) unless dockerfile_exist?
|
202
|
+
abort(compose_abort_error) unless compose_exist?
|
195
203
|
end
|
196
204
|
end
|
data/lib/tasks/compose_logs.rake
CHANGED
@@ -12,6 +12,30 @@ def compose_command
|
|
12
12
|
end
|
13
13
|
|
14
14
|
namespace :compose_logs do
|
15
|
+
task :discord do
|
16
|
+
puts "Showing Discord Logs..."
|
17
|
+
system "sudo #{compose_command} logs discord"
|
18
|
+
puts "Showing Discord Logs... Done!"
|
19
|
+
end
|
20
|
+
|
21
|
+
task :telegram do
|
22
|
+
puts "Showing Telegram Logs..."
|
23
|
+
system "sudo #{compose_command} logs telegram"
|
24
|
+
puts "Showing Telegram Logs... Done!"
|
25
|
+
end
|
26
|
+
|
27
|
+
task :bot do
|
28
|
+
puts "Showing Bot Logs..."
|
29
|
+
system "sudo #{compose_command} logs bot"
|
30
|
+
puts "Showing Bot Logs... Done!"
|
31
|
+
end
|
32
|
+
|
33
|
+
task :nginx do
|
34
|
+
puts "Showing Nginx Logs..."
|
35
|
+
system "sudo #{compose_command} logs nginx"
|
36
|
+
puts "Showing Nginx Logs... Done!"
|
37
|
+
end
|
38
|
+
|
15
39
|
task :web do
|
16
40
|
puts "Showing Web Logs..."
|
17
41
|
system "sudo #{compose_command} logs web"
|
@@ -42,6 +66,30 @@ namespace :compose_logs do
|
|
42
66
|
puts "Showing All Logs... Done!"
|
43
67
|
end
|
44
68
|
|
69
|
+
task :tail_discord do
|
70
|
+
puts "Tailing Discord Logs..."
|
71
|
+
system "sudo #{compose_command} logs -f discord"
|
72
|
+
puts "Tailing Discord Logs... Done!"
|
73
|
+
end
|
74
|
+
|
75
|
+
task :tail_telegram do
|
76
|
+
puts "Tailing Telegram Logs..."
|
77
|
+
system "sudo #{compose_command} logs -f telegram"
|
78
|
+
puts "Tailing Telegram Logs... Done!"
|
79
|
+
end
|
80
|
+
|
81
|
+
task :tail_bot do
|
82
|
+
puts "Tailing Bot Logs..."
|
83
|
+
system "sudo #{compose_command} logs -f bot"
|
84
|
+
puts "Tailing Bot Logs... Done!"
|
85
|
+
end
|
86
|
+
|
87
|
+
task :tail_nginx do
|
88
|
+
puts "Tailing Nginx Logs..."
|
89
|
+
system "sudo #{compose_command} logs -f nginx"
|
90
|
+
puts "Tailing Nginx Logs... Done!"
|
91
|
+
end
|
92
|
+
|
45
93
|
task :tail_web do
|
46
94
|
puts "Tailing Web Logs..."
|
47
95
|
system "sudo #{compose_command} logs -f web"
|
data/lib/tasks/compose_prod.rake
CHANGED
@@ -4,8 +4,7 @@ require "rake"
|
|
4
4
|
require_relative "task_helpers/compose_taskhelper"
|
5
5
|
|
6
6
|
def tasks_names
|
7
|
-
@tasks_names = %w[install build up down restart clean_all clean_volumes clean_orphans clean_images
|
8
|
-
clean_stopped]
|
7
|
+
@tasks_names = %w[install build up down restart clean_all clean_volumes clean_orphans clean_images]
|
9
8
|
end
|
10
9
|
|
11
10
|
def namesp
|
@@ -232,20 +231,21 @@ namespace :compose_prod do
|
|
232
231
|
end
|
233
232
|
end
|
234
233
|
|
235
|
-
def
|
236
|
-
|
234
|
+
def compose_exist?
|
235
|
+
File.exist?(compose_file)
|
237
236
|
end
|
238
237
|
|
239
|
-
def
|
240
|
-
|
238
|
+
def dockerfile_exist?
|
239
|
+
File.exist?("Dockerfile")
|
241
240
|
end
|
242
241
|
|
243
242
|
tasks_names.each do |task|
|
244
243
|
before_action = "#{namesp}:#{task}"
|
245
|
-
|
244
|
+
Rake::Task[before_action].enhance do
|
246
245
|
docker_abort_error = "Dockerfile not found.\nYou must have a Dockerfile file."
|
247
246
|
compose_abort_error = "Compose file not found.\nYou must have a docker-compose.prod.yml file."
|
248
|
-
|
249
|
-
|
247
|
+
abort(docker_abort_error) unless dockerfile_exist?
|
248
|
+
abort(compose_abort_error) unless compose_exist?
|
250
249
|
end
|
251
250
|
end
|
251
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lucy_dockerunner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JesusGautamah
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
This gem is a tool to run docker containers with rake commands, good for CI/CD and Rails projects.
|
@@ -31,7 +31,6 @@ files:
|
|
31
31
|
- Rakefile
|
32
32
|
- lib/lucy_dockerunner.rb
|
33
33
|
- lib/lucy_dockerunner/version.rb
|
34
|
-
- lib/rake/lucyd_hooks.rb
|
35
34
|
- lib/tasks/.keep
|
36
35
|
- lib/tasks/compose.rake
|
37
36
|
- lib/tasks/compose_assets.rake
|
@@ -66,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
66
65
|
- !ruby/object:Gem::Version
|
67
66
|
version: '0'
|
68
67
|
requirements: []
|
69
|
-
rubygems_version: 3.4.
|
68
|
+
rubygems_version: 3.4.6
|
70
69
|
signing_key:
|
71
70
|
specification_version: 4
|
72
71
|
summary: This gem is a tool to run docker containers with rake commands, good for
|
data/lib/rake/lucyd_hooks.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# from https://github.com/guillermo/rake-hooks, authors Guillermo Iguaran, Joel Moss
|
4
|
-
module Rake
|
5
|
-
# module Rake::Hooks
|
6
|
-
module LucydHooks
|
7
|
-
def bef(*task_names, &new_task)
|
8
|
-
task_names.each do |task_name|
|
9
|
-
old_task = Rake.application.instance_variable_get("@tasks").delete(task_name.to_s)
|
10
|
-
next unless old_task
|
11
|
-
|
12
|
-
desc old_task.full_comment if old_task.respond_to?(:full_comment)
|
13
|
-
task task_name => old_task.prerequisites do
|
14
|
-
new_task.call
|
15
|
-
old_task.invoke
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
Rake::DSL.include Rake::LucydHooks if defined?(Rake::DSL)
|
22
|
-
include Rake::LucydHooks unless self.class.included_modules.include?(Rake::LucydHooks)
|
23
|
-
end
|