lucy_dockerunner 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +69 -13
- data/lib/lucy_dockerunner/version.rb +1 -1
- data/lib/tasks/compose.rake +5 -7
- data/lib/tasks/compose_assets.rake +0 -1
- data/lib/tasks/compose_prod.rake +3 -3
- metadata +2 -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: e3a36c58434b995bf29542f0db7573c35b54c152a134eb4d36098e6ba86ca3a6
|
4
|
+
data.tar.gz: 10d72d8711a338fe1c71711de7bbfca41979c8787a243d916f2fcfe351198502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08efb3fa738f8664743422d43833e638cda59446854388789a012c3b5203c86b0a3bd370426122c9b3f7299d44f16fa088c3171907b3303169417268b8f867db'
|
7
|
+
data.tar.gz: c12c37d2031dbaf034c649e18f30ccec090a4aeafdd93b6185498e93976c5ea61c0fba5d38653fac9618371332b4897b238dabf14d42dc8bd92412639a39874e
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#
|
1
|
+
# Lucy Dockerunner
|
2
2
|
|
3
3
|
Lucy Dockerunner is a Ruby gem that provides a simple wrapper around the Docker Compose CLI to make it easier to run Docker Compose commands from Ruby On Rails projects.
|
4
4
|
|
@@ -8,8 +8,36 @@ Lucy Dockerunner is a Ruby gem that provides a simple wrapper around the Docker
|
|
8
8
|
|
9
9
|
Ruby version: >= 2.6.0
|
10
10
|
|
11
|
-
This gem version: 0.1.
|
11
|
+
This gem version: 0.1.7
|
12
12
|
|
13
|
+
## Dependencies
|
14
|
+
|
15
|
+
* [Docker](https://www.docker.com/)
|
16
|
+
* [Docker Compose](https://docs.docker.com/compose/)
|
17
|
+
* [Ruby On Rails](https://rubyonrails.org/) - or any other Ruby project that uses Docker Compose to run the project with specific services.
|
18
|
+
|
19
|
+
## Files
|
20
|
+
This gem uses the following files to run the docker compose services:
|
21
|
+
|
22
|
+
- Dockerfile
|
23
|
+
- docker-compose.yml - development
|
24
|
+
- docker-compose.prod.yml - production
|
25
|
+
|
26
|
+
It's important to have .env files separated by environment, for example:
|
27
|
+
- .env.development
|
28
|
+
- .env.production
|
29
|
+
|
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.
|
13
41
|
## Installation
|
14
42
|
|
15
43
|
You can install the gem by executing:
|
@@ -29,7 +57,7 @@ require 'lucy_dockerunner'
|
|
29
57
|
LucyDockerunner.load_tasks
|
30
58
|
````
|
31
59
|
|
32
|
-
|
60
|
+
## Docker actions
|
33
61
|
* `rake compose:install` - build docker compose and migrate the database
|
34
62
|
* `rake compose:build` - build docker compose services
|
35
63
|
* `rake compose:up` - start the docker compose services
|
@@ -45,7 +73,26 @@ LucyDockerunner.load_tasks
|
|
45
73
|
* `rake compose:clean_volumes` - clean all docker compose volumes
|
46
74
|
* `rake compose:clean_orphans` - clean all docker compose orphans
|
47
75
|
* `rake compose:clean_containers` - clean all docker compose containers
|
48
|
-
|
76
|
+
|
77
|
+
## Docker Production actions
|
78
|
+
|
79
|
+
* `rake compose_prod:install` - build docker compose and migrate the database
|
80
|
+
* `rake compose_prod:build` - build docker compose services
|
81
|
+
* `rake compose_prod:up` - start the docker compose services
|
82
|
+
* `rake compose_prod:down` - stop the docker compose services
|
83
|
+
* `rake compose_prod:status` - show the status of the docker compose services
|
84
|
+
* `rake compose_prod:shell` - open a shell in the web service
|
85
|
+
* `rake compose_prod:db_detach` - detach the database from the docker compose services
|
86
|
+
* `rake compose_prod:redis_detach` - detach the redis from the docker compose services
|
87
|
+
* `rake compose_prod:back_detach` - detach the backend(redis, sidekiq, db) from the docker compose services
|
88
|
+
* `rake compose_prod:restart` - restart the docker compose services
|
89
|
+
* `rake compose_prod:clean_all` - clean all docker compose services
|
90
|
+
* `rake compose_prod:clean_images` - clean all docker compose images
|
91
|
+
* `rake compose_prod:clean_volumes` - clean all docker compose volumes
|
92
|
+
* `rake compose_prod:clean_orphans` - clean all docker compose orphans
|
93
|
+
* `rake compose_prod:clean_containers` - clean all docker compose containers
|
94
|
+
|
95
|
+
## Database actions
|
49
96
|
* `rake compose_db:migrate` - migrate the database
|
50
97
|
* `rake compose_db:reset` - reset the database
|
51
98
|
* `rake compose_db:drop` - drop the database
|
@@ -57,7 +104,7 @@ LucyDockerunner.load_tasks
|
|
57
104
|
* `rake compose_db:reset_setup` - drop and setup the database
|
58
105
|
* `rake compose_db:reset` - reset the database
|
59
106
|
|
60
|
-
|
107
|
+
## Tests actions
|
61
108
|
* `rake compose_test:all` - run all tests
|
62
109
|
* `rake compose_test:clean_all` - run all tests after cleaning docker compose services
|
63
110
|
* `rake compose_test:controllers` - run controllers tests
|
@@ -68,7 +115,7 @@ LucyDockerunner.load_tasks
|
|
68
115
|
* `rake compose_test:routing` - run routing tests
|
69
116
|
* `rake compose_test:views` - run views tests
|
70
117
|
|
71
|
-
|
118
|
+
## LOGS actions
|
72
119
|
* `rake compose_logs:web` - show web logs
|
73
120
|
* `rake compose_logs:db` - show db logs
|
74
121
|
* `rake compose_logs:redis` - show redis logs
|
@@ -80,24 +127,33 @@ LucyDockerunner.load_tasks
|
|
80
127
|
* `rake compose_logs:tail_sidekiq` - tail sidekiq logs
|
81
128
|
* `rake compose_logs:tail_all` - tail all logs
|
82
129
|
|
130
|
+
## Assets actions
|
131
|
+
* `rake compose_assets:precompile` - precompile assets
|
132
|
+
* `rake compose_assets:clean` - clean assets
|
133
|
+
* `rake compose_assets:clobber` - clobber assets
|
134
|
+
|
135
|
+
|
83
136
|
## Start the docker compose services
|
84
137
|
````bash
|
85
138
|
$ rake compose:up
|
86
139
|
````
|
87
|
-
### Access the web service
|
88
|
-
http://localhost
|
89
|
-
|
90
|
-
|
91
|
-
## References
|
92
|
-
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.
|
93
140
|
## Contributing
|
94
141
|
|
95
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).
|
96
143
|
|
144
|
+
|
145
|
+
## [![Repography logo](https://images.repography.com/logo.svg)](https://repography.com) / Recent activity [![Time period](https://images.repography.com/33522702/JesusGautamah/lucy_dockerunner/recent-activity/7YfytFwl78FgWgAtJeO7jReo0y6GD6YPifcYNBxOxaE/yhI9H3pCZlEkfuvJLU9LC32UBu1c8k5toFvgUDmttdM_badge.svg)](https://repography.com)
|
146
|
+
[![Timeline graph](https://images.repography.com/33522702/JesusGautamah/lucy_dockerunner/recent-activity/7YfytFwl78FgWgAtJeO7jReo0y6GD6YPifcYNBxOxaE/yhI9H3pCZlEkfuvJLU9LC32UBu1c8k5toFvgUDmttdM_timeline.svg)](https://github.com/JesusGautamah/lucy_dockerunner/commits)
|
147
|
+
[![Issue status graph](https://images.repography.com/33522702/JesusGautamah/lucy_dockerunner/recent-activity/7YfytFwl78FgWgAtJeO7jReo0y6GD6YPifcYNBxOxaE/yhI9H3pCZlEkfuvJLU9LC32UBu1c8k5toFvgUDmttdM_issues.svg)](https://github.com/JesusGautamah/lucy_dockerunner/issues)
|
148
|
+
[![Pull request status graph](https://images.repography.com/33522702/JesusGautamah/lucy_dockerunner/recent-activity/7YfytFwl78FgWgAtJeO7jReo0y6GD6YPifcYNBxOxaE/yhI9H3pCZlEkfuvJLU9LC32UBu1c8k5toFvgUDmttdM_prs.svg)](https://github.com/JesusGautamah/lucy_dockerunner/pulls)
|
149
|
+
[![Top contributors](https://images.repography.com/33522702/JesusGautamah/lucy_dockerunner/recent-activity/7YfytFwl78FgWgAtJeO7jReo0y6GD6YPifcYNBxOxaE/yhI9H3pCZlEkfuvJLU9LC32UBu1c8k5toFvgUDmttdM_users.svg)](https://github.com/JesusGautamah/lucy_dockerunner/graphs/contributors)
|
150
|
+
|
151
|
+
|
152
|
+
|
97
153
|
## License
|
98
154
|
|
99
155
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
100
156
|
|
101
157
|
## Code of Conduct
|
102
158
|
|
103
|
-
Everyone interacting in the LucyDockerunner project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/JesusGautamah/lucy_dockerunner/blob/master/CODE_OF_CONDUCT.md).
|
159
|
+
Everyone interacting in the LucyDockerunner project's codebases, issue trackers, chat rooms and mailing lists is expected to follow 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
|
@@ -187,10 +185,10 @@ end
|
|
187
185
|
|
188
186
|
tasks_names.each do |task|
|
189
187
|
before_action = "#{namesp}:#{task}"
|
190
|
-
|
188
|
+
Rake::Task[before_action].enhance do
|
191
189
|
docker_abort_error = "Dockerfile not found.\nYou must have a Dockerfile file."
|
192
|
-
compose_abort_error = "Compose file not found.\
|
193
|
-
dockerfile_checker ? abort(docker_abort_error) : puts("Dockerfile found
|
194
|
-
compose_checker ? abort(compose_abort_error) : puts("Compose file found
|
190
|
+
compose_abort_error = "Compose file not found.\nYou must have a docker-compose.prod.yml file."
|
191
|
+
dockerfile_checker ? abort(docker_abort_error) : puts("Dockerfile found")
|
192
|
+
compose_checker ? abort(compose_abort_error) : puts("Compose Production file found")
|
195
193
|
end
|
196
194
|
end
|
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
|
@@ -242,10 +241,11 @@ 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
247
|
dockerfile_checker ? abort(docker_abort_error) : puts("Dockerfile found")
|
249
248
|
compose_checker ? abort(compose_abort_error) : puts("Compose Production file found")
|
250
249
|
end
|
251
250
|
end
|
251
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JesusGautamah
|
@@ -12,8 +12,7 @@ date: 2023-02-16 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.
|
15
|
-
|
16
|
-
by me in the project https://github.com/JesusGautamah/outerspace-blockchain
|
15
|
+
Docs: https://github.com/JesusGautamah/lucy_dockerunner
|
17
16
|
email:
|
18
17
|
- lima.jesuscc@gmail.com
|
19
18
|
executables: []
|
@@ -32,7 +31,6 @@ files:
|
|
32
31
|
- Rakefile
|
33
32
|
- lib/lucy_dockerunner.rb
|
34
33
|
- lib/lucy_dockerunner/version.rb
|
35
|
-
- lib/rake/lucyd_hooks.rb
|
36
34
|
- lib/tasks/.keep
|
37
35
|
- lib/tasks/compose.rake
|
38
36
|
- lib/tasks/compose_assets.rake
|
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
|