stackose 0.1.0 → 0.1.1

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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/stackose.rb +26 -3
  4. data/stackose.gemspec +1 -1
  5. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78e1ae2368a649e93bc733155190ea791acd36ec
4
- data.tar.gz: d3e0aec71ec3afbcce1b78b4cbe3c2412d25ae87
3
+ metadata.gz: 22b99d66e19a7ab647033ea0ed72a00ad021f527
4
+ data.tar.gz: 0f914ce6c10bc8da80ec51b3688f681a721fe01f
5
5
  SHA512:
6
- metadata.gz: 0c75721a352ae19820b45e462dbff3c93f17e5f9eba8d79db22245946c222e70728855b428023f16150de96a6e855fba4747b254e3cd824dd3f245c6fe6bd488
7
- data.tar.gz: c6358e7705080b4e46d16aa8eea19371851a04332e5ac6576155f68b6c059eedca22d8fc50b419301e2e046b4c3641c10b9c5a4be3054683b698f7434471a0f3
6
+ metadata.gz: 0ffe9a7d561d71dd6115fd9e785e8e1f8ea83cd142ecb0940b22547c5320877369af13ee4c6927f195d2c43c283ded1ebc932963f2265568b8770fe4285cb591
7
+ data.tar.gz: 2ea968c5713f3e11e8b83b6adc658a7e042ba71bb0d61bc8d03d4ee97f93d78ef0b2f8be761da31578ba1d9fa0f8c4ff0a1261cda46c46c2f909eb615fb93371
data/README.md CHANGED
@@ -55,7 +55,8 @@ For custom linking you can provide inside the array a hash with key->value of so
55
55
  "/custom_path/#{fetch(:application)}/":"#{fetch(:capose_docker_mount_point)}/log",
56
56
  ]
57
57
 
58
- if you need the shared_path url in the key you can set `__shared_path__` as placeholder
58
+ if you need the shared_path url in the key you can set `__shared_path__` as placeholder
59
+ or all the other fetch variables can be used inside with `__variable_name__`
59
60
 
60
61
 
61
62
 
data/lib/stackose.rb CHANGED
@@ -28,7 +28,7 @@ namespace :stackose do
28
28
  fetch(:stackose_linked_folders).each do |f|
29
29
 
30
30
  if f.is_a? Hash
31
- f.each {|k, v| files << ["#{k.to_s.gsub('__shared_path__', shared_path.to_s)}", v]}
31
+ f.each {|k, v| files << [replace_strings_with_paths(k).to_sym, replace_strings_with_paths(v).to_sym]}
32
32
  elsif f.is_a? String
33
33
  files << ["#{shared_path}/#{f}", "#{fetch(:stackose_docker_mount_point)}/#{f}"]
34
34
  end
@@ -37,6 +37,27 @@ namespace :stackose do
37
37
  files.to_h
38
38
  end
39
39
 
40
+ ##
41
+ # Replace string with composer fetch_functions
42
+ def replace_strings_with_paths(str)
43
+
44
+ str_to_replace = str.to_s
45
+
46
+ str.to_s.scan(/__([a-z_]*)__/).each do |k|
47
+ k = k.first
48
+ case k
49
+ when 'shared_path'
50
+ value = shared_path
51
+ else
52
+ value = fetch(k.to_sym)
53
+ end
54
+ str_to_replace = str_to_replace.gsub("__#{k}__", value.to_s)
55
+ end
56
+
57
+ str_to_replace
58
+
59
+ end
60
+
40
61
  # task :command do
41
62
  # _cmd = ENV["STACKOSE_COMMAND"]
42
63
  # if _cmd.nil?
@@ -63,7 +84,7 @@ namespace :stackose do
63
84
  desc "check linked dirs, and create this if there are not present"
64
85
  task :create_linked_dirs do
65
86
  on roles(fetch(:stackose_role)) do
66
- execute :mkdir,'-p',normalized_stackose_linked_folders.keys.join(' ')
87
+ execute :mkdir, '-p', normalized_stackose_linked_folders.keys.join(' ')
67
88
  end
68
89
  end
69
90
 
@@ -158,7 +179,7 @@ namespace :stackose do
158
179
  compose_production = {
159
180
  version: '3',
160
181
  services: {
161
- app: {
182
+ fetch(:stackose_service_to_build, 'app').to_sym => {
162
183
  restart: 'unless-stopped',
163
184
  environment: {:RAILS_ENV => fetch(:rails_env).to_s,
164
185
  :RAILS_SERVE_STATIC_FILES => 'true',
@@ -196,6 +217,8 @@ namespace :stackose do
196
217
  }
197
218
  }
198
219
 
220
+ compose_production[:services][fetch(:stackose_service_to_build, 'app').to_sym].merge!({depends_on: ['redis']})
221
+
199
222
  File.open("config/redis.conf", 'w') {|file| file.write("maxmemory 50mb\nmaxmemory-policy allkeys-lfu")}
200
223
  end
201
224
 
data/stackose.gemspec CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = 'stackose'
6
- spec.version = '0.1.0'
6
+ spec.version = '0.1.1'
7
7
  spec.authors = ["Marino Bonetti"]
8
8
  spec.email = ["marinobonetti@gmail.com"]
9
9
  spec.description = %q{Docker-Stack support for Capistrano 3.x}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marino Bonetti