regenwolke_autons 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9f65003d5faaf55c932e50c914b7da3021efb764
4
+ data.tar.gz: 4531ba75daaa4c57bbf3c64e11ed88bfb4cf1f56
5
+ SHA512:
6
+ metadata.gz: 1882bd8ca1c6af09a2934358769ba64980c0cfcc7408fb5d4fb65f388836004a77077a2f2369c7720d31a98044f34c1dab97728f0c12c60391aead4c6e87bcf1
7
+ data.tar.gz: e49cc36198b4e89c53a53311d2bd0ef17a16081c9ef9d496f0ea5d58b4dd8fdfdcad687cf0f2d7a8e9630aa1a8b945ee0bf774dd70993e4bbd84ec00bd5ef053
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in regenwolke_autons.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Net Ice 9 Ltd
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # RegenwolkeAutons
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'regenwolke_autons'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install regenwolke_autons
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/regenwolke_autons/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,4 @@
1
+ require 'nestene'
2
+ require 'regenwolke_autons/regenwolke_auton'
3
+ require 'regenwolke_autons/nginx_auton'
4
+ require "regenwolke_autons/version"
@@ -0,0 +1,54 @@
1
+ require 'structure_mapper'
2
+ require 'childprocess'
3
+
4
+ module RegenwolkeAutons
5
+
6
+ class NginxAuton
7
+
8
+ include StructureMapper::Hash
9
+
10
+ attribute pid: Fixnum
11
+ attribute stdout: String
12
+ attribute stderr: String
13
+
14
+ attr_accessor :context
15
+
16
+ def start
17
+ context.schedule_step(:start_nginx)
18
+ end
19
+
20
+ def start_nginx
21
+ create_config
22
+ cp = ChildProcess.build('nginx', '-p', '.', '-c', 'nginx.config')
23
+ cp.detach = true
24
+ cp.start
25
+ self.pid = cp.pid
26
+ end
27
+
28
+ def check_process
29
+ context.schedule_step(:start_nginx) unless nginx_process_exist?
30
+ end
31
+
32
+ private
33
+
34
+ def nginx_process_exist?
35
+ begin
36
+ Process.getpgid( pid )
37
+ true
38
+ rescue Errno::ESRCH
39
+ false
40
+ end
41
+ end
42
+
43
+ def create_config
44
+ applications={'regenwolke' => [3000]}
45
+ erb = ERB.new File.read(File.expand_path('../nginx_config.erb', __FILE__))
46
+ File.write("nginx.config",erb.result(binding))
47
+ end
48
+
49
+ end
50
+
51
+ Nestene::Registry.register_auton(NginxAuton)
52
+ end
53
+
54
+
@@ -0,0 +1,73 @@
1
+ daemon off;
2
+ worker_processes 1;
3
+
4
+
5
+ error_log nginx-error.log;
6
+ #error_log /var/log/nginx/error.log notice;
7
+ #error_log /var/log/nginx/error.log info;
8
+
9
+ pid nginx.pid;
10
+
11
+ events {
12
+ worker_connections 1024;
13
+ }
14
+
15
+
16
+ http {
17
+ #include /etc/nginx/mime.types;
18
+ default_type application/octet-stream;
19
+
20
+ log_format main '$remote_addr - $remote_user [$time_local] "$request" '
21
+ '$status $body_bytes_sent "$http_referer" '
22
+ '"$http_user_agent" "$http_x_forwarded_for"';
23
+
24
+ access_log access.log main;
25
+
26
+ sendfile on;
27
+ #tcp_nopush on;
28
+
29
+ #keepalive_timeout 0;
30
+ keepalive_timeout 65;
31
+
32
+ #gzip on;
33
+
34
+ server_names_hash_bucket_size 128;
35
+
36
+ # log_format timed_combined '$remote_addr - $remote_user [$time_local] '
37
+ # '\"$request\" $status $body_bytes_sent '
38
+ # '\"$http_referer\" \"$http_user_agent\" '
39
+ # '$request_time $upstream_response_time $pipe';
40
+
41
+
42
+
43
+ <% applications.each do |host, ports| %>
44
+ upstream <%= host.gsub('.','_') %> {
45
+ <% ports.each do |port| %>
46
+ server localhost:<%= port %>;
47
+ <% end %>
48
+ keepalive 50;
49
+ }
50
+
51
+ server {
52
+ listen 9080;
53
+ server_name ~^<%= host %>\..+$;
54
+ server_tokens off;
55
+ root /nowhere;
56
+
57
+ #access_log /var/log/nginx/access.log timed_combined;
58
+ #error_log /var/log/nginx/error.log;
59
+
60
+ location / {
61
+ proxy_read_timeout 300;
62
+ proxy_connect_timeout 300;
63
+ proxy_redirect off;
64
+ proxy_http_version 1.1;
65
+ proxy_set_header Host $http_host;
66
+ proxy_set_header Connection \"\";
67
+ proxy_pass http://<%= host.gsub('.','_') %>;
68
+ }
69
+
70
+ }
71
+
72
+ <% end %>
73
+ }
@@ -0,0 +1,15 @@
1
+ require 'structure_mapper'
2
+
3
+ module RegenwolkeAutons
4
+
5
+ class RegenwolkeAuton
6
+ include StructureMapper::Hash
7
+
8
+
9
+ attribute test: String
10
+ end
11
+
12
+ Nestene::Registry.register_auton(RegenwolkeAuton)
13
+ end
14
+
15
+
@@ -0,0 +1,3 @@
1
+ module RegenwolkeAutons
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'regenwolke_autons/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "regenwolke_autons"
8
+ spec.version = RegenwolkeAutons::VERSION
9
+ spec.authors = ["Dragan Milic"]
10
+ spec.email = ["dragan@netice9.com"]
11
+ spec.summary = %q{Regenwolke PAAS Autons}
12
+ spec.description = %q{Regenwolke PAAS Autons}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "childprocess", "~> 0.5.2"
22
+ spec.add_dependency "nestene", "~> 0.1.4"
23
+ spec.add_dependency "structure_mapper", "~> 0.0.2"
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec", "~> 3.1"
27
+
28
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: regenwolke_autons
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Dragan Milic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: childprocess
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.5.2
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.5.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: nestene
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.4
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.4
41
+ - !ruby/object:Gem::Dependency
42
+ name: structure_mapper
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 0.0.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 0.0.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.7'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.7'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '3.1'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '3.1'
97
+ description: Regenwolke PAAS Autons
98
+ email:
99
+ - dragan@netice9.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".gitignore"
105
+ - Gemfile
106
+ - LICENSE.txt
107
+ - README.md
108
+ - Rakefile
109
+ - lib/regenwolke_autons.rb
110
+ - lib/regenwolke_autons/nginx_auton.rb
111
+ - lib/regenwolke_autons/nginx_config.erb
112
+ - lib/regenwolke_autons/regenwolke_auton.rb
113
+ - lib/regenwolke_autons/version.rb
114
+ - regenwolke_autons.gemspec
115
+ homepage: ''
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.2.2
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Regenwolke PAAS Autons
139
+ test_files: []