marathon_deploy 0.1.5 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8e3ee556e194509d638fac844a510c602a923e3
4
- data.tar.gz: b99de7f4d18f002038f98d2614235a11457544b6
3
+ metadata.gz: 5d671c15ac81368b5455e674664ff50a51513226
4
+ data.tar.gz: 0357ea94158650276083212c1bfeec11767a35c7
5
5
  SHA512:
6
- metadata.gz: 83d4e11680e45508ee05f621a32faf35dca37fcbcce3f0ec8ef25b5b9daef342a938cfaeab98fab18934e90f08b0c8c3aaceb666eafbaabe4177724fdaac0625
7
- data.tar.gz: 7941378b977abf85df89b6e1d3cc5f8ec5abd1a0b332a931361ec49cb308a71ecc6dcc6035f2f5797942779f5853db055bfc5ff9b02080fae596781067e09af9
6
+ metadata.gz: b15f9e3b4e55178e5d9c99a04fe04e96ea91f90f5c47bb4c3a63c9c7e159422b634db2d76fc5db6850de33607640908a8a99141d68e1d16e287e35256c62c88b
7
+ data.tar.gz: 4dc65daef367d3bb56a6de1ef5224d85cccf21fe6174497b81e723e9c52fc5b2f7479d89742b68178b69dd56933203d4c51bb2a71975097c73903f0bdc4a726b
data/TODO CHANGED
@@ -1,4 +1,4 @@
1
1
  - SLACK notification
2
2
  - https://mesosphere.com/blog/2015/04/02/continuous-deployment-with-mesos-marathon-docker/
3
3
  - log to database
4
- - command line option for deployment-strategy: minimumHealthCapacity / maximumOverCapacity
4
+ - command line option for deployment-strategy: minimumHealthCapacity / maximumOverCapacity
data/bin/expand_macros CHANGED
@@ -6,12 +6,10 @@ require 'marathon_deploy/version'
6
6
  require 'optparse'
7
7
  require 'logger'
8
8
 
9
- DEFAULT_TEMPLATE_FILENAME = 'dockerfile.tpl'
10
-
11
9
  options = {}
12
10
 
13
11
  # DEFAULTS
14
- options[:template] = DEFAULT_TEMPLATE_FILENAME
12
+ options[:template] = 'dockerfile.tpl'
15
13
  options[:debug] = Logger::FATAL #Logger::INFO
16
14
  options[:outfile] = false
17
15
  options[:logfile] = false
data/bin/marathon_deploy CHANGED
@@ -21,6 +21,7 @@ options[:logfile] = MarathonDeploy::MarathonDefaults::DEFAULT_LOGFILE
21
21
  options[:force] = MarathonDeploy::MarathonDefaults::DEFAULT_FORCE_DEPLOY
22
22
  options[:noop] = MarathonDeploy::MarathonDefaults::DEFAULT_NOOP
23
23
 
24
+
24
25
  OptionParser.new do |opts|
25
26
  opts.banner = "Usage: #{$0} [options]"
26
27
  opts.release = MarathonDeploy::VERSION
@@ -57,6 +58,16 @@ OptionParser.new do |opts|
57
58
 
58
59
  opts.on_tail("-h", "--help", "Show this message") do
59
60
  puts opts
61
+ puts " ----------------- Additional Info -----------------", <<-DESCRIPTION
62
+ * Marathon Env variables:
63
+ - Env variables with the prefix "#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}" will be injected into the deployment plan.
64
+ - The prefix "#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}" will be removed before being added to the marathon json payload.
65
+ - Example: Env variable #{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}DEBUG=True with be passed as DEBUG=True to the marathon-api.
66
+ * Macros:
67
+ - Marcos in the deploy yaml/json file use the format %%name%%.
68
+ - Macros in the deploy yaml/json file must have a corresponding Env variable with the same name.
69
+ - If any marcos are not defined by Env variables, deployment will fail.
70
+ DESCRIPTION
60
71
  exit
61
72
  end
62
73
 
@@ -2,7 +2,6 @@
2
2
  cmd: while true; echo "HELLO WORLD $(date)"; do sleep 1 ; done
