orchestration 0.7.3 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -1
- data/README.md +4 -19
- data/lib/orchestration/docker_compose/app_service.rb +1 -0
- data/lib/orchestration/docker_compose/compose_configuration.rb +2 -0
- data/lib/orchestration/make/orchestration.mk +3 -2
- data/lib/orchestration/make.rb +2 -0
- data/lib/orchestration/services/database/adapters/postgis.rb +48 -0
- data/lib/orchestration/services/database/adapters.rb +1 -0
- data/lib/orchestration/services/database/configuration.rb +1 -0
- data/lib/orchestration/terminal.rb +4 -0
- data/lib/orchestration/version.rb +1 -1
- data/lib/orchestration.rb +58 -19
- data/orchestration.gemspec +2 -0
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15cc577b20dab6949e4af0dbddccd6d120f66762602dd30cd8c4e34928ebff80
|
4
|
+
data.tar.gz: 909b1dee4b04df4be8f31dee5c2b7946f3cb652ca28093e33d5e7d4a8fb7a8ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac93a79951078f867958e22d82f752ead2539a0406b2cc5509362d87c05cbfd6bf0f32aa5eb262853f240a8b632f4738e074757f81d50cf463a879a755753d19
|
7
|
+
data.tar.gz: 2d14f57dd29b45861c4c2abda51b12182ce7ed91c53325d217c6e56078836f09cdde2635f743986383fd238e26a959c725f679011dfa9270ba91659c6a345930
|
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
orchestration (0.7.
|
4
|
+
orchestration (0.7.4)
|
5
5
|
database_url (~> 0.1.2)
|
6
|
+
dotenv-rails (~> 2.8)
|
6
7
|
erubis (~> 2.7)
|
7
8
|
i18n
|
8
9
|
paint (~> 2.2)
|
@@ -65,6 +66,9 @@ GEM
|
|
65
66
|
activerecord (7.0.3)
|
66
67
|
activemodel (= 7.0.3)
|
67
68
|
activesupport (= 7.0.3)
|
69
|
+
activerecord-postgis-adapter (8.0.1)
|
70
|
+
activerecord (~> 7.0.0)
|
71
|
+
rgeo-activerecord (~> 7.0.0)
|
68
72
|
activestorage (7.0.3)
|
69
73
|
actionpack (= 7.0.3)
|
70
74
|
activejob (= 7.0.3)
|
@@ -94,6 +98,10 @@ GEM
|
|
94
98
|
devpack (0.4.0)
|
95
99
|
diff-lcs (1.5.0)
|
96
100
|
digest (3.1.0)
|
101
|
+
dotenv (2.8.1)
|
102
|
+
dotenv-rails (2.8.1)
|
103
|
+
dotenv (= 2.8.1)
|
104
|
+
railties (>= 3.2)
|
97
105
|
erubi (1.10.0)
|
98
106
|
erubis (2.7.0)
|
99
107
|
globalid (1.0.0)
|
@@ -109,6 +117,7 @@ GEM
|
|
109
117
|
marcel (1.0.2)
|
110
118
|
method_source (1.0.0)
|
111
119
|
mini_mime (1.1.2)
|
120
|
+
mini_portile2 (2.8.0)
|
112
121
|
minitest (5.15.0)
|
113
122
|
mongo (2.17.1)
|
114
123
|
bson (>= 4.8.2, < 5.0.0)
|
@@ -132,6 +141,9 @@ GEM
|
|
132
141
|
net-protocol
|
133
142
|
timeout
|
134
143
|
nio4r (2.5.8)
|
144
|
+
nokogiri (1.13.6)
|
145
|
+
mini_portile2 (~> 2.8.0)
|
146
|
+
racc (~> 1.4)
|
135
147
|
nokogiri (1.13.6-x86_64-linux)
|
136
148
|
racc (~> 1.4)
|
137
149
|
paint (2.2.1)
|
@@ -176,6 +188,10 @@ GEM
|
|
176
188
|
redis (4.6.0)
|
177
189
|
regexp_parser (2.4.0)
|
178
190
|
rexml (3.2.5)
|
191
|
+
rgeo (2.4.0)
|
192
|
+
rgeo-activerecord (7.0.1)
|
193
|
+
activerecord (>= 5.0)
|
194
|
+
rgeo (>= 1.0.0)
|
179
195
|
rspec (3.11.0)
|
180
196
|
rspec-core (~> 3.11.0)
|
181
197
|
rspec-expectations (~> 3.11.0)
|
@@ -237,10 +253,12 @@ GEM
|
|
237
253
|
zeitwerk (2.5.4)
|
238
254
|
|
239
255
|
PLATFORMS
|
256
|
+
ruby
|
240
257
|
x86_64-linux
|
241
258
|
|
242
259
|
DEPENDENCIES
|
243
260
|
activerecord (>= 6.0)
|
261
|
+
activerecord-postgis-adapter (~> 8.0)
|
244
262
|
bunny (~> 2.19)
|
245
263
|
devpack (~> 0.4.0)
|
246
264
|
mongoid (~> 7.4)
|
data/README.md
CHANGED
@@ -166,30 +166,15 @@ make push
|
|
166
166
|
|
167
167
|
### Development
|
168
168
|
|
169
|
-
|
169
|
+
A [`.env` file](https://docs.docker.com/compose/env-file/) is created automatically in your project root. This file is _not_ stored in version control. Set all application environment variables in this file.
|
170
170
|
|
171
171
|
#### Launching a development server
|
172
172
|
|
173
|
-
|
173
|
+
Use vanilla _Rails_ commands to load a server or console. If present, a `.env` file will be read and loaded (via the [dotenv](https://github.com/bkeepers/dotenv) gem) to populate the environment.
|
174
174
|
|
175
175
|
```bash
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
To load a _Rails_ console:
|
180
|
-
```bash
|
181
|
-
make console
|
182
|
-
```
|
183
|
-
|
184
|
-
The application environment will be output on launch for convenience.
|
185
|
-
|
186
|
-
To pass extra commands to the _Rails_ server:
|
187
|
-
```bash
|
188
|
-
# Custom server, custom port
|
189
|
-
make serve server='webrick -p 3001'
|
190
|
-
|
191
|
-
# Default server, custom port, custom bind address
|
192
|
-
make serve server='-p 3001 -b 192.168.0.1'
|
176
|
+
bundle exec rails s # Launch a server
|
177
|
+
bundle exec rails c # Launch a console
|
193
178
|
```
|
194
179
|
|
195
180
|
### Testing
|
@@ -118,6 +118,7 @@ module Orchestration
|
|
118
118
|
def database_url
|
119
119
|
{
|
120
120
|
'postgresql' => 'postgresql://postgres:password@database-local:5432/production',
|
121
|
+
'postgis' => 'postgis://postgres:password@database-local:5432/production',
|
121
122
|
'mysql2' => 'mysql2://root:password@database-local:3306/production',
|
122
123
|
'sqlite3' => 'sqlite3:db/production.sqlite3'
|
123
124
|
}.fetch(DockerCompose::ComposeConfiguration.database_adapter_name, nil)
|
@@ -5,6 +5,7 @@ module Orchestration
|
|
5
5
|
class ComposeConfiguration
|
6
6
|
def self.database_adapter_name
|
7
7
|
return nil unless defined?(ActiveRecord)
|
8
|
+
return 'postgis' if defined?(::POSTGIS)
|
8
9
|
return 'postgresql' if defined?(::PG)
|
9
10
|
return 'mysql2' if defined?(::Mysql2)
|
10
11
|
return 'sqlite3' if defined?(::SQLite3)
|
@@ -28,6 +29,7 @@ module Orchestration
|
|
28
29
|
return nil unless defined?(ActiveRecord)
|
29
30
|
|
30
31
|
base = Orchestration::Services::Database::Adapters
|
32
|
+
return base::Postgis.new if defined?(::PostGIS)
|
31
33
|
return base::Postgresql.new if defined?(::PG)
|
32
34
|
return base::Mysql2.new if defined?(::Mysql2)
|
33
35
|
return base::Sqlite3.new if defined?(::SQLite3)
|
@@ -2,7 +2,8 @@
|
|
2
2
|
### Environment setup ###
|
3
3
|
SHELL:=/bin/bash
|
4
4
|
MAKE:=mkpath=${mkpath} make --no-print-directory
|
5
|
-
|
5
|
+
ORCHESTRATION_DISABLE_ENV=1
|
6
|
+
export
|
6
7
|
TERM ?= 'dumb'
|
7
8
|
pwd:=$(shell pwd)
|
8
9
|
|
@@ -142,7 +143,7 @@ DOCKER_TAG ?= latest
|
|
142
143
|
ifneq (,$(wildcard ./Gemfile))
|
143
144
|
bundle_cmd = bundle exec
|
144
145
|
endif
|
145
|
-
rake=DEVPACK_DISABLE=1 RACK_ENV=${env} SECRET_KEY_BASE='placeholder-secret' RAILS_ENV=${env} ${bundle_cmd} rake
|
146
|
+
rake=ORCHESTRATION_DISABLE_ENV=1 DEVPACK_DISABLE=1 RACK_ENV=${env} SECRET_KEY_BASE='placeholder-secret' RAILS_ENV=${env} ${bundle_cmd} rake
|
146
147
|
|
147
148
|
ifneq (,$(wildcard ${env_file}))
|
148
149
|
ifeq (,$(findstring deploy,$(MAKECMDGOALS)))
|
data/lib/orchestration/make.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Orchestration
|
4
|
+
module Services
|
5
|
+
module Database
|
6
|
+
module Adapters
|
7
|
+
class Postgis
|
8
|
+
include AdapterBase
|
9
|
+
|
10
|
+
def name
|
11
|
+
'postgis'
|
12
|
+
end
|
13
|
+
|
14
|
+
def image
|
15
|
+
'postgis/postgis:15-3.3'
|
16
|
+
end
|
17
|
+
|
18
|
+
def credentials
|
19
|
+
{
|
20
|
+
'username' => 'postgres',
|
21
|
+
'password' => 'password',
|
22
|
+
'database' => 'postgres'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def errors
|
27
|
+
[PG::ConnectionBad]
|
28
|
+
end
|
29
|
+
|
30
|
+
def default_port
|
31
|
+
5432
|
32
|
+
end
|
33
|
+
|
34
|
+
def environment
|
35
|
+
{
|
36
|
+
'POSTGRES_PASSWORD' => 'password',
|
37
|
+
'PGDATA' => data_dir
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def data_dir
|
42
|
+
'/var/pgdata'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -12,4 +12,5 @@ end
|
|
12
12
|
require 'orchestration/services/database/adapters/adapter_base'
|
13
13
|
require 'orchestration/services/database/adapters/mysql2'
|
14
14
|
require 'orchestration/services/database/adapters/postgresql'
|
15
|
+
require 'orchestration/services/database/adapters/postgis'
|
15
16
|
require 'orchestration/services/database/adapters/sqlite3'
|
@@ -47,6 +47,10 @@ module Orchestration
|
|
47
47
|
@settings.set(setting, read(prompt, default))
|
48
48
|
end
|
49
49
|
|
50
|
+
def print_variable(variable, value)
|
51
|
+
$stderr.print "#{Paint[variable, :blue]}#{Paint['=', :white]}#{Paint[value, :cyan]}"
|
52
|
+
end
|
53
|
+
|
50
54
|
private
|
51
55
|
|
52
56
|
def prompt(message, default)
|
data/lib/orchestration.rb
CHANGED
@@ -33,28 +33,67 @@ require 'orchestration/terminal'
|
|
33
33
|
require 'orchestration/version'
|
34
34
|
|
35
35
|
module Orchestration
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
class << self
|
37
|
+
def root
|
38
|
+
Pathname.new(File.dirname(__dir__))
|
39
|
+
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
41
|
+
def makefile
|
42
|
+
root.join('lib', 'orchestration', 'make', 'orchestration.mk')
|
43
|
+
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
def rakefile
|
46
|
+
root.join('lib', 'Rakefile')
|
47
|
+
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
def error(key, options = {})
|
50
|
+
warn('# Orchestration Error')
|
51
|
+
warn("# #{I18n.t("orchestration.#{key}", options)}")
|
52
|
+
end
|
53
|
+
|
54
|
+
def random_local_port
|
55
|
+
socket = Socket.new(:INET, :STREAM, 0)
|
56
|
+
socket.bind(Addrinfo.tcp('127.0.0.1', 0))
|
57
|
+
port = socket.local_address.ip_port
|
58
|
+
socket.close
|
59
|
+
port
|
60
|
+
end
|
61
|
+
|
62
|
+
def print_environment
|
63
|
+
return unless File.exist?('.env')
|
52
64
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
65
|
+
$stderr.puts
|
66
|
+
warn("#{prefix} #{Paint['Loading environment from', :cyan]} #{Paint['.env', :green]}")
|
67
|
+
$stderr.puts
|
68
|
+
environment_variables.each do |variable, value|
|
69
|
+
terminal.print_variable(variable, value)
|
70
|
+
end
|
71
|
+
$stderr.puts
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def terminal
|
77
|
+
@terminal ||= Terminal.new(Environment.new.settings)
|
78
|
+
end
|
79
|
+
|
80
|
+
def prefix
|
81
|
+
"#{Paint['[', :white]}#{Paint['orchestration', :cyan]}#{Paint[']', :white]}"
|
82
|
+
end
|
83
|
+
|
84
|
+
def environment_variables
|
85
|
+
File.readlines('.env').reject { |line| line.match(/^\s*#/) }
|
86
|
+
.select { |line| line.include?('=') }
|
87
|
+
.map do |line|
|
88
|
+
variable, _, value = line.partition('=')
|
89
|
+
[variable, value]
|
90
|
+
end
|
91
|
+
end
|
59
92
|
end
|
60
93
|
end
|
94
|
+
|
95
|
+
if ENV['RAILS_ENV'] == 'development' && !ENV.key?('ORCHESTRATION_DISABLE_ENV')
|
96
|
+
require 'dotenv-rails'
|
97
|
+
Dotenv::Railtie.load
|
98
|
+
Orchestration.print_environment
|
99
|
+
end
|
data/orchestration.gemspec
CHANGED
@@ -28,6 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
30
|
spec.add_runtime_dependency 'database_url', '~> 0.1.2'
|
31
|
+
spec.add_runtime_dependency 'dotenv-rails', '~> 2.8'
|
31
32
|
spec.add_runtime_dependency 'erubis', '~> 2.7'
|
32
33
|
spec.add_runtime_dependency 'i18n'
|
33
34
|
spec.add_runtime_dependency 'paint', '~> 2.2'
|
@@ -35,6 +36,7 @@ Gem::Specification.new do |spec|
|
|
35
36
|
spec.add_runtime_dependency 'thor', '~> 1.2'
|
36
37
|
|
37
38
|
spec.add_development_dependency 'activerecord', '>= 6.0'
|
39
|
+
spec.add_development_dependency 'activerecord-postgis-adapter', '~> 8.0'
|
38
40
|
spec.add_development_dependency 'bunny', '~> 2.19'
|
39
41
|
spec.add_development_dependency 'devpack', '~> 0.4.0'
|
40
42
|
spec.add_development_dependency 'mongoid', '~> 7.4'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orchestration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: database_url
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.1.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dotenv-rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.8'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.8'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: erubis
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,6 +122,20 @@ dependencies:
|
|
108
122
|
- - ">="
|
109
123
|
- !ruby/object:Gem::Version
|
110
124
|
version: '6.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: activerecord-postgis-adapter
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '8.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '8.0'
|
111
139
|
- !ruby/object:Gem::Dependency
|
112
140
|
name: bunny
|
113
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -399,6 +427,7 @@ files:
|
|
399
427
|
- lib/orchestration/services/database/adapters.rb
|
400
428
|
- lib/orchestration/services/database/adapters/adapter_base.rb
|
401
429
|
- lib/orchestration/services/database/adapters/mysql2.rb
|
430
|
+
- lib/orchestration/services/database/adapters/postgis.rb
|
402
431
|
- lib/orchestration/services/database/adapters/postgresql.rb
|
403
432
|
- lib/orchestration/services/database/adapters/sqlite3.rb
|
404
433
|
- lib/orchestration/services/database/configuration.rb
|