3
3
  cpus: 0.5
4
4
  env:
5
- APPLICATION_NAME: public-search-germany-webapp
6
5
  CONFIG_ASSEMBLER_BASE_URL: http://mobile-config-assembler.service.consul/config-assembler
7
6
  JAVA_XMS: 252m
8
7
  JAVA_XMX: 504m
@@ -10,6 +9,6 @@ env:
10
9
  SERVICE_8009_NAME: public-search-germany-webapp
11
10
  SERVICE_8009_TAGS: ajp
12
11
  id: public-search-germany-webapp
13
- instances: 6
12
+ instances: 2
14
13
  mem: 32
15
14
  uris: []
@@ -8,7 +8,6 @@ module MarathonDeploy
8
8
  class Application
9
9
 
10
10
  attr_reader :json, :id
11
- attr_accessor :envs
12
11
 
13
12
  def initialize(options={})
14
13
  default_options = {
@@ -52,7 +51,10 @@ module MarathonDeploy
52
51
  @json = Utils.deep_symbolize(@json)
53
52
 
54
53
  add_identifier if (options[:force])
55
-
54
+
55
+ inject_envs = ENV.select { |k,v| /^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/.match(k) }
56
+ cleaned_envs = inject_envs.map { |k,v| [k.gsub(/^#{MarathonDeploy::MarathonDefaults::ENVIRONMENT_VARIABLE_PREFIX}/,''), v ] }.to_h
57
+ self.add_envs cleaned_envs
56
58
  end
57
59
 
58
60
  def overlay_preproduction_settings
@@ -13,13 +13,14 @@ module MarathonDeploy
13
13
  DEFAULT_ENVIRONMENT_NAME = 'PREPRODUCTION'
14
14
  DEFAULT_PREPRODUCTION_MARATHON_ENDPOINTS = ['http://localhost:8080']
15
15
  DEFAULT_PRODUCTION_MARATHON_ENDPOINTS = ['http://paasmaster46-1.mobile.rz:8080']
16
- DEFAULT_DEPLOYFILE = 'deploy.yaml'
16
+ DEFAULT_DEPLOYFILE = 'deploy.yml'
17
17
  DEFAULT_LOGFILE = false
18
18
  DEFAULT_LOGLEVEL = Logger::INFO
19
19
  MARATHON_APPS_REST_PATH = '/v2/apps/'
20
20
  MARATHON_DEPLOYMENT_REST_PATH = '/v2/deployments/'
21
21
  DEFAULT_FORCE_DEPLOY = false
22
22
  DEFAULT_NOOP = false
23
+ ENVIRONMENT_VARIABLE_PREFIX = 'MARATHON_DEPLOY_'
23
24
 
24
25
  @@preproduction_override = {
25
26
  :instances => 5,
@@ -1,3 +1,3 @@
1
1
  module MarathonDeploy
2
- VERSION = "0.1.5"
2
+ VERSION = "0.1.6"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marathon_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Colby
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-04 00:00:00.000000000 Z
11
+ date: 2015-08-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logger
@@ -101,15 +101,15 @@ files:
101
101
  - bin/json2yaml
102
102
  - bin/marathon_deploy
103
103
  - examples/deploy.json
104
- - examples/deploy.yaml
105
- - examples/jondeploy.yaml
106
- - examples/jondeploy2.yaml
107
- - examples/nohealthchecks.yaml
104
+ - examples/deploy.yml
105
+ - examples/jondeploy.yml
106
+ - examples/jondeploy2.yml
107
+ - examples/nohealthchecks.yml
108
108
  - examples/public-search-germany-webapp.pre.json
109
109
  - examples/run.sh
110
- - examples/simple-python-example.yaml
110
+ - examples/simple-python-example.yml
111
111
  - examples/testout.json
112
- - examples/testout.yaml
112
+ - examples/testout.yml
113
113
  - lib/marathon_deploy.rb
114
114
  - lib/marathon_deploy/application.rb
115
115
  - lib/marathon_deploy/deployment.rb
File without changes
File without changes
File without changes